djxvillain
2016-10-27 19:58:25 UTC
Hello all,
I am an electrical engineer and new to numpy. I need the ability to take in
user input, and use that input as a variable. For example:
t = input('enter t: ')
x = input('enter x: ')
I need the user to be able to enter something like x =
2*np.sin(2*np.pi*44100*t+np.pi/2) and it be the same as if they just typed
it in the .py file. There's no clean way to cast or evaluate it that I've
found.
I could make a function to parse this string character by character, but I
figured this is probably a common problem and someone else has probably
figured it out and created an object for it. I can't find a library that
does it though.
If I can provide any more information please let me know. Thank you in
advance for your help.
--
View this message in context: http://numpy-discussion.10968.n7.nabble.com/How-to-use-user-input-as-equation-directly-tp43665.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
I am an electrical engineer and new to numpy. I need the ability to take in
user input, and use that input as a variable. For example:
t = input('enter t: ')
x = input('enter x: ')
I need the user to be able to enter something like x =
2*np.sin(2*np.pi*44100*t+np.pi/2) and it be the same as if they just typed
it in the .py file. There's no clean way to cast or evaluate it that I've
found.
I could make a function to parse this string character by character, but I
figured this is probably a common problem and someone else has probably
figured it out and created an object for it. I can't find a library that
does it though.
If I can provide any more information please let me know. Thank you in
advance for your help.
--
View this message in context: http://numpy-discussion.10968.n7.nabble.com/How-to-use-user-input-as-equation-directly-tp43665.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.