Group Abstract Group Abstract

Message Boards Message Boards

0
|
11.5K Views
|
3 Replies
|
3 Total Likes
View groups...
Share
Share this post:

[?] Obtain inverse of a function?

Posted 8 years ago

I'm quite new to Mathematica and have so far been unable to resolve the following (minor) technical issue. In principle, the task is very straightforward: I'd like to define the inverse of the function F(x) = 1 - x^2/(2cosh(x)-2) for x >= 0, but because F is not a 1-1 function on the reals, I often get answers with the wrong sign if I set:

g[x_] = InverseFunction[F][x]

I need to compose g with another function, so it's not enough to just reflect the plot of F in the line y=x.

The easy fix I've found is just to let

g[x_] = Abs[InverseFunction[F][x]]

but this feels like a bit of a cheat, and on my machine, it takes quite a long time to generate a plot (it is possible to speed up this process?)

Instead, I've been trying to define g as a function with a restricted domain using ConditionalExpression, as in the example at

http://reference.wolfram.com/language/ref/InverseFunction.html

I must be doing something wrong, because I don't get any plot whatsoever!

Any help would be much appreciated

POSTED BY: Oliver Feng
3 Replies

Another way,using differential equation:

F[x_] := 1 - x^2/(2 Cosh[x] - 2)
HoldForm@D[InverseFunction[F][x], x] == D[InverseFunction[F][x], x]

Substituting enter image description hereand simplifying:

enter image description here

eq = y'[x] == 1/(-((2 y[x])/(-2 + 2 Cosh[y[x]])) + (2 Sinh[y[x]] y[x]^2)/(-2 + 2 Cosh[y[x]])^2)// Simplify
sol = NDSolve[{eq, y[0] == 1}, y, {x, 0, 1}, WorkingPrecision -> 20];
Plot[y[x] /. sol, {x, 0, 0.92}]

enter image description here

Or by Inverse Series:

F[x_] := 1 - x^2/(2 Cosh[x] - 2);
n = 10;(*more better*);
inv = Normal@InverseSeries[Series[F[x], {x, 0, n}]];
Plot[Evaluate@inv, {x, 0, 1}]
POSTED BY: Mariusz Iwaniuk

Another way, without using InverseFunction:

g[y_ /; Element[y, Reals]] := 
 First[x /. NSolve[F[x] == y && x > 0, x, Reals]]
POSTED BY: Gianluca Gorni
POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard