Skip to main content
added 6 characters in body
Source Link
Akku14
  • 17.4k
  • 15
  • 32

You can find the two inverses by generating a differential equation of foo and solve with NDSolve applied to two initial conditions. Even derivatives of inverse function can be produced.

pts = Table[{i, i^2}, {i, -10, 10}];
foo = Interpolation[pts];

dinv = D[foo[x[y]] == y, y]

xsol[y_] = 
   x[y] /. NDSolve[{dinv, #}, x, {y, 100, 0}] & /@ {x[100] == -10, 
x[100] == 10} // Quiet

{Plot[xsol[y], {y, 0, 100}, ImageSize -> 300, AspectRatio -> 1], 
 Plot[xsol'[y], {y, 0, 100}, ImageSize -> 300, AspectRatio -> 1] 
}

enter image description here

You can find the two inverses by generating a differential equation of foo and solve with NDSolve applied to two initial conditions. Even derivatives of inverse function can be produced.

pts = Table[{i, i^2}, {i, -10, 10}];
foo = Interpolation[pts];

dinv = D[foo[x[y]] == y, y]

xsol[y_] = 
   x[y] /. NDSolve[{dinv, #}, x, {y, 100, 0}] & /@ {x[100] == -10, 
x[100] == 10} // Quiet

{Plot[xsol[y], {y, 0, 100}, ImageSize -> 300, AspectRatio -> 1], 
 Plot[xsol'[y], {y, 0, 100}, ImageSize -> 300, AspectRatio -> 1]}

enter image description here

You can find the two inverses by generating a differential equation of foo and solve with NDSolve applied to two initial conditions. Even derivatives of inverse function can be produced.

pts = Table[{i, i^2}, {i, -10, 10}];
foo = Interpolation[pts];

dinv = D[foo[x[y]] == y, y]

xsol[y_] = 
   x[y] /. NDSolve[{dinv, #}, x, {y, 100, 0}] & /@ {x[100] == -10, 
x[100] == 10} // Quiet

{Plot[xsol[y], {y, 0, 100}, ImageSize -> 300, AspectRatio -> 1], 
 Plot[xsol'[y], {y, 0, 100}, ImageSize -> 300, AspectRatio -> 1] 
}

enter image description here

Source Link
Akku14
  • 17.4k
  • 15
  • 32

You can find the two inverses by generating a differential equation of foo and solve with NDSolve applied to two initial conditions. Even derivatives of inverse function can be produced.

pts = Table[{i, i^2}, {i, -10, 10}];
foo = Interpolation[pts];

dinv = D[foo[x[y]] == y, y]

xsol[y_] = 
   x[y] /. NDSolve[{dinv, #}, x, {y, 100, 0}] & /@ {x[100] == -10, 
x[100] == 10} // Quiet

{Plot[xsol[y], {y, 0, 100}, ImageSize -> 300, AspectRatio -> 1], 
 Plot[xsol'[y], {y, 0, 100}, ImageSize -> 300, AspectRatio -> 1]}

enter image description here