The following warnings occurred:
Warning [2] Undefined array key 24316 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24322 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24323 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24330 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24331 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24333 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24368 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24370 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24401 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24422 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24432 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24465 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24401 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 24465 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





HP 42s solver question



#2

I have a simple program for the 42s that uses the solver to work out the value for the diameter of an object or area depending on what the user chooses (see below).

What I would like to know, is there a way to also include the circumference while using the solver. For example if 7.3 was chosen for the "Dia" then if you pressed the key corresponding to "Area" it would work out 41.85 or if you pressed the key corresponding to "Circ" you would get 22.93.

I'm not sure if this can be done but would be greatful if someone out there can help.

Thanks
Mike


{41-Byte Prgm}
LBL "Dia"
MVAR "Dia"
MVAR "Area"
RCL "Dia"
x2
PI
X
4
/
RCL- "Area"
END


#3

Hi Mike,

From your numerical examples, and from the appearance of PI in the solver expression, it appears that "object" refers specifically to spheres.

Revisions are needed both in the calculation of area, and in the program listing, since area = PI x d^2, and the result for your calculation of area should be 167.42 rather than 41.85. There is a confusion here of diameter and radius -- you are not the first, I do it all the time!

But for the interesting question of whether there is any way to incorporate diameter, area, and circumference in one solver program: I don't think so. I believe you would need two separate expressions for the solver to solve. And how about the volume as well? This is one of those cases where a BASIC program would serve much better.

Greetings from the coast of Maine,

Tom


#4

Mike,

Forgive me. Your "object" is a circle, I guess, rather than a sphere. So your calculation is correct. Ignore all my rubbish except for the last paragraph.

Tom


#5

If we wanted to write for the solver a single expression involving the three variables: diameter, area, and circumference (of a circle), we could do so. One example would be:

((PI*DIAM^2)/2)-AREA-((CIRC^2)/(4*PI))=0

which in effect says that twice the area minus the area minus the area equals nothing

The problem is that because we have three variables in one expression, the solver will have to be given two of them in order to work. That would mean that if we started, for example, with the diameter, we would have to calculate the area separately to enable the solver to give us the circumference, or calculate the circumference separately in order to get the area.


#6

A question:

Isn't the area of a circle;

'Pi * r^2'

not

'Pi * d^2' ?

and Cicumference

'Pi * d' ?

rdb.


#7

Yes, my expression is confusing (unorthodox), but I think it is OK -- but goodness knows, I am capable of messing this up forever!

The first term represents twice the area, expressed in terms of the diameter. The area is (PI*d^2)/4 (or PI*r^2), so twice the area is PI*d^2/2.

The second term represents the area in terms of the area -- that one is difficult!

The third term represents the area in terms of the circumference. Since the circumference is PI*d, the square of the circumference is (PI^2)*d^2, which needs to be divided by 4*PI to give the area -- which again is (PI*d^2)/4.

So then if we take the first term and subtract the other two we get zero. Or is it the sound and the fury signifying nothing?

Sorry about all this!

Tom


#8

Thanks for your replies Tom, I will play around with your example.


#9

Mike,

Don't play around with it too much! The expression is a curiosity, but totally impractical. Ordinarily, if we know any one of the three features of a circle -- diameter, area, circumference -- we can directly calculate the other two. That is, if we have one we can get two. But with my expression put in the solver, we need two to get one! Not much of a bargain.

Much better would be a simple BASIC program. The following is written for an HP-71B:

10 DESTROY ALL @ FIX 2 @ DELAY 2

20 DISP "DIAM=1,AREA=2,CIRC=3"

30 DELAY 8

40 INPUT "START WITH 1,2,or 3?";N

50 IF N>1 THEN 100

60 INPUT "DIAMETER =";D

70 DISP "AREA =";PI*D*D/4

80 DISP "CIRCUMFERENCE =";PI*D

90 GOTO 200

100 IF N>2 THEN 160

110 INPUT "AREA =";A

120 D=SQR(4*A/PI)

130 DISP "DIAMETER =";D

140 DISP "CIRCUMFERENCE =";PI*D

150 GOTO 200

160 INPUT "CIRCUMFERENCE =";C

170 D=C/PI

180 DISP "DIAMETER =";D

190 DISP "AREA =";PI*D*D/4

200 END

Tom


#10

Thanks Tom,

I also have the hp71b so I will have a play with that as well and see if I can program that. I haven't used it before so for a bit of fun I will try to enter your program.

Thanks
Mike

#11

Two ways to do it:

1. write the equation like

ABS(Area - Dia^2*PI/4) + ABS(Circ - Dia*PI) = 0

It works with the solver, but you'll find an extremum of course

2. use the name of the variable you're solving for:
(how do I get this to show as I typed it instead of all in a row?)

LBL "Dia"
MVAR "Dia"
MVAR "Area"
MVAR "Circ"
ASTO ST X
"Area"
ASTO ST Y
X=Y?
GTO 00
CLA
ARCL ST X
RCL "Dia"
PI
*
RCL "Circ"
-
RTN
LBL 00
RCL "Dia"
X^2
PI
*
4
/
RCL "Area"
-
RTN

I think the Alpha-register must remain untouched, hence the CLA ARCL ST X

Werner Huysegoms


#12

Werner: A very elegant solution. I worked on this for a few hours the other night and had given up on using solver for this. I never thought of having two solver programs within one. At least it got me paging through my new copy of the 42S programming guide (Thanks Iqbal!), so it was time well spent. I've made two insignificant changes (the RCL- )to the program and added the line numbers for ease of entry.

This was formatted using a {pre /pre} block around the code listing. More options can be found here:
http://www.hpmuseum.org/artfmt.htm

00 {72 Byte-Prgm}
01 LBL "Dia"
02 MVAR "Dia"
03 MVAR "Area"
04 MVAR "Circ"
05 ASTO ST X
06 "Area"
07 ASTO ST Y
08 X=Y?
09 GTO 00
10 CLA
11 ARCL ST X
12 RCL "Dia"
13 PI
14 *
15 RCL- "Circ"
16 RTN
17 LBL 00
18 RCL "Dia"
19 X^2
20 PI
21 *
22 4
23 /
24 RCL- "Area"
25 RTN
26 END


#13

Thanks you Randy and Werner, I tried your programs and they both seemed work correctly at first but only when you enter the "Dia" first, if you enter the others (area or circ)first it doesn't seem to calculate the correct result. I will try to understand how the program works and see why it is happening.

Thanks for your efforts.

Mike


Possibly Related Threads…
Thread Author Replies Views Last Post
  hp-prime solver and variable name fabrice48 22 8,120 12-10-2013, 03:25 AM
Last Post: fabrice48
  Solver issue with HP 17BII - different from 19BII Jeff Kearns 13 4,471 11-28-2013, 02:36 AM
Last Post: Don Shepherd
  HP Prime Triangle solver BruceH 29 8,400 11-28-2013, 12:03 AM
Last Post: Dale Reed
  HP prime: linear solver app Alberto Candel 1 1,408 11-21-2013, 01:57 AM
Last Post: Michael Carey
  HP Prime: Linear Solver app bug BruceH 0 1,122 11-15-2013, 06:36 PM
Last Post: BruceH
  HP Prime Solver Variables Issue Anibal Morones Ruelas 8 2,988 10-19-2013, 09:45 AM
Last Post: Harold A Climer
  HP Prime triangle solver oddity BruceH 0 1,026 10-13-2013, 09:08 PM
Last Post: BruceH
  Using units in Numeric Solver Harold A Climer 1 1,245 10-13-2013, 10:44 AM
Last Post: Tim Wessman
  Meltiple Equation Solver PRIME Vs. HP 50G Harold A Climer 5 1,779 10-07-2013, 05:11 PM
Last Post: CR Haeger
  Does Prime Have a Multiple Equation Solver? Norman Dziedzic 2 1,343 09-20-2013, 09:43 AM
Last Post: Norman Dziedzic

Forum Jump: