0
$\begingroup$

I have a list of expressions in a text file. I would like mathematica to evaluate and export the results at the end of the same file or in a new file. The expressions are in seperate lines in the text file.

$\endgroup$

1 Answer 1

2
$\begingroup$
cat a.txt
{Series[f[x],{x,x0,10}],Plot[Sin[x],{x,-Pi,Pi}]}

Then

SetDirectory[NotebookDirectory[]];
expr = Import["a.txt"]

Mathematica graphics

result = ToExpression[expr]

Mathematica graphics

Export["result.txt", result]

then

>cat result.txt 

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.