Plotting h[2,x,0.5] in Mathematica gives errors

2 replies · 4K views · last reply
member 428835
Hi PF!

I have the following in Mathematica.
Mathematica notebook showing the definition of v[k_, x_, a_] using LegendreP, and below a Gram-Schmidt section defining h[k_, x_, a_] with nested NIntegrate normalisation over x from -1 to 1.
Mathematica notebook showing h[2, x, 0.5] evaluating to 0.968246 (0. - 1. x + 1/2 (-1 + 3 x^2)), then Plot[h[2, x, 0.5], {x, -1, 1}] producing NIntegrate::itraw errors and an empty plot with axes from -1 to 1.

Notice h[2,x,0.5] gives me an output in terms of x, but when I try to plot this I get errors. Anyone know why this is? I read the error messages but am still unsure why I am not getting a clean output.
 
Attachments
  • Mathematica notebook showing the definition of v[k_, x_, a_] using LegendreP, and below a Gram-Schmidt section defining h[k_, x_, a_] with nested NIntegrate normalisation over x from -1 to 1.
    Screen Shot 2018-02-26 at 1.41.39 PM.png
    21.1 KB · Views: 1,092
  • Mathematica notebook showing h[2, x, 0.5] evaluating to 0.968246 (0. - 1. x + 1/2 (-1 + 3 x^2)), then Plot[h[2, x, 0.5], {x, -1, 1}] producing NIntegrate::itraw errors and an empty plot with axes from -1 to 1.
    Screen Shot 2018-02-26 at 1.41.48 PM.png
    20.1 KB · Views: 1,059
  • Like
Likes   Reactions: member 428835
jedishrfu said:
Have you googled the error messages? Often other users of Mathematica or Matlab post these questions on forums too and someone may answered it already. ALso I would check the Mathematica website for more info on the error message.

I found these two examples:

https://www.physicsforums.com/threads/summation-with-mathematica.498250/

https://stackoverflow.com/questions/40987025/raw-object-1-cannot-be-used-as-an-iterator
Thanks for your response. While the two links didn't explicitly help me, you made me think about digging deeper in what I wrote. Problem was I needed to evaluate the integrals using dummies. Makes sense. Thanks.
 
  • Like
Likes   Reactions: jedishrfu