0
$\begingroup$

I have made an interpolation of two variables of a fairly large set of numbers imported from a file (4 million lines in an .m file written out with C++).

The ranges of the two parameters is 0 to 2.5 and 0 to 60, respectively, so I am confused why the interpolation for certain ranges inside 0:2.5, 0:60 , seen most clearly when plotting.

When evaluating in one of these undefined ranges, for example 0.2, 0.2 it takes many seconds before finally outputting something like this.

0.030098` + 
0.005752199999999999` (1.8894271781617253` - 
0.009955999999999993` (22.098356216511277` + 
   0.0214602` (-55.4176617318362` - 
      0.025663999999999992` (-1495.3986641465997` + 
         0.03716810000000001` (10148.485672332376` - 
            0.04137199999999999` (61777.19935813235` + 
               0.0528761` (-818590.1061571125` - 
                0.05707999999999999` (-15.915482422145436` \
(818590.1061571125` - 
                12.73234946224922` (-10343.382090047433` - 
                21.220654487425698` (-7724.724645111078` - 
                10.61029347010709` (865.1929296352522` - 
                31.83091418385536` (21.333461835452677` - 
                9.094538638602133` (-15.74708850390108` - 
                63.66182836771069` (-1.7906312792105215` - 
                7.9577222134245185` (-5.197116` + 
                2.53974` e))))))))))))))))

It seems that e is undefined, so why would Mathematica use it automatically?

If I manually set e = E, then I can evaluate the above lines, but the function is still unwilling to be plotted on some ranges (takes several minutes of "running" after which is stops with $Aborted message).

Could it be that I should simply not use Interpolation for files that big?

$\endgroup$
  • 1
    $\begingroup$ Found out it was the way that the .m file was being written. It writes scientific as 5e-5 for instance, whereas Mathematica would write 5*^-5 so the error was on my part. Not sure if the post should be deleted then? $\endgroup$ – Kaspar H Mar 27 '17 at 9:02
  • 1
    $\begingroup$ Import[] can handle exponential notation: ImportString["2e-5,3e-4\n0.4,0.1", "CSV"]. $\endgroup$ – J. M.'s technical difficulties Mar 27 '17 at 9:14
  • $\begingroup$ @KasparH, you could self answer your question or delete it. $\endgroup$ – user21 Mar 27 '17 at 9:50
2
$\begingroup$

Found out it was the way that the .m file was being written. It writes scientific as 5e-5 for instance, whereas Mathematica would write 5*^-5 so the error was on my part. Posted anyway to potentially help other clueless people like me.

| improve this answer | |
$\endgroup$

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.