I'm trying to construct a text-file that contains all the operations that Mathematica performs when evaluating an expression. However, i'd like to suppress all output in the notebook in which I'm doing the calculations.
For instance printing the operations for calculating the root of x^2 = 1 in Mathematica.txt is done as follows:
stream = OpenWrite["c:/Data/Mathematica.txt"];
AppendTo[$Output, stream];
Print[TracePrint[Solve[x^2 == 1, x]]];
Close[stream];
$Output = Most[$Output];
which gives the following output in my Notebook:
Solve[x^2==1,x]
Solve
x^2==1
Equal
(x^2)
Power
x
2
1
x
x^2==1
x^2==1
{{x->-1},{x->1}}
{{x->-1},{x->1}}
and the following output in Mathematica.txt
HoldForm[Solve[x^2 == 1, x]]
HoldForm[Solve]
HoldForm[x^2 == 1]
HoldForm[Equal]
HoldForm[x^2]
HoldForm[Power]
HoldForm[x]
HoldForm[2]
HoldForm[1]
HoldForm[x]
HoldForm[x^2 == 1]
HoldForm[x^2 == 1]
HoldForm[{{x -> -1}, {x -> 1}}]
{{x -> -1}, {x -> 1}}
Is there a way to not get the first block of 'output'?
Thanks a lot!