I started working on Mathematica today. I'm trying to save the result of a loop in a file as a column, very simple to do, but hard for someone who doesn't know Mathematica syntax. Here is my code:
For[i = 1/10, i <= 4, i += (1/1000),
l = NIntegrate[(-1 + 0.707106781186547`/(-x^2 E^-x^2 + 0.5`)^0.5`)/x, {x, ∞, i}];
Save["data.dat",l]
]
but obviously, this code is not working, it seems Save
only works with strings. I have tried data streams, but I'm getting aborted each time I try.
How can I save the output from NIntegrate
into a data file, in a loop?