3
$\begingroup$

The short code is below, but no plot is produced. Are there any errors in my code? Thanks!

f[x_] = x + 2^(1/3)*x^(4/3);

g[x_] := InverseFunction[Composition[f, f]][x]

k[x_] := x^(1/3)*g'[x]/g[1]

Plot[Evaluate@k[x], {x, 0, 1}, WorkingPrecision -> 15]
$\endgroup$
  • $\begingroup$ k[x] is complex. Use Plot[Evaluate@ReIm@k[x], {x, 0, 1}, WorkingPrecision -> 15] instead. $\endgroup$ – Carl Woll Jan 17 '18 at 18:59
4
$\begingroup$

Your problem is that InverseFunction is choosing the "wrong" branch for the inverse. To account for this, you can use ConditionalExpression to pick the branch used by InverseFunction. For your example:

f[x_] := x + 2^(1/3) x^(4/3)
if = InverseFunction[ConditionalExpression[f[#], #>0]&]

Rather than finding the inverse of Composition[f, f], it will be easier for Mathematica to use Composition[if, if]. So:

g = Composition[if, if];

Now, unfortunately, there is an issue when using Derivative on the above Composition object, so I will use the following workaround to obtain g':

gp = (Composition[h, h]') /. h -> if;

Let's do a couple quick numerical checks:

(* inverse check *)
Composition[f, f][g[1.]]

1.

(* derivative check *)
gp[1.]
10^6 (g[1. + 10^-6] - g[1.])

0.20484

0.20484

Looks good. Now, we can define k:

k[x_] := x^(1/3) gp[x]/g[1]

Finally, a plot:

Plot[k[x], {x, 0, 1}, PlotRange->All]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks a lot, Carl! But I have one question about 'gp = (Composition[h, h]') /. h -> if; ' what is 'h'? how it comes from? sorry I am a beginner. $\endgroup$ – yewfeng so Jan 17 '18 at 23:39
  • $\begingroup$ @yewfengso Mathematica chokes on Composition[if, if]', so as a workaround, I introduce the dummy variable h, and do Composition[h, h]' (which is shorthand for Derivative[1][Composition[h, h]]), and then substitute if for h. $\endgroup$ – Carl Woll Jan 18 '18 at 0:09
  • $\begingroup$ Thanks for your great help! Carl! $\endgroup$ – yewfeng so Jan 18 '18 at 3:47
  • $\begingroup$ I am still confused about the code, since I change it slightly, removing $x^{1/3}$ from k(x), but got a wired result, see below. can you take a look? Thanks! $\endgroup$ – yewfeng so Jan 18 '18 at 14:43
0
$\begingroup$

if I change the code slightly, like below in the pic, k(1)=0, but it is not actually, since the $ k(x)=\frac{(f^{-1}\circ f^{-1})'(x)}{f^{-1}\circ f^{-1}(1)}>0, x\in[0,1]$.

f[x_] := x + 2^(1/3) x^(4/3)

if = InverseFunction[ConditionalExpression[f[#], # > 0] &]

g = Composition[if, if];

gp = (Composition[h, h]') /. h -> if;

k[x_] := gp[x]/g1

Plot[k[x], {x, 0, 1}, PlotRange -> All]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.