I'm new here, so please apologize any formal errors.
I stumbled upon a somewhat simple problem. I want to import plain numbers or protected signs like Pi, Cos, Sin from .txt files. Somehow Mathematica does not understand that the read-in Pi is the protected Pi (= 3.14...). Even more simple examples seem not to work, e.g. reading in the number 5 from a .txt-file does not allow for using that 5 for further calculations.
My approach was:
- Saving the sign/number in a txt file. E.g. Pi.txt contains just "Pi" (without quotation marks).
- My Mathematica code is
SetDirectory["C:\\Code"];
x := Import["Pi.txt"]
f[t_] = Sin[t];
Evaluate[f[x]]
Thank you for your help.
ToExpression[Import["Pi.txt"]]– b.gatessucks Jul 14 '12 at 18:48x // InputForm. – Heike Jul 14 '12 at 19:10