Re: Euler's number + Python

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Euler's number + Python

Jerabek Jindrich
Hello,

did you import math module?

begin program.
import math
def test(x):
  return exp(x)
end program.



> ------------ Původní zpráva ------------
> Od: SD <[hidden email]>
> Předmět: Euler's number + Python
> Datum: 25.6.2012 14:58:17
> ----------------------------------------
> Hello again,
>
> I have another question.
> This time I want to write a function in Python and continue working with it
> in SPSS.
> Reduced to the part which doesn't work I have just this code:
>
> begin program.
> def test(x):
>  return e**x
> end program.
>
> spssinc trans result=testet
>  /Formula "test(2)".
>
> Like this, SPSS tells me, that it doesn't know 'e'.
> Changing e**x to exp(x) return in the same like above but wit 'exp' instead
> of 'e'.
> Also using math.e or math.exp(x) doesn't help.
>
> I am sure there is an easy solution, but I don't know it.
> The math-modul should normally be available if I can use Python, right?
>
> Thanks in advance,
> SD.
>
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/Euler-s-number-Python-tp5713773.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD