Tag Info

Hot answers tagged

19

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]" ...


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

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


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]


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


8

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


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.


7

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] + ...


7

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


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]


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}]


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


5

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


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

Following Jens's answer, if you want the actual values from his implicit plot, tt=ContourPlot[Cos[Sqrt[y]] + Sin[Sqrt[y]]/Sqrt[y] == Cos[x],{x, 0, 10}, {y, 0, 10}]; data=Cases[tt//Normal, Line[a_] :> a, Infinity] // First; ListLinePlot[data] Note that it need not be a one to one function. tt = ContourPlot[x^2 + y^2 == {1, 2, 3}, {x, -2, 2}, {y, ...


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

Here's a short routine for computing the Mach number from the Prandtl-Meyer equation: prandtlMeyerMachNumber[γ_?InexactNumberQ, ν_?InexactNumberQ] := Module[{prec = Precision[{γ, ν}], β, η, λ, m}, λ = Sqrt[SetPrecision[(γ - 1)/(γ + 1), ∞]]; η = ν + π (1 - 1/λ)/2; m = ((3 + γ) η^2/12 + 2/(1 - γ))/η; Sqrt[β^2 + ...


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


4

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


3

Basic implementation Here is a function BlockTridiagonalSolve that takes three lists of blocks (diag, lower and upper) and a list of vector pieces (vec) and solves the corresponding linear system: BlockTridiagonalSolve[diag_?(ArrayQ[#, 3] &), lower_?(ArrayQ[#, 3] &), upper_?(ArrayQ[#, 3] &), vec_?MatrixQ] := Module[{a, i, n = Length[diag], d ...


3

Although perhaps less generalizable than the ContourPlot solutions, the approach below will work for many similar problems. You will have to guess a reasonable initial value for y, but that should usually not be a problem. Plot[y /. FindRoot[Cos[Sqrt[y]] + Sin[Sqrt[y]]/Sqrt[y] == Cos[x], {y, 1}], {x, 0, 10}]


3

During the years I developed this peculiar idea that that best way to use Mathematica is to use it to the least possible extent. Hence, if you can do a simplification by hand, do it by hand. The problem with Mathematica is that that software is sometimes too smart - or too dumb, depending on the point of view. Some behaviors of MMA that stand in the way of ...


3

Well, I guess you could try using InverseFunction. However, this will only give explicit algebraic expressions when the function that is to be inverted is fairly simple. Your example functions are: y[x_, a_, b_, c_] := a Log[x] + Exp[b x]/(c + x) z[x_, a_, r_] := Log[x] (1 - Cos[x] Exp[a^2 x])^r And you can evaluate and plot $y(x(z))$ where $z \mapsto ...


3

Answering your comment: f[x_?NumericQ] := f[x] = g1[x] NIntegrate[g2[t], {t, 0, x}]; g1[x_] := Sin[x]; g2[x_] := Cos[x]; k = FindRoot[f[x] == Pi/9, {x, 1}] Pi/9 - f[x] /. k[[1]] (* -> {x -> 0.632072} -5.55112*10^-17 *)


3

There is an issue of math here independent of Mathematica. A vector not being in the null space is not the same as it being in the invertible subspace. What you want to consider is the eigensystem of the matrix. The invertible subspace corresponds to the span of the eigenvecotrs with nonzero eigenvalues (the eigenspace with eigenvalues of 0 is precisely the ...


2

A supplement to above two wonderful answers: Notice that any two of the branches of curve $C$ defined by $f(t)=\tan(t)-t$ are identical with only a translation of $\boldsymbol{\mathrm{v}}_n=(n \pi,-n \pi)^{\mathrm T}$ : $$ \left( \begin{array}{c} t \\ \tan(t)-t \\ \end{array} \right)+ \left( \begin{array}{c} 1 \\ -1 \\ \end{array} \right)n\pi = \left( ...


2

You might look for the approximate analytical solution as follows. Let us first denote y=Ax. We will substitute it back later. This is the table of solutions of your equation with 0<=y<=Pi/2: tb = Table[{y, FindRoot[Tan[t] - t == y, {t, 1.2}][[1, 2]]}, {y, 0, \[Pi]/2 - 0.02, 0.1}]; Now one can fit this list, and get an analytical solution out of ...


2

I am aware of two functions that can eliminate variable algebraically: Eliminate and Solve. They are described in this guide: Eliminating Variables These functions work with polynomial equations (or equations that can be reduced to polynomials in some way). Reduce is more generic, but it doesn't give any means of eliminating $x$ without solving for it ...


2

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] /. ...



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