HP Forums
How to plot an integral on Prime? - 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: How to plot an integral on Prime? (/thread-7845.html)



How to plot an integral on Prime? - TheKaneB - 02-28-2017 11:53 PM

Hi,

I'm trying to plot the integral of a function, just like this: http://www.wolframalpha.com/input/?i=plot+integral+from+0+to+x+of+x%5E2

I can do it very easily with Wolfram / Mathematica, and the TI calcs also work but they are slow.

I tried this on my Prime:
CAS.int(x*x, x, 0, x)
but all I get is a Syntax Error.

If I try to enter the function using the Integral graphical template, it will enter, but the plot is empty and the Numerical Table is full of NaN.

Please help!

PS: It would be nice to plot this also in my 50g. I'm struggling with it, which is a shame since it's my favourite calc!


RE: How to plot an integral on Prime? - TheKaneB - 03-01-2017 01:10 AM

Update:

on the 50g I've found a way to plot the function I want:
y(x) = INTVX(f(x)) - INT(f(x), x, 0)

Example: on the TI-89 I plot: ( I will use $ for the integral symbol)
y(x) = $(ln(x), x, 0, x)

and on the 50g:
y(x) = INTVX(LN(x)) - INT(LN(x), x, 0)

On the 50g the function entry is quite tedious, BUT it's many times faster than the TI. While the TI has drawn the first 2 pixels, the 50g has already finished the whole graph 3 times in a row Smile

But still no luck on the Prime Sad
Honestly, I'm getting tired of this calculator... If I can't solve this issue I'll stick to my 50g for everything


RE: How to plot an integral on Prime? - Han - 03-01-2017 01:56 AM

1. Press the [Apps] key. Select the Function app.
2. Press [Symb] and enter in: \( \int \)(T^2, T, 0, X) (in algebraic entry mode) or \(\displaystyle \int_0^X T^2\ dT \) (in textbook entry mode)
3. Press [Plot]

You cannot use the X for your variable of integration because the system uses X as the input variable of the function being plotted. It evaluates the formula at various values of X, but it cannot do so if your formula is \( \int \)(X^2,X,0,X).

Think of it this way:

If \( \displaystyle f(x) = \int_0^x x^2\ dx \) then would
\[ f(2) = \int_0^2 2^2\ d2 \]
make much sense? (Pay attention to the differential "\( d2 \)")


RE: How to plot an integral on Prime? - TheKaneB - 03-01-2017 02:20 AM

It works, thank you!
Now I have another problem.

I tried to plot the integral from 0 to x of tan(t^2) and it's stuck forever. Keyboard and screen are unresponsive, [Esc] and [On] keys don't seem to stop the computation.

After 2 minutes I decided to reset, then I tried again in Table view ( [Num] key ) and at least it's calculating correctly. Maybe it's just too heavy of an integral for the plot view.

Anyway, this is another issue. Thanks again!

EDIT: Your explanation is spot on, I tought that the HP would substitute the 'x' only inside the expression, but that would require a special case to handle the integral correctly. I wonder if TI and Wolfram did a special code path just for the integral, it would make sense for an educational market.


RE: How to plot an integral on Prime? - Han - 03-01-2017 03:13 AM

Try this alternate method:

In the CAS, create a function like so:

f(x):=int(tan(t^2),t,0,x);

Then in the [Symb] view, use f(X) as your formula. (Note upper vs lower case) I generally prefer this method since it means I can use the function f for other calculations as well as graphing.