Post Reply 
Numerical integration direct from the keyboard?
06-25-2023, 02:33 PM
Post: #1
Numerical integration direct from the keyboard?
It seems to be eluding me. Coming from a DM42, this is very easy, and has been known since the 34C. But the Prime is obtuse at best. I get the int() function. But that doesn't work; not even the examples in Help. But it does work in a program. There seems to be no way (that I have found) to do numerical integration otherwise. Can I only use int() in a program?

-J
Find all posts by this user
Quote this message in a reply
06-25-2023, 02:37 PM (This post was last modified: 06-25-2023 02:38 PM by Joe Horn.)
Post: #2
RE: Numerical integration direct from the keyboard?
Sounds like you're in Home view. In CAS view, all three examples in the built-in Help screen for int() work. I personally use the integrate template (the key between the toolbox key and the x-t-theta-n key) in Textbook entry mode so that I don't have to remember the syntax of int().

N.B. Before doing any symbolic work on x, be sure that it contains no value. You might have to del(x).

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
06-25-2023, 02:49 PM
Post: #3
RE: Numerical integration direct from the keyboard?
Thanks for the help, but it's giving me the symbolic integral, I need numerical integration.

And when I call up int() in CAS mode there is only 1 example, not the three I see in Home mode.
Maybe I have a setting wrong?

-J
Find all posts by this user
Quote this message in a reply
06-25-2023, 03:01 PM
Post: #4
RE: Numerical integration direct from the keyboard?
You are probably looking at the help for this:

"Syntax:
∫(Expr, Var, Val1, Val2)

Returns the integral of an expression.

With one expression as argument, returns the indefinite integral with respect to x. With the optional second, third and fourth arguments you can specify the variable of integration and the bounds for a definite integral.


Example:
∫(2*X,X,0,3) → 9"

Note that ∫ is not the same command as int(). Not sure if you dug into the catalog to find it, or where you got to there as the menus and templates all refer to the int( ) function instead.

∫ really was left in as a compatibility call only. internally, it just calls int( ) and then approximates at the end.

You can do the same thing by just putting . anywhere in your int command. int(2*x,0.,3) spits out "9." <--- the dot means an approximation has taken place as you no longer have a symbolic object, but an approximated number.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
06-25-2023, 04:29 PM (This post was last modified: 06-25-2023 04:32 PM by John Garza (3665).)
Post: #5
RE: Numerical integration direct from the keyboard?
Thanks for the help all.

However, this is one of those things that tends to drive me away from the newer HP calculators for anything other than a novelty. It comes down to simple usability and having an intuitive interface.

I, like the average new user to the Prime, sees CAS, and says 'Computer Algebra System = Symbolic Work' and I do NOT want symbolic integration, so I look elsewhere and do not consider that option. So... I am off chasing the wild geese...!

Then when using Home, I get many syntax errors filling out the param line for int(), and even directly copying the examples (seen by cursoring to the start of int() and hitting 'Help') gives errors. So... if int() is supposedly only valid in CAS, then why is it in the menu I see in Home? It should be at least greyed-out to show it's not a valid option at this time.

Then trying CAS, and selecting int() from the menu, it takes me to an equation editor, where I have to scroll around filling in the params and using lots of keystrokes. And it gives me the expected symbolic solution - which is not the desired result. I need numbers, this is engineering; not a course in calculus.

So, as an experiment, I do not use the menus and try just typing it in spelling out i-n-t...etc. That works! ...but still takes many keystrokes. And uses quotes which is NOT indicated in the help screen examples.

Then going back to the equation editor, I add the decimal point... and that works too! That's probably the best (quickest) solution from my point of view.

Still...load some params on the stack, hit f integrate, and bam! an answer shows up. That would be so much simpler and quicker.

And a cool idea on using the decimal to imply approximate numbers - though I don't recall seeing that in any help screen. Again, a design issue, the huge difference between symbolic and numeric controlled by an obscure decimal point in the param list. Non-intuitive. An extra binary param would have been more clear-cut. But then, it's one of those issues that bites you hard in the beginning, so you are not likely to forget it!

Overall, it seems difficult to actually use numerical integration as a working tool as you can in other HP calculators. In the course of your normal RPN calculations, you may need an integration value, so you get it then return to your work. Not so here. The Prime seems geared to teaching mathematics, and kudos for that. But a workhorse this is not. It's a hayburner with a quirky personality and a nice shiny coat, but I still love it!

-John
Find all posts by this user
Quote this message in a reply
06-25-2023, 10:43 PM
Post: #6
RE: Numerical integration direct from the keyboard?
If you integrate in CAS, upon getting the symbolic answer, you can then press the approximation option in blue shift on the enter key.
Find all posts by this user
Quote this message in a reply
06-25-2023, 10:46 PM
Post: #7
RE: Numerical integration direct from the keyboard?
Also in HOME, using the integral available in the template key (3rd from left of top white keys), you can type in the integral with ease, and get a numerical result.
Find all posts by this user
Quote this message in a reply
06-26-2023, 06:24 AM (This post was last modified: 06-26-2023 06:40 AM by carey.)
Post: #8
RE: Numerical integration direct from the keyboard?
(06-25-2023 10:43 PM)lrdheat Wrote:  If you integrate in CAS, upon getting the symbolic answer, you can then press the approximation option in blue shift on the enter key.
If a symbolic answer is obtained in CAS (see result 1 obtained from int(x,x)), pressing the approximation option appears to affect only the display of the numerical coefficient in the symbolic answer (see result 2). This makes sense since, if a symbolic answer is obtained, CAS doesn't have limits of integration to obtain a numerical result.

Of course, it's easy enough just to insert limits of integration in the int command e.g., int(x,x,0,1) to obtain the definite integral, even in CAS mode (see result 3).
   
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 3 Guest(s)