Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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