Hot answers tagged

26

Mathematica does not support this directly. You can do things of this sort using an external package called NCAlgebra. http://math.ucsd.edu/~ncalg/ The relevant documentation may be found at http://math.ucsd.edu/~ncalg/DOWNLOAD2010/DOCUMENTATION/html/NCBIGDOCch4.html#x8-510004.4 In particular have a look at "4.4.8 NCLDUDecomposition[aMatrix, Options]" ...


12

Well, numerical approach is at least straight forward, though maybe a bit tedious to make perfectly automated. Here is a crude start. I will deal only with real part of your function. Find the table of points and flip point pairs: invf = Re@Table[{f[r], r}, {r, 0.001, 5, .01}]; gr = Show[ListLinePlot[invf, PlotStyle -> Red], Plot[{r, Re@f[r]}, {r, 0, 5}...


11

Here's a nice one-liner: TransformationFunction[{{1, 0, 0, 0}, {0, 0, -1, 0}, {0, 1, 0, 3}, {0, 0, 0, 1}}] // InverseFunction TransformationFunction[{{1, 0, 0, 0}, {0, 0, 1, -3}, {0, -1, 0, 0}, {0, 0, 0, 1}}] Note that TransformationFunction[] is the head of the results returned by geometric *Transform functions, which take a homogeneous transformation ...


10

No, Log is the name of the function and Log[x] is the function applied to x. Using Log without the argument is accepted by the system because Log is a symbol just like any other, but it does not make any sense. The correct way to write it is Solve[Log[x]/x^2 == y, x] or Reduce[Log[x]/x^2 == y, x] The latter tries to give you full solution ...


10

The most convenient way to answer this question is by using InverseFunction which allows you to hide the details of finding the numerical inverse: g = InverseFunction[Function[{t}, Tan[t] - t]] Then your equation Tan[t] - t == a x can be solved by simply saying g[a x]


10

The identity does not hold for x < -1: Plot[ProductLog[x*Exp[x]], {x, -5, 5}] FullSimplify[ProductLog[x*Exp[x]], x >= -1] x (* result in 10.1.0 under Windows *)


9

The determinant computation is a matter of memory use in terms of how much we want to store for subdeterminants of a Laplace expansion. Mathematica simply refuses to go that route after 11x11. YOu can do your own as below. myDet[mat_] /; Length[mat] <= 4 := Det[mat] myDet[mat_] := myDet[mat] = Sum[mat[[1, j]]*myDet[Drop[mat, {1}, {j}]], {j, Length[...


9

First, for the sake of simplicity let's define eqs - the system of our interest : eqs = { x == p + R Cos[k], y == Cos[p] + R Sin[k], k == ArcTan[ 1/Sin[p]] }; Equations y = y(x) For this system we can find an explicit equation $\;y = y(x)\;$ only assuming R == 0, otherwise we could find only implicit solutions. Solve[ eqs /. R -> 0,...


9

For a general square matrix m and arbitrary partition of it into conformable parts m={{a,b},{c,d}} (i.e., a and d are square matrices, and b and c have appropriate dimensions), the formula for the inverse (which can be found in, for example, Review of Matrix Algebra) is m={{a,b},{c,d}}; e = d - c.Inverse[a].b; minv={{Inverse[a] + Inverse[a].b....


8

My interpretation of the question is that you want to find $x$ for given $f$, $g_2$ and $g_1$. Then just define $F=f/g_1$ and differentiate with respect to $x$ on both sides: $\frac{d}{dx}F(x)=g_2(x)$ Now solve this equation for $x$. There's no integration involved.


8

In general this is not an easy thing to do, and a package as Daniel Lichtblau suggested may be your best bet. However in the specialized case of a 2^n x 2^n matrix, the inversion is very well known. The case mentioned in your post is: Clear[sInverse]; (* s for symbolic *) sInverse[{{a_, b_}, {c_, d_}}] := {{Inverse[a], -Inverse[a] . b . Inverse[d]},...


7

You can plot curves defined by implicit equations using ContourPlot: ContourPlot[ Cos[Sqrt[y]] + Sin[Sqrt[y]]/Sqrt[y] == Cos[x], {x, 0, 10}, {y, 0, 10}]


7

Usually simplifying the result with appropriate assumptions gives desired result: m={{3, 2, 1}, {3, 1, 2}, {2, 3, -1}, {-(3/b), -(3/b^2) - 2/b, -(3/b^3) - 2/b^2 - 1/b}, {-(3/b), -(3/b^2) - 1/b, -(3/b^3) - 1/b^2 - 2/b}, {-(2/b), -(2/b^2) - 3/b, -(2/b^3) - 3/b^2 + 1/b}}; Simplify[PseudoInverse[m], b \[Element] Reals]


6

The Mathematica documentation has a tutorial on eliminating variables that is helpful: http://reference.wolfram.com/mathematica/tutorial/EliminatingVariables.html Solve[{x == p + R*Cos[k], y == Cos[p] + R*Sin[k], k == ArcTan[1/Sin[p]]}, y, {p}] y -> Cot[k]^2 (R Sin[k] Tan[k]^2 - Sqrt[-Tan[k]^2 + Tan[k]^4]) Solving for y in terms of just x turns ...


6

As suggested by george2079 the equation can be solved by substition: Reverse@Simplify[f[x] == 2 x + 1/x - f[1/x]/2 /. f[1/x] -> 2/x + x - f[x]/2] f[x] == 2 x To find $f^{-1}(4)$ you can use f = 2 # &; InverseFunction[f][4] 2


6

This seems usable at least for moderately large x. one could use cutoffs and different start values if this is not useful in smaller ranges. f[x_?NumberQ] := y /. FindRoot[LogIntegral[y] == x, {y, x*Log[x]}, WorkingPrecision -> 20, PrecisionGoal -> 12] Two examples: f[10^200] (* Out[55]= 4.6565831394119416907*10^202 *) NIntegrate[n/(f[n])^2, ...


6

If you have a homogenous transformation matrix of the form $$\begin{bmatrix} \mathrm{R_{3 \times 3}} & \mathrm{d}_{3 \times 1} \\ 0_{1\times 3} & 1_{1\times 1} \end{bmatrix}$$ Then the inverse is given by $$\begin{bmatrix} \mathrm{R}^{-1} & -\mathrm{R}^{-1}\mathrm{d} \\ 0 & 1 \end{bmatrix}$$ Therefore, if your ...


5

The easiest way is to evaluate this: SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{ Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData[All], FontColor -> GrayLevel[1], Background -> GrayLevel[0]]}, Visible -> False, StyleDefinitions -> "PrivateStylesheetFormatting.nb"] ] However as you ...


5

Your method is perfectly fine in principle, because in one dimension energy conservation leads to a "quadrature" solution (i.e., you formally avoid solving the usual equation of motion). But since inverting the numerical integration is another numerical step it doesn't actually end up making the solution very easy to obtain. For example, you have to think ...


5

Let us define the equation: Clear[eq]; eq[m_, f_] := 1/(x - 1) - (m + 1)/(x^(m + 1) - 1) == f; where x stays for Exp[f/(k t)]. If one applies the function Solve to it, Mma clearly answers that it cannot provide exact solution of this equation. It should not be expected, therefore, that one can find any other analytical solution. Numerically, it is ...


5

You can get very close to the solution in three iterations of Newton's method: f[x_, a_] := x/Sin[Pi/2 x]^a fInvNewton[y_?NumericQ, a_?NumericQ, iter_: 3] := Nest[# - (f[#, a] - y)/Derivative[1, 0][f][#, a] &, If[y > 2/Pi, y, ((Pi/2)^a y)^(1/(1 - a))], iter] Example: Plot[Evaluate@{fInvNewton[y, 0.5, 3], InverseFunction[f, 1, 2][y, 0.5]}, ...


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], ListPlot[...


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[ ...


5

PowerExpand[ProductLog[x Exp[x]]] x This assumes $x\ge0$


5

The equation x Exp[x] == y has multiple solutions for x. For example, evaluating tab = Table[{x -> ProductLog[i, 1]}, {i, 0, 5}] Exp[x] x /. tab N[tab] gives {1, 1, 1, 1, 1, 1} and {{x -> 0.567143}, {x -> -1.53391 + 4.37519 I}, {x -> -2.40159 + 10.7763 I}, {x -> -2.85358 + 17.1135 I}, {x -> -3.16295 + 23.4277 I}, {x -> -3....


4

To visualize y[z] without having to go through inversion, you can use ParametricPlot: Manipulate[ ParametricPlot[{y[x, a, b, c], z[x, a, r]}, {x, 0, 1}, AxesLabel -> {z, y}, AspectRatio -> 1, PlotRange -> {{-10, 10}, Automatic}], {{a, 1}, 0, 5, .1}, {{b, 1}, 0, 5, .1}, {{c, 1}, 0, 5, .1}, Delimiter, {{r, 1}, .5, 2, .1}, ...


4

I think you're on the right track with Reduce. If the domain Reals is specified, Reduce will return results that can be converted to a Piecewise expression straightforwardly. Clear[f]; f[t_] = Piecewise[{{t/4, t < 0}, {t/2, t < 3}, {3/2 + (t - 3)*3, True}}]; invPW[f_] := Evaluate @ Module[{t}, Piecewise[ List @@ Reduce[# == f[t], t, Reals] /. {...


4

I can offer some ideas but it would take work to put together into a package. I'll illustrate with the example sqrt(3)+sqrt(5)pi. val = Sqrt[3] + Sqrt[5]*Pi; Set up an vector of values involving powers of both pi and val. We will work at fairly high precision (300 digits). I chose to go to degree 6 in each, which is overkill for this example but of course ...


4

In this case, I would restrict the domain of the inverse after inverting it, as follows invf = InverseFunction[Exp[-β (-Log[#])^α] &] (* E^(-(-1)^((1/α)) β^(-1/α) Log[#1]^(1/α))& *) Piecewise[{{E^(-(-1)^((1/α)) β^(-1/α) Log[#1]^(1/α)), 0 < # <= 1}}, #]& or, a little more programmatically With[{f = invf[[1]], Piecewise[{{f, 0 < # <...


4

I think this is an issue of the interpolation order being too high and the resulting function not being 1 - 1. A way is to set the InterpolationOrder to 1 or to create the inverse function by inverting the data and then interpolating: inv2 = Interpolation[MapIndexed[List[#1, Sequence @@ #2] &, Array2]]; so that inv2[int2[5.]] 5. ---EDIT--- ...



Only top voted, non community-wiki answers of a minimum length are eligible