# HP Forums

Full Version: Two calculator exam problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would greatly appreciate seeing solutions to the following problem:

A. Let f(x) = 1 +x(2 - x(3 - x(4 - x(1 + x)))). Find the solution to
f(f(x)) = 1/2 that is nearest to x = 0.

And, especially if they would provide further insight, solutions to this:

B. Let f(x) = sin (1/x) and define g(x) = f(f(f(f(x)))). Find the maximum value of g(x) for x in the range 102 to 103.2.

Tailor series ?
(05-27-2014 01:47 PM)Peter Murphy Wrote: [ -> ]I would greatly appreciate seeing solutions to the following problem:

A. Let f(x) = 1 +x(2 - x(3 - x(4 - x(1 + x)))). Find the solution to
f(f(x)) = 1/2 that is nearest to x = 0.

And, especially if they would provide further insight, solutions to this:

B. Let f(x) = sin (1/x) and define g(x) = f(f(f(f(x)))). Find the maximum value of g(x) for x in the range 102 to 103.2.

Using HP Prime

A. Defining f(x):=1 +x(2 - x(3 - x(4 - x(1 + x)))), then g(x):=f(f(x)) then fsolve(g(x)=1/2, x, -1..1) yields five roots between -1 to +1 with +0.21399.... closest to zero. Defining Function.F1:=g(x)-1/2 lets you view this interesting curve.

B. Similarly. define f(x):=sin(1/x) then g(x):=f(f(f(f(x))). Defining Function.F2:=g(x) lets you graphically explore g(x) in the range 102-103.2 (assumed degrees?). Although 102 appears highest, 103.2 is max at 0.9459... - there seems to be a local max of ~1.00 at ~103.25 degrees..

Best,
Carl
Carl, the Prime seems ideally suited for such problems.

Can you (or anyone) show me how to set up and solve them on a 50g (in RPN mode) or a 48G? I've puzzled over this for a good while.

The concept of the user-defined function (UDF) for the 48/50 calculators seems promising, but what I've done hasn't produced the structure that you exhibit in your Prime examples.

I now find that David Hayden solved such a problem (problem 13) back in 2009:

but he's taking for granted what I cannot see at all, namely how one sets up such nested functions in the first place.
Peter - Im not very expert at the HP50G so I hope others will provide you (and I) some tips on how to setup these problems.

I will say that the HP Prime has been very nice to work with when in comes to symbolic/numerical solving and function graphing analysis tasks.
(05-28-2014 02:11 PM)Peter Murphy Wrote: [ -> ]but he's taking for granted what I cannot see at all, namely how one sets up such nested functions in the first place.

Code:
```'f(x)=SIN(1/x)' ENTER DEFINE 'g(x)=f(f(f(f(x))))' ENTER DEFINE```

You can have a look at how these function are defined. Just push them on the stack. For instance f(x):
Code:
`\<< \-> x 'SIN(1/x)' \>>`

Should you prefer RPL you could use this instead:
Code:
`\<< \-> x \<< INV SIN \>> \>>`

HTH
Thomas
The first one is easy:

Code:
```\<<   'F(X)'   '1 + X*(2 - X*(3 - X*(4 - X*(1 + X))))'   DUP UNROT = DEF   F   '1/2' -   SOLVEVX \>>```

Which yields:

Quote:{X=0.213992196216 X=... }

Similarly:

Code:
```\<< 'F(X)=SIN(1/X)' DEF 'SIN(1/X)' F F F \>>```

You could graph this or use try to optimize it somehow.
Thanks Thomas and Dizzy for exactly what I was hoping to see.

Now to sit down and work out your solutions; I'll report back tomorrow.

Peter
Thanks again Thomas and Dizzy. Your suggestions helped me break through my mental barrier on this stuff.

I still must explore Dizzy's solution to problem A, but I rendered f(x) as the corresponding coefficient array [ -1 -1 4 -3 2 1] 'F' STO.

Then this programmed expression

<< F F * PEVAL PEVAL .5 - >> STEQ

allowed me to plot g(x) and find x = 0.21399.

Now for problem B.

I am grateful for the existence of this Forum and for the generosity of its Users.
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :