HP Forums
Plotting a function defined by an integral - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Plotting a function defined by an integral (/thread-154.html)



Plotting a function defined by an integral - cdecastro - 12-18-2013 04:05 PM

Noticed the following issue when plotting a function defined by an integral expression.

in CAS mode, I defined a function
f1:=(d)->int(x^2,x,0,d)

The function correctly evaluates at various points on the CAS home screen
f1(2)=8/3
f1(4)=64/3

Additionally, the following statement correctly places the function of X in the Function App window (plot symbolic screen)
F1:=f1

however, no plot is produced and the calculator indicates that F1 is undefined. Is this a limitation of the Function APP or am I overlooking something?

Appreciatively,
Chris


RE: Plotting a function defined by an integral - Helge Gabert - 12-18-2013 05:29 PM

If I put the integral directly into Symb function app:

say, F1(X)=\int_0^X Y^2 dY,

it does plot (you can see some dots being plotted), but without a connecting line, and in Num view, all X values get evaluated correctly.


RE: Plotting a function defined by an integral - cdecastro - 12-19-2013 03:18 PM

(12-18-2013 05:29 PM)Helge Gabert Wrote:  If I put the integral directly into Symb function app:

say, F1(X)=\int_0^X Y^2 dY,

it does plot (you can see some dots being plotted), but without a connecting line, and in Num view, all X values get evaluated correctly.

When I enter the expression manually as you suggested, I do see points plotted. However, when I assign the function indirectly via an assignment (as previously described), I see no points (initially). Eventually, the plot does appear. This is because it takes "Forever and a day" (~1.5-2 min) for the calculator to do all the requisite integral evaluations. Needless to say, one can forget about scrolling around in the plot given this lag.
It seems the adaptive plotting routines could use some refinement- as the manually entered plot does not show enough detail (unconnected points) and the one entered programmatically generates too much (perhaps) detail in generating the plot.


RE: Plotting a function defined by an integral - Tim Wessman - 12-19-2013 05:01 PM

F1(X)=f1 will not work. You have no 'X' variable to work with. I am guessing trying F1(X)=approx(f1(X)) will work fine.

Without that approx, you are getting symbolic objects out and it has no number to work with except in places where it evaluates down to a real whole number.


RE: Plotting a function defined by an integral - cdecastro - 12-19-2013 06:19 PM

(12-19-2013 05:01 PM)Tim Wessman Wrote:  F1(X)=f1 will not work. You have no 'X' variable to work with. I am guessing trying F1(X)=approx(f1(X)) will work fine.

Without that approx, you are getting symbolic objects out and it has no number to work with except in places where it evaluates down to a real whole number.

When I assign:
f1:=(d)->int(x^2,x,0,d);
F1:=f1;

the graph will plot; It just takes a long time. Obviously it is much faster if I make the graphing window narrower. I'll give your suggestion a try. Thanks for the reply.