Integral in solve on HP 42S?

02242019, 06:29 PM
Post: #1




Integral in solve on HP 42S?
If I wanted to, say, find what "x" would satisfy the integral of x^2 from 0 to x such that the area under the curve equaled 10, can this be accomplished in solve on an HP 42S?


02242019, 08:13 PM
Post: #2




RE: Integral in solve on HP 42S?
Code: 00 { 12Byte Prgm } Code: 00 { 28Byte Prgm } You can set LLIM and ACC: 0 STO "LLIM" 1e10 STO "ACC" And then just use the SOLVER with the program ∫f and the variable x to get 3.10723250595 Cheers Thomas 

02242019, 08:15 PM
Post: #3




RE: Integral in solve on HP 42S?
Easy!
Thanks. 

02252019, 05:17 AM
Post: #4




RE: Integral in solve on HP 42S?
(02242019 08:13 PM)Thomas Klemm Wrote: Line 002 of programme f is not essential. 

02252019, 07:43 AM
Post: #5




RE: Integral in solve on HP 42S?
(02252019 05:17 AM)Gerald H Wrote: Line 002 of programme f is not essential. Indeed not  MVAR statements are only used by the interactive solve and integrate. Moreover, you can replace Code: 02 MVAR "x" by Code: 02 MVAR "ULIM" straight away and solve for ULIM. Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE 

02252019, 07:47 AM
Post: #6




RE: Integral in solve on HP 42S?
(02252019 05:17 AM)Gerald H Wrote: Line 002 of programme f is not essential. We can also drop line 05 of program ∫f: Code: 05 PGMINT "f" We just have to execute it once manually: PGMINT "f" This also allows to use the program ∫f with different functions without having to change the code. Cheers Thomas 

02252019, 08:09 AM
Post: #7




RE: Integral in solve on HP 42S?
So we end up with:
Code: 00 { 9Byte Prgm } Code: 00 { 19Byte Prgm } Example: 0 STO "LLIM" 1e10 STO "ACC" PGMINT "f" Then use the SOLVER with the program ∫f and the variable ULIM to get 3.10723250595 Cheers Thomas 

02262019, 03:15 AM
Post: #8




RE: Integral in solve on HP 42S?
It is fun (and instructive) to see how concise coding can be accomplished. I'm always fascinated and impressed.
Wondered if the HP 42S could integrate the maximum of (f(x), g(x)) over some interval. Quite easy! For max (sin(x), cos(x)), all that was necessary was to take sin(x), x<>y, cos(x), if x>=y, RTN, x<>y, END I will begin to tryrelearn indirect addressing (last did this on an HP 67 in the 1970's when I programmed a simple baseball game...had lineups and data of 1970 American League teams on the magnetic cards, and used indirect addressing to remember where in the lineup I was at). Then, try to refresh my knowledge on the usage of flags! 

02262019, 03:30 AM
Post: #9




RE: Integral in solve on HP 42S?
(02262019 03:15 AM)lrdheat Wrote: I will begin to tryrelearn indirect addressing (last did this on an HP 67 in the 1970's You're in for a treat, then! I have no experience with the HP67 myself (I own one now, purchased on eBay, but couldn't have afforded it back when it was new), but I do have experience with the HP19C, which is very similar. Both have only one "indirect" register, which makes a lot of algorithms awkward to implement, always having to shuffle things around to get the right pointer into register 0 (which is the I equivalent on the 19C and 29C). Compared to that, programming the 41C, where every register, even the stack registers, can be used for indirect addressing, is so much more pleasant, and the 42S inherited that programming model. 

02262019, 05:30 AM
Post: #10




RE: Integral in solve on HP 42S?
(02262019 03:30 AM)Thomas Okken Wrote: Both have only one "indirect" register, which makes a lot of algorithms awkward to implement, always having to shuffle things around to get the right pointer into register 0 (which is the I equivalent on the 19C and 29C). From Calculator Speed Benchmark using the NQueens Problem: HP67 Code: LBL A CLEAR REG HP41 Code: LBL A CLRG Compare e.g. the inner loop between LBL 2 … GTO 2: HP67 Code: RCL 0 STO I RCL(i) HP41 Code: RCL IND 00 RCL IND 09  Cheers Thomas 

02262019, 07:41 AM
Post: #11




RE: Integral in solve on HP 42S?
(02252019 08:09 AM)Thomas Klemm Wrote: So we end up with: It would make sense to then add ACC and LLIM as MVARS to "∫f": Code: 00 { 30Byte Prgm } .. makes it a lot easier to enter the numbers, and to play with different ACC's. Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE 

02262019, 08:39 AM
Post: #12




RE: Integral in solve on HP 42S?
(02262019 07:41 AM)Werner Wrote: It would make sense to then add ACC and LLIM as MVARS to "∫f": Would anyone want to SOLVE for ACC though? A useful thing to add would be the (signed) area, which is fixed at 10 in the above versions of ∫f. — Ian Abbott 

02262019, 09:29 AM
Post: #13




RE: Integral in solve on HP 42S?
This is how I did the calculation for Normal distribution.
First set accuracy by entering number of decimal digits accuracy required, eg 4 then activate FXACC Code: 0. { 21Byte Prgm } to set accuracy to 0.0001 To find probability from Z value, enter Z & activate Z→P, & to find Z value , enter P & activate P→Z. Code: 0. { 26Byte Prgm } 

« Next Oldest  Next Newest »

User(s) browsing this thread: