# HP Forums

Full Version: (50g) Inverse Function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello 50g fans
In the official HP forum (calculators) arised the question: it is possible to plot the inverse of a function and the example was: f(x) = x^3 + x^2 +1?

The answer is yes. Generally you can define two functions:

'FOO' (This code is produced by the command 'DEF'):

Code:
``` << -> X 'X^3 + X^2 +1' >>  @@ that is the original function mentioned above```

and 'IFOO':
Code:
``` << -> X        << 'FOO(AG) - X = 0.'  @@ equation for command 'ROOT'           'AG'                      @@ variable for solving           0.                        @@ starting value           ROOT                   @@ solving command       >> >>```

Only caution the variable 'AG' is handled as a global variable, which appears in your working directory and should be deleted after usage of 'IFOO'.

It is good working in approximation mode. And the plotting area should be limited to areas with same montonic characteristics. Sometimes you get artefacts in plotting, you should be aware of this possibility.
In the pic you see such a artefact in the third sector of the coordinate system (the straight line vertical to the x-axis). The original function is also displayed.

Define in the 'y=" form 'Y1(x) = IFOO(X)' and set the values for x- and y-coordinates in the form 'WIN' and you get your inverse function plotted.

Certainley you can use 'IFOO' although only for seeking a special root. And you can extend 'IFOO' by a second variable for the starting value.

Sincerely peacecalc
(02-05-2020 08:43 AM)peacecalc Wrote: [ -> ]In the official HP forum (calculators) arised the question:
is it possible to plot the inverse of a function and the example was: f(x) = x^3 + x^2 +1?

Function and its inverse are mirror image of each other, in the line y=x

Since we cannot "flip" the calculator, the next best thing is to rotate plot.
For shape of f-1(x), plot -f(x), then rotate plot, 90° counter-clockwise.

note: rotated "x-axis" numbers, if shown, required a sign flip.
(02-05-2020 11:03 AM)Albert Chan Wrote: [ -> ]
(02-05-2020 08:43 AM)peacecalc Wrote: [ -> ]In the official HP forum (calculators) arised the question:
is it possible to plot the inverse of a function and the example was: f(x) = x^3 + x^2 +1?

https://h30434.www3.hp.com/t5/Calculator...-p/7447121
Hello,

@Albert Chan: I know of the geometrical work around, but of course the more interesting question is to find the inverse of a function with the calc, numerical better then nothing. The official handbooks even shows a program "ROOTR" which works in the same way, but with three variables (name of inverting function, name of solving variable and starting value).

In a more exact view, the mirrored graphing is dued to the change of the variables after the algebraic inverting procedures:

f. example:

1) y = x^2 + 16; with x in IR and y in [16 ; + infinity[
2) x_1 = sqrt(y - 16) and x_2 = - sqrt(y-16);
with y in [16 ; + infinity[ and x_1 in [0; + infinity[ and x_2 in ] - infinity; 0[
Here is the graph the same as in 1) you only changed the direction of view in the graph (in 1) x -> y and in 2) y -> x), nothing else. More precisely, x_1 is the domain of the right part of the graph and x_2 marks the left part.
3) Now you change x_1 to y_1 and x_2 to y_2 and y becomes x, voila the graph changes.

@Joe Horn, thank you, you beat me in reaction.

Sincerely peacecalc
Hello,
for those who wants to check the source of the RPL program 'ROOTR' mentioned in my last post:

you find it in the 'advanced user reference manual' at page 2-38 in the chapter RPL Programming Examples.
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :