I am solving following differential equation using Mathematica,
s = NDSolve[{u''[x] == (42/10)*Sin[x]*Sin[x]*u[x], u[-3] == 0,
u'[3] == 1}, u, {x, -3, 3}, WorkingPrecision -> 22,
InterpolationOrder -> All]
Plot[Evaluate[{u[x] /. s}, {x, -3, 3}], AxesLabel -> {"x", "v(x)"},
PlotStyle -> {Thickness[0.005]}, PlotRange -> All]
I would like to plot this output with gnuplot (as all of the other figure in my report are generated using gnuplot) to be consistent. How can I generate file with $x$ and $u(x)$ values written in 2 columns?
I tried to write output in a file,
sW = OpenWrite["out.dat", FormatType -> TraditionalForm];
$Output = {sW};
Write[sW, x, Evaluate[u[x] /. s], {x, -3, 3, 1}]
Close[sW];
But this does not print values of $u(x)$
Plot
withCases[plot, _Line, Infinity][[1, 1]]
. BTW, not part of your question, but you should useExport
instead of rawOpen/Write
operations. $\endgroup$