HP Forums
Taylor expanding with the HP50G - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Taylor expanding with the HP50G (/thread-20562.html)



Taylor expanding with the HP50G - Gil - 09-28-2023 10:52 AM

I try to get the Taylor expansion of
x/ (4.76 + 0.83*x).

I put the above expression on the stack of the HP50G, then x, then 5 for instance and press TAYLR.

I get the followings message:
TAYLR Error:
Mode switch not allowed here.

Thanks for your help.


RE: Taylor expanding with the HP50G - dlidstrom - 09-28-2023 01:25 PM

It seems the TAYLR command prefers to work with whole numbers for exact answers. You may try a symbolic version of your equation. I substituted your decimals with A and B and it worked fine. To evaluate the equation you need to store the values in A and B respectively.


RE: Taylor expanding with the HP50G - Nigel (UK) - 09-28-2023 02:32 PM

If you don’t want to use extra variables A and B you can replace the decimals with fractions e.g., write 0.83 as 83/100.

Nigel (UK)


RE: Taylor expanding with the HP50G - Gil - 09-28-2023 07:57 PM

Thanks a lot to both of you, the given solutions worked.

I did for instance:
'X/(476/100+83/100*X)' X 5
TAYLR

And got:
'-98476016075/2907915115807744*X^6+1186458025/6109065369344*X^5+-14294675/12834170944*X^4+172225/26962544*X^3+-2075/56644*X^2+25/119*X'

Which command(s) could I use to get, if possible in one single step, the execution of :
98476016075/2907915115807744,
1186458025/6109065369344,
asf?

To get something simplified as
'-(3.38648179721E-5*X^6.+-1.9421269102E-4*X^5.+1.11379808344E-3*X^4.+-6.38756491227E-3*X^3.+3.66322999788E-2*X^2.+-.210084033613*X)'.


RE: Taylor expanding with the HP50G - Carsen - 09-29-2023 03:01 AM

Quote:Which command(s) could I use to get, if possible in one single step, the execution of :
98476016075/2907915115807744,
1186458025/6109065369344,
asf?

To get something simplified as
'-(3.38648179721E-5*X^6.+-1.9421269102E-4*X^5.+1.11379808344E-3*X^4.+-6.38756491227E-3*X^3.+3.66322999788E-2*X^2.+-.210084033613*X)'.

Simply switch to approximate mode and press the [EVAL] key on that object. Hope it helps.


RE: Taylor expanding with the HP50G - Steve Simpkin - 09-29-2023 04:41 AM

(09-29-2023 03:01 AM)Carsen Wrote:  ...
Simply switch to approximate mode and press the [EVAL] key on that object. Hope it helps.

I tried switching the CAS to Approx mode first. When I executed TAYLR, it prompted "Approx. Mode off? YES NO". When I chose NO, it displayed the following error message.

[attachment=12597]


RE: Taylor expanding with the HP50G - Carsen - 09-29-2023 05:43 AM

(09-29-2023 04:41 AM)Steve Simpkin Wrote:  I tried switching the CAS to Approx mode first. When I executed TAYLR, it prompted "Approx. Mode off? YES NO". When I chose NO, it displayed the following error message.

Let me explain more clearly.

Execute the TAYLR command in exact mode to get a symbolic answer.

Then switch to approximate mode and press the [EVAL] key on the keyboard to turn the symbolic answer into an approximate one.


RE: Taylor expanding with the HP50G - Gil - 09-29-2023 07:07 AM

Thanks, Carsen.


RE: Taylor expanding with the HP50G - bxparks - 06-27-2024 03:59 PM

I attempted to use the CAS features of the 50g for the first time yesterday. I tried to do a relatively simple Taylor series expansion using the TAYLOR0 and TAYLR functions:

TAYLOR0(N*X/((1+X)^N-1)

and the equivalent

TAYLR(N*X/((1+X)^N-1), X, 5)

I got both error messages described in this thread:

- "Approx. Mode off? YES NO"
- "MODE switch not allowed here"

Not the most helpful error messages. I tried 10-20 times with different variations, but I could not get this to work.

I was about to throw the 50g out the window, but decided to do an internet search first. There are apparently 2 places on the planet that mention these error messages, and this is one of them. (Funny enough, the other one is the following thread from 2021 (HP49-50G : Taylor) where Gil posts basically the same question, and figures out basically the same answer.)

It turns out my problem is that 'N' was already defined. How is that possible? I don't even know how to create a variable on the 50g. (I've tried, that's another story.) It's because I had used the [LEFT] [FINANCE] app, which creates the TVM variables (N, I%YR, PV, PMT, FV), and N happens to be one of them.

The solution was to delete the `N` variable. But how do I do that? Since this is the HP-50g, it's completely non-trivial. I figured it out yesterday, but this morning, I could not remember. For the record, in case someone else (e.g. my future self) runs into this problem, here are the instructions for how to delete a variable:

- Go to [LEFT] [FILES] (not the VAR button as I had guessed)
- Press [ENTER] to select {Home} (I think. I have no idea what that "CASDIR" subdirectory is)
- Scroll down to the variable that you want to remove
- Press the [NXT] button
- Press the [PURGE] soft menu (F1) button (I would have expected it to be labeled "DEL", and I would have expected either the <- button or the [LEFT] [DEL] button to work)
- Press F1 to answer "YES" to the prompt


RE: Taylor expanding with the HP50G - Gil - 06-27-2024 09:13 PM

1) Run this program previously

\<< "Before calc limits,
Run this prog previously 
(w / no input)
" DROP RAD "Exact Mode ON:" DROP -105 CF "
Symbol result:" DROP -3 CF "CAS Object Evaluation
allows CASCOMPEVAL:" DROP -124 CF "Silent Mode OFF, if
signed res important:" DROP -120 CF "Or
'(COS(X)-1+1/2*X^2)/X
^4' 'X=0' 4 SERIES" DROP
\>>

2) {N X} PURGE
or 'N' PURGE 'X' PURGE

3) Execute what you tried before.

You should get
'-(X*N/(1-EXP(N*LN(1+X))))'


RE: Taylor expanding with the HP50G - jonmoore - 08-19-2024 08:54 AM

(06-27-2024 03:59 PM)bxparks Wrote:  It turns out my problem is that 'N' was already defined. How is that possible? I don't even know how to create a variable on the 50g. (I've tried, that's another story.) It's because I had used the [LEFT] [FINANCE] app, which creates the TVM variables (N, I%YR, PV, PMT, FV), and N happens to be one of them.

The solution was to delete the `N` variable. But how do I do that? Since this is the HP-50g, it's completely non-trivial. I figured it out yesterday, but this morning, I could not remember.

A good best practice to use with HP's RPL calculators is to get into the habit of setting up individual folder trees for your calculations that don't have parent folders containing competing variable names. Working with RPL calculators in this manner is a designed benefit that the HP engineers built into the system.

In simple terms, you can set up separate folders for your financial solver calculations and specific algebra/calculus calculation areas. The beauty of working in this way is that you can have multiple solvers using e.g. the local variables labelled N, and they won't interfere with each other.

The intentional design of the system is that variables only become 'Global' in nature if they exist in a parent folder of the local tree. The beauty of the design really comes into it's own when using the Equation Library where the same variable symbol can have different meanings depending on the domain.

The only downside is that you have to first think about where you're currently positioned within your folder structure before performing calculations, but that's only a hurdle for a short time.

However, I do set up a TMP folder near the top of my folder structure which I use for quick-fire solver calculations. And as soon as I've got the result I was looking for, I purge the contents of folder so it's ready for the next time I'm looking to perform a quick-fire solver calculation

Section 2.8 of the main 50g Documentation goes into great detail ref data management under the HOME folder: https://literature.hpcalc.org/official/hp50g-um-en.pdf