Post Reply 
Limits with HP50G
08-22-2022, 09:32 AM
Post: #1
Limits with HP50G
I write

'lim((1+1/X)^X,X=infinity)'

with the sign of infinity in the calculator (SL+0)

or
'lim(SIN(X)/X,X=\oo)'

I press then EVAL
and get the message
EVAL Error
Non algebraic in expression

What's wrong?

If am not mistaken, I used to get the right answer with my calculator.

Thanks for your help.

Gil
Find all posts by this user
Quote this message in a reply
08-22-2022, 09:41 AM
Post: #2
RE: Limits with HP50G
Just saw that I had to use the EXPAN command
to get the expected answer.
Find all posts by this user
Quote this message in a reply
08-23-2022, 02:39 PM
Post: #3
RE: Limits with HP50G
(08-22-2022 09:32 AM)Gil Wrote:  ...I press then EVAL
and get the message
EVAL Error
Non algebraic in expression

What's wrong?

Short answer:

That error can come up when working with limit expressions if system flag -124 is set. Try clearing that flag and repeating your attempt.


Longer answer:

When working with limit expressions, make sure the following modes are observed:
  • RAD angle mode
  • Exact Mode ON (-105 CF)
  • Symbolic results (-3 CF)
  • CAS Object Evaluation allows CASCOMPEVAL (-124 CF)
  • Silent Mode OFF (-120 CF) (if signed results are important)
Limit expressions are a bit problematic on the 50g. Generally speaking, you need to use the Equation Writer app to place the expression on the stack or use backquote notation (`<algebraic expression>`) to construct a fully-formed limit expression if you want it evaluated immediately. There's a bug in the compiler used by the command line interpreter (along with STR→ and OBJ→) that throws a syntax error when given perfectly legitimate limit expressions (documented here).

Among other headaches, this means that limit expressions converted to strings with →STR may generate a syntax error if re-compiled with STR→ or OBJ→.

To see this bug in action, set the modes as described above and create a limit expression with the Equation Writer as follows:
[Image: limbug01.png]

Pressing ENTER will place the fully-formed limit expression on the stack:
[Image: limbug02.png]

Make a copy:
[Image: limbug03.png]

First, we EVALuate the expression by pressing EVAL. Almost immediately you'll be presented with this alert:
[Image: limbug04.png]

Choose YES to proceed (this example was intentionally designed to show why that choice can be important):
[Image: limbug05.png]

The "+0" designation in the limit condition means "determine the limit as X approaches from the right". Choosing YES to the above alert designates that we want the signed result. You can probably guess what happens if the limit condition had "-0" appended instead.

Now let's see where the bug enters the mix. Presuming you kept a copy on the stack, drop the "-∞" result then execute →STR:
[Image: limbug06.png] [Image: limbug07.png]
(note that the full string is "'lim(TAN(X),X=\pi/2+0)'")

That looks exactly as we might expect. Now attempt to convert that string back into the compiled limit expression using STR→ or OBJ→ (the result is the same either way):
[Image: limbug08.png]

The bug causes a syntax error, even though the string is perfectly legitimate. The conversion to a string was unfortunately a one-way street.
Find all posts by this user
Quote this message in a reply
08-23-2022, 07:23 PM (This post was last modified: 08-23-2022 07:30 PM by Gil.)
Post: #4
RE: Limits with HP50G
Great — very clearly developed reply.

A model.

Thanks a lot.

Another bug linked to your bug:
Suppose you try any limit and get the right answer.
Then try and press CMD (LS+M).
Choose then your last limit expression
('lim..., x=... )
When pressing ENTER, an error appears relative to the = sign.

It seems impossible to edit your given example and replace, for tan(x), x=pi/2 +0 by x=pi/2-0.

By the way, how to have the full list of flags appear on the calculator?
If MODE Flags, the flags status 1..3 appear,
but then there are laps ("holes"), with for instance next flag status shown being 14.

Regards,
Gil
Find all posts by this user
Quote this message in a reply
08-23-2022, 09:30 PM
Post: #5
RE: Limits with HP50G
(08-23-2022 07:23 PM)Gil Wrote:  When pressing ENTER, an error appears relative to the = sign.

Yes, that is due to the same error.

(08-23-2022 07:23 PM)Gil Wrote:  It seems impossible to edit your given example and replace, for tan(x), x=pi/2 +0 by x=pi/2-0.

Actually, I think I may have stumbled on a way to do it. It's ugly, but it appears to work.

Let's say you want to type in the limit expression instead of using the Equation Writer app. I'll use the example given above and change the "+0" to a "-0".

Let's start with the same string identified in my previous post:
"'lim(TAN(X),X=\pi/2+0)'"

Edit the string as follows:
  1. Place a single backquote character (`) at the very beginning of the string
  2. Change the "+0" to a "-0"

This leaves us with a rather ugly string on the stack:
"`'lim(TAN(X),X=\pi/2-0)'"

Assuming the flags are set as described, executing STR→ will successfully convert that limit expression to what is intended. This works because the backquote essentially changes the interpreter for what follows in the string to one that knows how to compile a limit expression properly.

(08-23-2022 07:23 PM)Gil Wrote:  By the way, how to have the full list of flags appear on the calculator?
If MODE Flags, the flags status 1..3 appear,
but then there are laps ("holes"), with for instance next flag status shown being 14.

The flag browser section of MODE is hard-wired to show what it does. I don't know of any way to have it show additional flags -- it simply wasn't designed to be configurable.

The best set of descriptions of 50g flags that I know of is in the 50g Advanced Users Reference, Appendix C. Some of the descriptions are still vague and don't give much insight to what the flags actually do, but it's better than no description at all!
Find all posts by this user
Quote this message in a reply
08-23-2022, 09:41 PM
Post: #6
RE: Limits with HP50G
Incredible with your backstroke character, but it works.
Congratulations!

Thanks for sharing your expertise.

Regards.

Gil
Find all posts by this user
Quote this message in a reply
Post Reply 




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