0
$\begingroup$

If I have the following code, where cp74[j] represents a very long list (e.g. {{a,b}{c,d},{e,f},{g,h},...} for different j values.

 Do[
     cpi = Interpolation[cp74[j], InterpolationOrder -> 10];
     cpint = -Integrate[cpi[x], {x, 90.01, 74}]
       // Print, {j, 1, 10, 1}
     ]

What is the reason I am getting error messages like this that include 73.9626 which is below the range of integration:

image

Also I noticed that when I remove the line of cpint = -Integrate[cpi[x], {x, 90.01, 74}] just to see the interpolation that I am getting, I get at least three messages like this, where it says that Data not in notebook:

image 2

What can I do to solve the problem and be able to interpolate and integrate this data?.

Thank you

$\endgroup$
4
  • $\begingroup$ Can you plot the data in the interpolating function? It appears as if there is no data there or it is not in the form that you seem to expect. $\endgroup$ – bill s May 9 '20 at 1:25
  • 1
    $\begingroup$ I cannot reproduce the problem. The second error message indicates that x has a value. Try Clear[x] and re-execute $\endgroup$ – Michael E2 May 9 '20 at 1:56
  • 1
    $\begingroup$ By the way, Integrate[cpi[x], x] will return the antiderivative more quickly that evaluating the definite integral. $\endgroup$ – Michael E2 May 9 '20 at 2:15
  • $\begingroup$ @MichaelE2 thank you! You are right. My problem was exactly that I have a very long code and x was defined someplace else and that is what was giving me problems! Thanks for the catch ! $\endgroup$ – John May 9 '20 at 2:58

Your Answer

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

Browse other questions tagged or ask your own question.