# Tag Info

5

define a function of two variables, f[x_, m_] = 2 m (Sqrt[4 x^2 (1 - m^2) + m^4 + 4 m^2 x]/(1 - m^2) + m^2/(4 (1 - m^2) Sqrt[m^2 - 1]) ArcSin[(2 (1 - m^2) x + 4 m^2)/(4 m^3)]); then tell InverseFunction to invert w.r.t. the first argument: inv = InverseFunction[f, 1, 2]; Show[{Plot[f[x, 2], {x, -10, 10}, PlotRange -> All], ...

5

This is simple enough to do analytically.. assuming l2>l1 you can readily find the transition points and invert each piece of the Piecewise expression: myfuninv[x_, l1_, l2_ /; l2 > l1] = Piecewise[{ {Sqrt[x], x <= l1^2}, {x + l1 - l1^2, l1^2 < x <= l2 + l1^2 - l1}, {Exp[x + l1 - l2 - l1^2] - 1 + l2, l2 + l1^2 - l1 < x}}] Plot[ ...

2

The following uses NDSolve to construct interpolations along lines in the domain. We then construct an interpolation between the solutions to NDSolve, which represents a as a function of l1 and l2. {dadl1, dadl2} = grad = PiecewiseExpand /@ (-D[myfun[a, l1, l2], {{l1, l2}}]/ D[myfun[a, l1, l2], a]) /. ComplexInfinity -> 0 // Quiet; sols = ...

2

General Inversion You can use FindRoot to do a general inversion of a Piecewise function. The strategy will be to extract the smooth continuous function from the piecewise function and use that as input to FindRoot. Below is a copy of your function: myfun[a_, l1_, l2_] = Piecewise[{ {a^2, a < l1}, {a - l1 + l1^2, a >= l1 && a ...

4

You can see what you get with the body of your function myInvFun over parameter instances: In[215]:= FindRoot[myfun[x, 2, 5] == 2.0, {x, 0}] Out[215]= {x -> 0.} FindRoot::jsing: Encountered a singular Jacobian at the point {x} = {0.}. Try perturbing the initial point(s). >> So, if you change your definition as advised by the message you'll get ...

0

If this is for convenience, then you could write a wrapped for JordanDecomposition, e.g. something like this: Clear[jd] jd[m_] := Module[{s, j}, {s, j} = JordanDecomposition[m]; {s, Inverse[s], j} ] Then for example: a = {{27, 48, 81}, {-6, 0, 0}, {1, 0, 3}}; jd[a] (* Out: { (* the similarity matrix s *) {{3, 18, 2}, {-3, -9, -(1/4)}, {1, 2, 0}}, ...

Top 50 recent answers are included