Errors when plotting but not when evaluating

  • Context: Mathematica 
  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Errors Plotting
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 2K views
member 428835
Hi PF!

Attached is a screenshot of my code:
Screen Shot 2018-03-13 at 1.07.00 PM.png

The issue I'm facing is not being able to plot at line 21. It's weird because when I evaluate ##\alpha[1/4]## on it's own line I instantly receive a 5X1 vector. When I evaluate the Table[##\phi##] statement also shown in line 21 on it's own line I receive instantly a 5X1 vector too. Then when I copy-paste these results and dot them into each other I instantly get a good answer. So why can I not do this on the same line?

On line 21, I've tried changing the ##x## variable in ##\phi## to a ##z## and plotting in ##z##, but it takes so long to run this way. I've also tried evaluating ##\alpha## since this seems to be the issue, but again no luck.

Any help would be awesome!
 

Attachments

  • Screen Shot 2018-03-13 at 1.07.00 PM.png
    Screen Shot 2018-03-13 at 1.07.00 PM.png
    25.2 KB · Views: 1,026
on Phys.org
I'm not sure, but it could be because it is trying to evaluate ##\phi## using a numerical value for ##x##. Try and see if the following helps:
Code:
Plot[\[Alpha][1/4].Table[\[Phi][xx, k, 1/4], {k, 1, 1/1/4 + 1}] /.
  xx -> x, {x, 0, 1}]
 
DrClaude said:
I'm not sure, but it could be because it is trying to evaluate ##\phi## using a numerical value for ##x##. Try and see if the following helps:
Code:
Plot[\[Alpha][1/4].Table[\[Phi][xx, k, 1/4], {k, 1, 1/1/4 + 1}] /.
  xx -> x, {x, 0, 1}]
Yea I tried this but it takes a ridiculous amount of time. Much longer than if I compute manually and then take the dot product. I'm glad I tried this first though! Makes me think I am doing something right!