Message Boards Message Boards

0
|
1179 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Solve simple Wolfram problems in Python?

Posted 3 years ago

Hi all, I spent days reading documentation solo but I'm stuck. Using Python 3.8.5 with Wolfram Client Library on Windows 10.

Goal: Input problem in Python (e.g. as string '2*pi') then output solution as workable Python object (e.g. float or string "6.283")

Sample Code (not incl. module imports):

input_problem = '2*pi'

output_solution = session.evaluate(wlexpr(problem))

print(output_solution)

Desired output: 6.283

Actual Output: Times[2, Global`pi]

Output Type: <class 'wolframclient.language.expression.WLFunction'>

Any help or direction is greatly appreciated, thank you!

POSTED BY: Mitch O'Grady
Posted 3 years ago

Try Pi, not pi.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract