Tag Info

Hot answers tagged

32

I guess that V9 now adds this capability: $Assumptions = { Element[A, Matrices[{m, n}]], Element[B, Matrices[{n, k}]] }; TensorReduce[ Transpose[Transpose[A].Transpose[B]] ] (* Out: B.A *)


29

Solutions to algebraic or transcendental equations are expressed in terms of Root objects whenever it is impossible to find explicit solutions. In general there is no way express roots of 5-th (or higher) order polynomials in terms of radicals. However even higher order algebraic equations can be solved explicitly if an associated Galois group is solvable. ...


21

You can't use replacements that way, because Mathematica does not do replacements on expressions the way they appear to you. To see what I mean, take a look at the FullForm of your expression: x/(y*z) // FullForm Out[1]= Times[x,Power[y,-1],Power[z,-1]] Whereas, the replacement that you're using is Times[y, z]. In general, it is not a good idea to use ...


20

The most direct way to test this is probably the following: $Assumptions = x > 0; Element[x, Reals] // Simplify (* Out[1]= True *) $Assumptions = True; Element[x, Reals] // Simplify (* Out[4]= x ∈ Reals *) So $x>0$ seems to imply that $x$ is real.


20

A first step would be to implement a convenience function that can automatically apply the method of separation of variables to separable types of equations. To show that the steps could in principle be automated, let me repeat basically the same calculation that I did for cylindrical coordinates with only slight modifications to the heat equation: ...


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


19

One way is to use an extra argument that acts as a switch. Clear[f]; f[0] = 1; f[1] = 1; f[n_, True] := f[n - 1] + f[n - 2] Example: f7 = f[7, True] (* Out[329]= f[5] + f[6] *) To proceed another step, can do a replacement. f7 /. f[aa_] :> f[aa, True] (* Out[330]= f[3] + 2 f[4] + f[5] *) Can use Nest to repeat this n times. Nest[# /. f[aa_] ...


18

What you have is a MultinormalDistribution. The quadratic and linear forms in the exponential can be rewritten in terms of $\frac12(\vec{x}-\vec{\mu})^\top\Sigma^{-1}(\vec{x}-\vec{\mu})$ where $\vec{\mu}$ represents the mean and $\Sigma$ the covariance matrix, see the documentation. With this, you can do integrals of the type given in the question by ...


17

Removing the imaginary portion of an expression is done by doing ComplexExpand[Re[expression]]. Using just Re alone will not work as Re does no evaluation on symbols with unknown complex parts. Now as stated in the problem and the comments above this particular problem requires a fair amount of assumptions. The simplest way to add local assumptions is to ...


17

It is assumed that $x$ is a real number. Everything else would mathematically not make sense because on complex numbers there does not exist an ordering relation. An example would be to take the expression $\sqrt{x^2}$ and to imagine that this is not equal $x$ for $x=-\mathbb{i}$. Therefore the expression is in a general form not simplified In[37]:= ...


17

The nearest Mathematica has to "types" are Heads of expressions that are Atoms. For example: Through[{AtomQ, Head}[2]] {True, Integer} Through[{AtomQ, Head}[2 + I]] {True, Complex} Through[{AtomQ, Head}["cat"]] {True, String} and so on... There are also somewhat different "types" in the context of Compile.


17

In this case you can use SeriesCoefficient SeriesCoefficient[Exp[x], {x, 0, n}]


16

If you use the third argument in Solve, i.e. a list of variables to be eliminated (take a look at the Eliminating Variables tutorial in Mathematica) then you'll get the result immediately : Solve[{a b c == -1, a^2/c + b/c^2 == 1, a^2 b + b^2 c + c^2 a == t, a b^5 + b c^5 + c a^5 == res}, {res}, {a, b, c, t}] {{res -> 3}} Edit ...


16

Looking at the Trace of one which does work: x = Sin[Pi/5] (* Sqrt[5/8 - Sqrt[5]/8] *) Trace[ArcSin[x], TraceInternal -> True] It appears that Mathematica computes the ArcSin numerically and then recognises the result, 0.628319 as possibly equal to Pi/5. To check it computes Sin[Pi/5], and subtracts it from the original argument to see if it gets ...


15

Because the assumption system is not called during the standard evaluation sequence, it is only called when Simplify, FullSimplify, Sum, Integrate etc... are used. Thus, x>0 remains unevaluated: Assuming[x > 0, x > 0] (* ==> x > 0 *) and TrueQ then returns False: Assuming[x > 0, TrueQ[x > 0]] (* ==> False *) If, however, you ...


15

There is no need to play around with ReplaceAll, Rule, Block, Module or whatever using D, since you have an oparator Derivative really fulfilling your needs while you need not bother if the arguments were defined, so I recommend it to find symbolic derivatives of your function. Remember of shorthands f', f'' to represent first and second derivatives of ...


15

Use the following representation of the Legendre polynomials: $$ P_n(x) = 2^n \sum_{k=0}^n x^k \binom{n}{k} \binom{\frac{n+k-1}{n}}{n} $$ Note that the sum effectively is over $k \equiv n \bmod 2$. Expand each Legendre polynomial into a sum. Integration with respect to $\theta$ is easy: $$ \int_0^{\pi} \sin^{k_1+k_2+k_3+1} \theta \mathrm{d}\theta ...


15

Regarding your general question: from my own experience, a large part of my research findings while still at academia would have been much harder or outright impossible to get without Mathematica, and that applies to both numerical and analytical work. I also know this for many other people. There are a number of areas where it allows you to get through some ...


15

Here is extensions to @Jens answer (I think) also relying on possible separation of variable. I is not meant as an independent answer, but complements it. First extend his answer to 2D ClearAll[pt, px, x, t, p]; operator = Function[p, D[p, t] - Δ D[p, x, x] - Δ D[p, y, y]]; ansatz = pt[t] px[x] py[y]; pde2 = Expand[Apply[Subtract, ...


14

You are assuming that $$ \sqrt{\frac{a}{b}} = \frac{\sqrt{a}}{\sqrt{b}} $$ This is not generally true. Take for example $a=1$ and $b=-1$ for which this identity does not hold. You need to give additional assumptions to Simplify, in this case that $b>0$. Simplify[Sqrt[a/b] == Sqrt[a]/Sqrt[b], b > 0] (* ==> True *)


14

In general, one cannot get explicit analytic solutions of trancendental equations in terms of radicals. This is also the case of univariate higher order polynomial equations. On the other hand since Mathematica 7 we can find exact solutions (in terms of Root objects) of a wide range of (univariate) trancendental equations, for more detailed discussion of ...


14

Short story $$ \vartheta(x) = \arg \left[(\operatorname{Bi}x+i \operatorname{Ai}x)e^{-\frac{2}{3} i (-x)^{3/2}}\right]+\frac{2}{3} \operatorname{Re}\left[(-x)^{3/2}\right] $$ Update: I see that you want use only real functions, so you can expand this as $$ \vartheta(x) = \begin{cases} \arctan\frac{\cos \left(\frac{2}{3} (-x)^{3/2}\right) ...


14

Here's the exact answer: i1 = Integrate[x^n Exp[-(x - a)^2], {x, 0, Infinity}, Assumptions -> n > 0] /. n -> 1/2 (* 1/2 E^-a^2 (Gamma[3/4] Hypergeometric1F1[3/4, 1/2, a^2] + 1/2 a Gamma[1/4] Hypergeometric1F1[5/4, 3/2, a^2]) *) i1 /. a -> 0.3 (* 0.907605 *)


13

Initially, Mathematica is not designed for such abstract calculations. But, Mathematica is a powerful programming language, so that one can add such functionality easily. See the following examples in related area of differential geometry: calculations in symbolic dimensions Abstract calculations


13

An experimental internal function Integrate`InverseIntegrate helps here, although it's intended more for integrands involving logs. This is what it returns in the development version: Integrate`InverseIntegrate[Exp[-x Cosh[t]], {t, 0, Infinity}, Assumptions -> Re[x] > 0] (* BesselK[0, x] *)


13

There is nothing wrong with the issue in the question. Mathematica shouldn't evaluate Simplify[ Integrate[f[x] + g[x], x] == Integrate[f[x], x] + Integrate[g[x], x]] to True, because in general such a rule would be mathematically simply wrong. Consider e.g. $ \forall_{x } f(x) = - g(x)$, while $f$ is not e.g. Lesbegue integrable. Of course ...


13

Conjugate[a + b*I]//ComplexExpand or Refine[Conjugate[a + b*I], {a, b} \[Element] Reals]


13

Since nobody pointed this out I think there is still room for another reply. Note that this works fine Unevaluated[(x + Log[y*z])/(y*z)] /. (y*z) :> w (x + Log[w])/w In more complex cases you may also need to use HoldPattern Unevaluated[(x + Log[(y*z)/2])/((y*z)/2)] /. HoldPattern[((y*z)/2)] :> w (x + Log[w])/w This is not a panacea. ...


13

Working with RSolve we can find much more than only a few first terms, here is a general term of your function u[n] e.g. : u[n_] = u[n] /. Flatten[ RSolve[{ u[1] == 1, u[2] == 2, u[3] == 3, u[n] == -u[n-3] + 3 u[n-2] + 2 u[n-1]}, u[n], n]] Root[1 - 3 #1 - 2 #1^2 + #1^3 &, 3]^n Root[-45 + 457 #1 - 1028 #1^2 + 257 ...



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