using the Root function with Algebraic and RPL - Hewlett Packard

This is a discussion on using the Root function with Algebraic and RPL - Hewlett Packard ; I am attempting to learn some of the finer but simple details of the HP50g. The calculator mode is set to rpn. I have created 2 objects: A > according to the manual this is type 8 object in User ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: using the Root function with Algebraic and RPL

  1. using the Root function with Algebraic and RPL

    I am attempting to learn some of the finer but simple details of the
    HP50g.

    The calculator mode is set to rpn.

    I have created 2 objects:

    A << X X * 1 - >> according to the manual this is type 8 object in
    User RPL language

    and

    B ' X^2-1' according to the manual this is a type 9 algebraic object

    The numeric solver (item 4 under apps then item 1 solve equation)
    readily finds the 2 roots of -1 and 1 for both A and B.

    Then I used the graph function to graph A and B one at a time. First
    I deleted the X object created by the numeric solver.

    Both show the correct graph but the RPL example (graph A) has a
    difference. When I use the graph functions Root and Isect they
    cannnot find a root. The message constant? is displayed for both Root
    and Isect.

    The plot setup is set to function and the independent variable is set
    to X.

    Do I have another setting set incorrectly or is there a deeper meaning
    here?

    Any insight would be much appreciated.

    Randy

  2. Re: using the Root function with Algebraic and RPL

    On Tue, 15 Jul 2008 11:59:37 -0500, Randy wrote:

    > I am attempting to learn some of the finer but simple details
    > of the HP50g.
    >
    > The calculator mode is set to rpn.
    >
    > I have created 2 objects:
    >
    > A \<< X X * 1 - \>>according to the manual this is type 8 object in User RPL language
    >
    > and
    >
    > B 'X^2-1' according to the manual this is a type 9 algebraic object
    >
    > The numeric solver (item 4 under apps then item 1 solve equation)
    > readily finds the 2 roots of -1 and 1 for both A and B.
    >
    > Then I used the graph function to graph A and B one at a time.
    > First I deleted the X object created by the numeric solver.


    That's a very good precaution, but just for everyone's info,
    the graphing functions employ a neat trick,
    creating their own private 'X' anyway,
    even if it is a duplicate of an existing variable,
    and when they conclude, they will delete their own variable,
    leaving either an original 'X' or no 'X' just as before,
    which is intended to make them completely independent
    of any pre-existing "independent variable."

    > Both show the correct graph but the RPL example (graph A)
    > has a difference. When I use the graph functions
    > Root and Isect, they cannnot find a root.
    > The message constant? is displayed for both Root and Isect.


    This might be a good point to re-inspect EQ and PPAR.

    > The plot setup is set to function
    > and the independent variable is set to X.
    >
    > Do I have another setting set incorrectly
    > or is there a deeper meaning here?


    Starting with default setup (no existing 'PPAR'),
    I've tried each of the following separate plots:

    \<< X X * 1 - \>> STEQ ERASE DRAX DRAW PICTURE

    and

    'X^2-1' STEQ ERASE DRAX DRAW PICTURE

    Both plots find ROOTs for me.

    Could you supply detailed steps for reproducing exactly what you are doing?

    Best wishes.

    [r->] [OFF]

  3. Re: using the Root function with Algebraic and RPL

    On Jul 15, 5:32*pm, "John H Meyers" wrote:
    > On Tue, 15 Jul 2008 11:59:37 -0500, Randy wrote:
    > > I am attempting to learn some of the finer but simple details
    > > of the HP50g.

    >
    > > The calculator mode is set to rpn.

    >
    > > I have created 2 objects:

    >
    > > A *\<< X X * 1 - \>>according to the manual this is type 8 object in User RPL language

    >
    > > *and

    >
    > > B 'X^2-1' *according to the manual this is a type 9 algebraic object

    >
    > > The numeric solver (item 4 under apps then item 1 solve equation)
    > > readily finds the 2 roots of -1 and 1 for both A and B.

    >
    > > Then I used the graph function to graph A and B one at a time.
    > > First I deleted the X object created by the numeric solver.

    >
    > That's a very good precaution, but just for everyone's info,
    > the graphing functions employ a neat trick,
    > creating their own private 'X' anyway,
    > even if it is a duplicate of an existing variable,
    > and when they conclude, they will delete their own variable,
    > leaving either an original 'X' or no 'X' just as before,
    > which is intended to make them completely independent
    > of any pre-existing "independent variable."
    >
    > > Both show the correct graph but the RPL example (graph A)
    > > has a difference. *When I use the graph functions
    > > Root and Isect, they cannnot find a root.
    > > The message constant? is displayed for both Root and Isect.

    >
    > This might be a good point to re-inspect EQ and PPAR.
    >
    > > The plot setup is set to function
    > > and the independent variable is set to X.

    >
    > > Do I have another setting set incorrectly
    > > or is there a deeper meaning here?

    >
    > Starting with default setup (no existing 'PPAR'),
    > I've tried each of the following separate plots:
    >
    > \<< X X * 1 - \>> STEQ ERASE DRAX DRAW PICTURE
    >
    > and
    >
    > 'X^2-1' STEQ ERASE DRAX DRAW PICTURE
    >
    > Both plots find ROOTs for me.
    >
    > Could you supply detailed steps for reproducing exactly what you are doing?
    >
    > Best wishes.
    >
    > [r->] [OFF]- Hide quoted text -
    >
    > - Show quoted text -


    Thanks for your comments and suggestions.

    I looked up the commands in your example (steq, erase, drax, draw,
    picture) in the manual. Altho I don't have the experience to put
    those together myself, their sequence made sense. More importantly, I
    was able to repeat your steps and get roots (as expected) for both of
    the examples.

    So, my steps must have a mistake in them. Basically, the steps are
    taken from chapter 12 (graphics) in the manual.

    These steps are: configure plot setup (2d/3d button), configure plot
    window (win button), configure plot function (Y= button)

    I don't think I changed anything under 2d/3d or win. Type is set to
    function and independent variable is set to X.

    Starting without Eq, Ppar, or y1, y2, ... in the var list, the steps
    under Y= are:

    choose Add
    the 50g responds with Y1(X)=
    I enter A to make the line look like Y1(X)=A
    Erase
    Draw
    fcn
    root
    constant?

    One of your suggestions was to examine the contents of eq and ppar.
    And, I will add y1 to the list.
    eq = Y1(X)
    y1 = << right arrow X 'A' >>
    ppar - I see no difference between the contents of your example and my
    example

    the contents of eq in your working example IS different: eq = << X X
    * 1 - >> perhaps this is a clue

    I repeat this same set of steps above for the var B (X^2-1) which does
    find the roots.

    In this case :
    Y1 = << right arrow X 'B" >>
    eq = Y1(X)
    ppar - I see no difference in the values between the examples

    So, looks like the difference is somewhere in my set of steps.

    Randy

  4. Re: using the Root function with Algebraic and RPL

    On Wed, 16 Jul 2008 08:38:51 -0500, Randy wrote:

    > Basically, my steps are taken from chapter 12 (graphics) in the manual..


    > These steps are: configure plot setup (2d/3d button), configure plot
    > window (win button), configure plot function (Y= button)


    We can reproduce it:

    \<< X X * 1 - \>> 'A' STO

    In "Y=" window, press ADD and enter 'Y1(X)=A'

    Press ERASE and DRAW; the graph is correctly drawn.

    If we press TRACE, the graph can be correctly traced.

    FCN followed by ROOT or ISECT, however,
    may result in no solution ("Constant?")

    Looking at the user variables which were created
    by the "Y=" window, we find:

    'EQ' contains 'Y1(X)'
    'Y1' contains \<< \-> X 'A' \>>
    'A' contains \<< X X * 1. - \>> (as we created it)

    The menu solver (30 MENU) and ROOT command
    also find similar difficulties solving this 'EQ',
    even if we "bracket" a root
    by pre-storing "guesses" { .9 1.1 } into 'X'

    In fact, even 'A' 'X' 0 ROOT fails here
    (sometimes giving _wrong_ answer 0.
    and other times "Error: Constant?")
    while \<< X X * 1. - \>> 'X' 0 ROOT works fine
    (this seems to isolate the central problem).

    Note that the solver's "EXPR=" menu key
    does evaluate 'EQ' properly, however,
    for any individual stored real value of 'X'
    including .9 and 1.1,
    further heightening the discrepancy
    as to why the solver can not find the root(s).

    If we replace 'A' with 'X^2-1', however, then everything
    (both graphical root and solver) works fine.

    Have we done anything wrong?

    I would say that no, we have not.

    To illustrate why not, let's store the identical
    'EQ' and 'Y1' and 'A' shown above into variables on an HP48G[X],
    and try both the graphical and menu solvers,
    which seem the same, so far as we know,
    on all HP48/49/50 calculators.

    Well, on the HP48G[X], they all work fine,
    as do both 'A' 'X' 0 ROOT and \<< X X * 1. - \>> 'X' 0 ROOT
    even when 'A' contains a program, rather than a formula.

    We can even compare the content of the variables,
    using the SysRPL viewer on each calculator,
    and they will be found exactly the same.

    I've also tried flipping flag -3 each way in both calculators,
    observing no difference in either case.

    The fact that in the full 'Y1(X)' case
    an extra "local" variable 'X' is created
    (but never used by the program, nor by its algebraic equivalent,
    where the latter works anyway) seems completely irrelevant,
    particularly since trying 'A' 'X' 0 ROOT directly
    bypasses all that, yet still fails when 'A' contains a program.

    That's as far as I've progressed; suspicion seems to fall
    upon how ROOT internally evaluates its expression (or variable),
    given what's been observed.

    We can sidestep the entire problem, of course,
    by directly storing our program into 'EQ'
    instead of 'EQ' evaluating 'Y1'
    then 'Y1' invoking 'A'
    which finally contains our program
    (which apparently was fine on the HP48S[X]/G[X] anyway,
    before those were remodeled into the HP49/50 series with CAS).

    I didn't find this reported on http://bugs.hpcalc.org/
    after a quick search on "root" (not that any further action
    would ever arise from it now, even if it had earlier been reported);
    too bad Randy hadn't been here while bugs were still being worked on

    [r->] [OFF]

  5. Re: using the Root function with Algebraic and RPL

    Previously:

    > We can reproduce it [apparent bug on HP49/50 series]
    >
    > \<< X X * 1 - \>> 'A' STO
    >
    > In "Y=" window, press ADD and enter 'Y1(X)=A'
    >
    > Press ERASE and DRAW; the graph is correctly drawn.
    >
    > If we press TRACE, the graph can be correctly traced.
    >
    > FCN followed by ROOT or ISECT, however,
    > may result in no solution ("Constant?")


    [whereas it's fine on original HP48[S/G] series]

    Here's how to pacify the HP49/50 series' CAS:

    \<< \-> X \<< X X * 1 - \>> \>> 'A' STO

    In "Y=" window, press ADD and enter 'Y1(X)=A(X)'

    Now you can both graph _and_ numerically solve (ROOT, ISECT).

    Why did the CAS butt in to mess with the _numeric_ root finder,
    particularly when there was even nothing algebraic whatsoever involved?

    I.E. even 'A' 'X' 0 ROOT worked on HP48S/G
    but failed on HP49/50 in the original case;
    after above modification of 'A' we must instead try

    'A(X)' 'X' 0 ROOT (now pacified, even on HP49/50)

    [r->] [OFF]

  6. Re: using the Root function with Algebraic and RPL

    On Jul 17, 7:10*pm, "John H Meyers" wrote:
    > Previously:
    >
    > > We can reproduce it [apparent bug on HP49/50 series]

    >
    > > \<< X X * 1 - \>> 'A' STO

    >
    > > In "Y=" window, press ADD and enter 'Y1(X)=A'

    >
    > > Press ERASE and DRAW; the graph is correctly drawn.

    >
    > > If we press TRACE, the graph can be correctly traced.

    >
    > > FCN followed by ROOT or ISECT, however,
    > > may result in no solution ("Constant?")

    >
    > [whereas it's fine on original HP48[S/G] series]
    >
    > Here's how to pacify the HP49/50 series' CAS:
    >
    > \<< \-> X \<< X X * 1 - \>> \>> 'A' STO
    >
    > In "Y=" window, press ADD and enter 'Y1(X)=A(X)'
    >
    > Now you can both graph _and_ numerically solve (ROOT, ISECT).
    >
    > Why did the CAS butt in to mess with the _numeric_ root finder,
    > particularly when there was even nothing algebraic whatsoever involved?
    >
    > I.E. even 'A' 'X' 0 ROOT worked on HP48S/G
    > but failed on HP49/50 in the original case;
    > after above modification of 'A' we must instead try
    >
    > 'A(X)' 'X' 0 ROOT (now pacified, even on HP49/50)
    >
    > [r->] [OFF]


    John-

    Thanks very much for the detailed discussion, testing results, and
    solution.

    I was able to modify my variables per your solution and make the
    addition using Y=.

    Works every time. Also tried a couple other examples as well which
    also work.

    More importantly, I have learned a lot.

    Randy


+ Reply to Thread