5
$\begingroup$

Bug introduced in 10.4.1 or earlier and fixed in 11.1.1


Apparent bug observed in MMA 11.0.0.0.

2016/11/10 Wolfram Support Team contacted.

2016//11/29 Passed along the report to developers for further diagnosis


The following code is just to generate the InterpolatingFunction of interest:

isPeriodic[vals_, ic_] := (Norm[vals - ic] < .02) && (t < -1 || t > 1)
vars = Array[s, 2];
varst = Through[vars[t]];
ic = {56.30672012303853`, 1.9416110387254666`};
sysDAE0 = {{0.2763932022500211` Sin[0.8090169943749473` (-s[1][t] + s[2][t])] Sin[
        0.3090169943749473` (s[1][t] + s[2][t])] + 0.7236067977499788` Sin[0.3090169943749473` (-s[1][t] + s[2][t])] 
Sin[0.8090169943749473` (s[1][t] + s[2][t])]} == {0}, 
   Derivative[1][s[1]][t]^2 + Derivative[1][s[2]][t]^2 == 1.`, {s[1][0], s[2][0]} == ic,
 {Derivative[1][s[1]][0], Derivative[1][s[2]][0]} == {-0.8903443552034469`, 
     0.45528774325404187`}};
isPeriodic[vals_, ci_] := (Norm[vals - ci] < .02) && (t < -1 || t > 1)
(*solves the system*)periodicQ = False;
{solDAE} = NDSolve[{sysDAE0, 
   WhenEvent[Evaluate@isPeriodic[varst, ic], periodicQ = True; "StopIntegration"], 
   WhenEvent[Positive[t] && periodicQ,"StopIntegration", "LocationMethod" -> "StepBegin"]}, 
vars, {t, -1000, 1000}]
sol[t_] := Through[(vars /. solDAE)[t]];
{tmin, tmax} = Flatten@solDAE[[1]][[2, 1]];

That works perfectly well, and sol[t] returns

Mathematica graphics

Now, if I save sol[t] and import it back:

Export["temp.m", sol[t]]
sol2 = Import["temp.m"]

returns the InputForm of the function, instead of the nice compact one (StandardForm):

{InterpolatingFunction[{{-13.8905, 0.}}, {5, 3, 1, {583}, {4}, 0, 0, 
   0, 0, Automatic, {}, {}, 
   False}, {{-13.8905, -13.8543, -13.8179, -13.7815, -13.7452, \
-13.7088, -13.6724, -13.636, -13.5997, -13.5633, -13.5269, -13.4905, \
-13.4724, -13.4542, -13.436, -13.4178, -13.3996, -13.3814, -13.3632, \
-13.345, -13.3269, -13.3063, -13.2858, -13.2652, -13.2447, -13.2241, \
-13.2036, -13.1808, -13.1579, -13.1326, -13.1072, -13.0819, -13.0565, \
...

Note that without WhenEvent[Positive[t] && periodicQ,"StopIntegration", "LocationMethod" -> "StepBegin"], the Import works perfectly: it gives the InterpolatingFunctions in the nice form.

What is happening and how to solve this issue?

Edit It appears to be somehow related to "LocationMethod" -> "StepBegin": when removed, the importation works well. But I don't see the point.

$\endgroup$
  • $\begingroup$ That's a bug - please report this to Wolfram (support AT wolfram.com). $\endgroup$ – user21 Nov 10 '16 at 9:15
  • $\begingroup$ @user21 Done. Side question: how can you be sure it's a bug? Of course, I find it strange too, but some other things I found strange sometimes appeared to come from my misunderstandings. $\endgroup$ – anderstood Nov 10 '16 at 15:16
  • $\begingroup$ The fact the the re-imported InterpolatingFunction did not evaluate to it's data structure InterpolatinngFunction[<..>] suggests that it did not evaluate; and that's a bug. In principal one could write by hand the content of an InteprolatingFunction[] ( in theory) and there has to be an internal check that whatever is entered is actually a valid InterpolationFunction data structure - that check, my guess, did not like something when it got re-inported and rejected the data structure to be a valid InterplatingFunction data structure. $\endgroup$ – user21 Nov 10 '16 at 17:03
0
$\begingroup$

I just received an email from Wolfram Technical Support mentioning that this bug has been resolved in the current 11.1.1 release of Mathematica.

That'd be perfect if someone could confirm.

$\endgroup$
  • 1
    $\begingroup$ I reproduced the bug with versions 10.4.1 and 11.0.1. With version 11.1.1 there is no bug. $\endgroup$ – Alexey Popkov Apr 27 '17 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.