Tag Info

Hot answers tagged

23

Usage: dChange[expresion, {transformations}, {oldVars}, {newVars}, {functions}] dChange[expresion, {functionsSubstitutions}] (***NEW***) You can also skip {} if a list has only one element. Examples: Functions replacement (New) example on special case separation of Fokker-Planck equation dChange[ -D[u[x, t], {x, 2}] + D[u[x, t], {t}] - D[x u[x, ...


23

The plan is first get the "external" contour and then use Green's theorem to find its area. r[t_] := {-9 Sin[2 t] - 5 Sin[3 t], 9 Cos[2 t] - 5 Cos[3 t], 0} (*find the intersections*) tr = Quiet@ToRules@Reduce[{r@t1 == r@t2, 0 < t1 < t2 < 2 Pi}, {t1, t2}]; pt = {t1, t2} /. {tr} // Flatten; pts = SortBy[pt, N@# &]; pps = Partition[pts, 2]; Now ...


21

I've decided to expand on my comment. Before I delve into the solution, let's all pause for a moment and marvel at the stereographic parametrization of a unit circle: $$\begin{pmatrix}\frac{1-t^2}{1+t^2}\\\frac{2t}{1+t^2}\end{pmatrix}$$ Sometimes also referred to as the Weierstrass substitution, it has often been used as a tool in the solution of algebraic ...


20

After all this time, I came up with a very nice tensor calculus proof of the Hairy Ball Theorem. It only depends on Stokes theorem and standard laws of tensor calculus like the Ricci identity and symmetries of curvature tensors. All the topology is done by Stokes theorem. The remainder of the proof is equational, local and geometrical. It is coordinate/basis ...


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


17

Disclaimer: This is not a full answer, but perhaps it's a start. From an algebraic stand point this seems like a very hard problem. I attacked it with a more brute force approach. I guess a basis and use LatticeReduce to try to find a Diophantine relation. Note this code only tries to identify roots as the product of integral powers of trig. If it returns ...


15

Having experienced similar problematic issues with Mathematica I instantly thought that expanding the fraction in the integrand i.e. applying Appart could resolve the problem, and indeed it does: Integrate[ Apart[(1 - x)(1 + 2x)^6/Sqrt[1 - x^2]], {x, -1, 1}]/Pi 15 These arguments apply to this case as well Bug in mathematica analytic integration? i.e. ...


13

It seems to me that Denominator helps a lot: fractionQ = Denominator@# =!= 1 &; fractionQ /@ {a/b, 1/a, 1/5, b/2, a, .5} (* {True, True, True, True, False, False} *)


11

$$\mathbb{P} \big(\sum_{i=1}^{m} (A_i + S_i) \le L < \sum_{i=1}^{m+1} (A_i + S_i) \big) = \frac{\mu ^m (2 \lambda +\mu )}{2^{m+1} (\lambda +\mu )^{m+1}}$$ Observing: d1 = TransformedDistribution[ a + s, {a \[Distributed] ExponentialDistribution[λ], s \[Distributed] ExponentialDistribution[μ]}] (* ...


10

As far as I know, there is no easy, general way to handle this kind of algebra with Sum expressions. What follows is an attempt to use replacement rules to handle a wider range of cases than chris's example. I don't consider it to be the canonical answer that is required, but perhaps someone might be able to use it as a starting point. I use Inactive on ...


9

Is this what you want? Clear[Derivative, h]; h[0] = 1; (* to avoid division by zero with OP's example R *) Derivative[1][h][s_] := Block[{Derivative}, h'[\[FormalS]] /. First@Solve[ D[R[a + h[\[FormalS]]] == - \[FormalS], \[FormalS]], h'[\[FormalS]]] /. \[FormalS] -> s ]; Derivative[n_][h][s_] := D[Derivative[n - ...


8

You don't need to use TagSetDelayed for the definition of the derivative because Derivative doesn't have attribute Protected. I'll extend add the derivative definition to arbitrary order n: ClearAll[ln]; Derivative[n_, 0][ln][x_, a_] := Derivative[n][Log][x] ln[x_, a_?NumericQ] := Piecewise[{{Log[x], Re[a] > 0}, {-Log[1/x], True}}] ln[x, -1/2] ...


8

Yes we can ! MapAt[Integrate[#, {x, -Infinity, Infinity}] &, f[x], 1] // PowerExpand (* n *) tt = f[x]^2 /. Power[Sum[a__, b__], 2] :> sum[a (a /. i -> j) // Release, b, b /. {i -> j}] MapAt[Integrate[#, {x, -Infinity, Infinity}] &, tt, 1] /. sum -> Sum // PowerExpand


8

The goal is not so clear for me, but probably something like this can be useful: test = MatchQ[#, HoldPattern[_. _^-1] | _Rational | HoldPattern[_ Rational[1, _]] ] & test /@ {a/b, 1/a, 1/5, a, .5, b/2} {True, True, True, False, False, True} Notice the dot in _., it is crucial for detecting 1/a since there is no Times really.


8

This will work with any number of independent integrants. Define: repl[l_] := # /. Thread[#[[All, 1]] -> Table[x, {Length[#]}]] &[l] inTfaC[int_] := Times @@ MapThread[Integrate[#1, #2] &, repl /@ {First[#], Rest[#]} &[ int /. {Integrate -> List, Times -> List}]] Now verify: test = Integrate[p[x] p[y] q[z] r[s] r[u], {x, ...


7

Here is a trick that allows you to get exactly what you're looking for: FourierTransform[ InverseFourierTransform[ x/y DiracDelta[x - y], x, k], k, x] DiracDelta[x - y] What I did here is to apply the Fourier transform and its inverse, which is of course the identity and therefore is equivalent to the original expression. But in doing so, ...


7

If we are willing to confine ourselves to functions like the example f which: is defined using DownValues only, and has no special attributes such as HoldAll, etc. ... then the following lifting function might be useful: ClearAll[stepper] SetAttributes[stepper, HoldAll] stepper[f_Symbol] := Module[{rules, g} , rules = Rule @@@ ...


7

The "trick" which works frequently when Mathematica refuses to calculate a definite integral is to calculate first the indefinite integral, then take the limits at the ends of the integration interval and subtract the results. Here we go. Let the integrand be f = -((cA Log[1 + mgl^2/sa1])/(-1 + x)) + (cA Log[-(sa1/(-mgl^2 - sa1))])/(1 - x) + (cA cF Log[-1 ...


6

It is not quite clear, what do you you want to get out of the answer. Would you like to compare Maple and Mma and understand, which one is better ? Or would you like to understand the alternative forms of taking this integral? Or the reason, why the results of Marple and Mma are different? Or transform the Mma result in terms of xand y? Or, ...


6

If I understand the goal of the question correctly, this is a possible application for the new Inactivate and Activate. Looking in particular at the documentation for Inactive, under "Applications," you'll find many situations that look similar to the one in this question. For example, you can enter a valid expression in the form Inactivate[(x y)^2] ...


6

I think this does what you want: Less @@ SortBy[Defer[Subscript[ω, #]] & /@ {1, 2, 11, 22}, N @@ # &]


6

This is not a full answer, just a start towards a solution. The culprit is Dispatch, which became atomic in version 10, and comparison wasn't implemented for it. Here's a small test in version 9: In[1]:= a = Dispatch[{"a" -> 1, "b" -> 2, "c" -> 3, "d" -> 4, "e" -> 5, "f" -> 6, "g" -> 7, "h" -> 8, "i" -> 9, "j" -> 10, ...


6

UnitConvert[Quantity[3, "PlanckConstant"], "ReducedPlanckConstant"] /. x_?NumericQ :> RootApproximant[x/Pi]*Pi Quantity[6*Pi, "ReducedPlanckConstant"]


6

This function lives in the system as Simplify`SimplifyCount.


6

(-1)^(1/3) (-Log[x])^(2/3) + Log[x]^(2/3) // FullSimplify[#, x > 1] & 0 Alternatively, using the real-valued cube root of x CubeRoot[-1] CubeRoot[(-Log[x])^2] + CubeRoot[Log[x]^2] 0 CubeRoot[-1] CubeRoot[-Log[x]]^2 + CubeRoot[Log[x]]^2 0


6

Update Based on Guesswhoitis. answer I have improved my ugly code and use his approach. Otherwise the format is as outlined in original answer. Manipulate[p = {-a, 0}; q = {0, b}; r = {c, 0}; s = mp[a, b, c]; nfb = RegionNearest[Circle[{0, 0}, b]]; nfc = RegionNearest[Circle[{0, 0}, c]]; res = VectorAngle @@@ Partition[Join[{{-a, 0}}, sc[#] & /@ ...


6

MyLine is embedded in 2D space, thus for $x\in\text{MyLine}$, x is a 2D point and Sin[x] just makes no sense. You probably meant the interval Interval[{-Pi,Pi}] instead, which I think should work. But it doesn't. I don't know why. Maybe a bug? In[27]:= MaxValue[Sin[x], x \[Element] Interval[{-Pi, Pi}]] During evaluation of In[27]:= MaxValue::objfs: The ...


5

I agree that it's a bit odd that Mathematica doesn't simplify these expressions with its built-in functions, especially in the symbolic tensor language (i.e. using TensorContract and TensorReduce). Nonetheless, we can teach it how to simplify the identity matrix ourselves. I've chosen to implement this for Dot, since that is what you initially asked. I do ...


5

Why do you think the result is obviously wrong? expr1 = (a + b t) Cos[n t]; int1 = Integrate[expr1, {t, t1, t2}] (1/(n^2))(-b Cos[n t1] + b Cos[n t2] + n (-(a + b t1) Sin[n t1] + (a + b t2) Sin[n t2])) The indefinite integral is int2 = Integrate[expr1, t] // Simplify (b Cos[n t] + n (a + b t) Sin[n t])/n^2 Calculating the definite ...


5

One way to approach this is to look for the source of the problem. In this case, the outer integral (on y) is irrelevant to the problem, because even the simpler integral int = Integrate[(1 + b x)/(1 + e x + I η), {x, -1/2, 1/2}, Assumptions -> {b ∈ Reals, c ∈ Reals, e ∈ Reals, η ∈ Reals, η != 0}] gives a conditional expression. But now the answer ...



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