I'm a new user of Mathematica 12. I have to plot real and imaginary solutions of two equations, eq1 and eq2, which contain the Dawson integral. Here is my program:
f[a_] := - 2 DawsonF[a]+I Exp[-a^2] Sqrt[π]
eq1[x1_, y_, z_] := 1 - (z y^2/x1^2) - (1/(Sqrt[2] x1 y)) f[x1/(Sqrt[2] y)]
eq2[x2_, y_] := 1 - (1/(2 y^2)) f'[x2/(Sqrt[2] y)]
slo1[y_, z_] := Re[x1 /. FindRoot[eq1[x1, y, z], {x1, Sqrt[1 + z y^2]}]];
slo2[y_] := Re[x2 /. FindRoot[eq2[x2, y], {x2, Sqrt[1 + y^2]}]];
Plot[{slo1[y, 5000], slo2[y]}, {y, 0.0001, 0.5}, PlotRange -> {{0.0001, 0.5}, {0, 4}}, PlotRangePadding -> 0]
When I plot the graphs, I get these errors
General::munfl: Exp[-4.11658*10^7] is too small to represent as a normalized machine number; precision may be lost.
General::munfl: Exp[-4.11658*10^7] is too small to represent as a normalized machine number; precision may be lost.
FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances.
General::munfl: Exp[-4.11633*10^7] is too small to represent as a normalized machine number; precision may be lost.
General::stop: Further output of General::munfl will be suppressed during this calculation.
FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances.
This means that that the solutions plotted are incorrect. Please tell me how to eliminate these errors to get the exact solutions.
How to plot imaginary solutions too without errors?
Thank you.
WorkingPrecisionoption inFindRoot– Michael E2 Apr 04 '20 at 03:40WorkingPrecisiontoFindRootdoesn't seem to help enough. The form of your equations produces numbers so small that they can't be correctly expressed in floating point. Another issue is that your two graphs are different enough that when you combine them you miss critical details. Try replacing yourPlotwithPrint[ListPlot[Table[{y,slo1[y, 5000]},{y,10^-4,1/2,10^-3}],Joined->True,PlotRange->All]]; Print[ListPlot[Table[{y, slo2[y]},{y, 10^-4,1/2,2*10^-3}], Joined->True]]and look VERY carefully at the details. You might want to zoom into the left side of the first plot. – Bill Apr 04 '20 at 05:09Exp[-4.11658*10^7]has over 17 million zeros after the decimal point. The real fix for your problem is probably your deeply understanding the size of all the numbers involved in finding your solution and seeing if there is or is not a way of completely reformulating your problem to avoid these issues, if that is possible. – Bill Apr 04 '20 at 17:01DawsonF[]is known to be problematic in versions 11.3 and later. Can you try using the compiled Dawson integral from this answer? (Of course, you will need to re-express and separately definef'[x]in terms of the compiled Dawson function.) – J. M.'s missing motivation Apr 17 '20 at 15:47