Tag Info

Hot answers tagged

17

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

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


9

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


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


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


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


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


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

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

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


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

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


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


1

I think it's just a matter of handling the numerics; you have very small matrix elements which give rows/columns of all zeros when chopped. You can avoid that by transforming the elements of your matrices to be rationals : c = Rationalize[Cttt, 10^(-50)]; e = Rationalize[E0, 10^(-50)]; k = Inverse[c.e.Transpose[c]]; Check : Block[{a = 2.1 10^8}, ...


1

This was (partially answered on the mathematica-community site). Here is that posting: Without solving the problem of finding the condition where the trajectory lies within a disk. This modification of your code may help you construct a numerical technique. sol = DSolve[{y'[t] == g/(2 zf) y[t] + u z[t], z'[t] == -g + g/zf z[t] - u y[t], ...


1

One approach would be to use ConditionalExpression instead of Piecewise. For example: InverseFunction /@ {ConditionalExpression[#/4, # <= 0] &, ConditionalExpression[#/2, 0 <= # <= 3] &, ConditionalExpression[3/2 + 3 (# - 3), 3 <= #] &} returns {ConditionalExpression[4 #1, #1 <= 0] ...


1

On version 8.0.4 (Mac OS X 10.7.4) I can't reproduce the hanging problem right now. So I'll just post what I get in order to illustrate the point whuber was making in the comment about the switch between branches at $\pi/2$: f[r_] := ArcCos[(-1 + 4.20278 r (0.008712/r^2 + 0.475876/r - 1/(1 + r)))/ Sqrt[1 - 10.598 r^2 (0.008712/r^2 + 0.475876/r - 1/(1 + ...



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