# Tag Info

39

In the first case PowerExpand comes to the rescue: PowerExpand@Power[p^(n m) q, 1/n] (* Out: p^m q^(1/n) *) Note however that "the transformations made by PowerExpand are correct only if $c$ is an integer or $a$ and $b$ are positive real numbers". Generally speaking, your assumptions can be listed in Reduce, Simplify, or FullSimplify using the ...

26

Feedback in form of tests and suggestions very appreciated! Usage: dChange[expresion, {transformations}, {oldVars}, {newVars}, {functions}] dChange[expresion, "Coordinates1"->"Coordinates2", ...] (***NEW***) dChange[expresion, {functionsSubstitutions}] You can also skip {} if a list has only one element. Examples: Change of coordinates ...

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

22

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

17

I can't help you with functions beyond Reduce, Simplify, ... but I can offer you a tip to help with reducing errors from manual translation. In order to validate that your manual transformation is correct, one can subtract the original expression from the manual transformation and then use Simplify on that expression. Sometimes it will return zero using ...

16

I believe there are at least three cases treated separately by Derivative. 1) A function defined by a Symbol. This follows the the rule cited in the documentation. g[x___] := f[x]; Derivative[1][g][x] // Trace (* { { g' , { g[#1] <-- Here the rule is being applied , f[#1] } , f'[#1] & } , (f'[#1] &)[x] , f'[x] } ...

15

One thing is to make sure you have all the assumptions stated properly. For instance, the first two cases can be handled by passing all the assumptions to FullSimplify FullSimplify[Power[p^(n m) q, 1/n], Assumptions -> {q > 0, p > 0, n ∈ Integers, m ∈ Integers}] p^m q^(1/n) and FullSimplify[(p^n q)/(p^m r), Assumptions -> {q > 0, p ...

15

I use Mathematica in much the same way as you, although in the context of multi-stage physics derivations. Since no one has mentioned it, I'll describe an obvious approach to successive rewrites of an expression. I label each step a calculation with an indexed symbol that I can refer to later. This is preferable to In's and Out's whose numbers can change if ...

11

I often find that Simplify, etc work better when applied to parts of an expression. As I mentioned in this post, using something like Collect[expression, {selectedvariables}, Simplify[#, options -> values]& ] can work well in this respect. More generally, if you wish to simplify a particular Part, try expression[[index]] = ...

11

I think the reason, at least primarily, that it works differently for Plus is the following from its documentation: Unlike other functions, Plus applies built-in rules before user-defined ones. It may seem a little obscure, because perhaps we don't know all the rules, but these two are mentioned explicitly: Plus[] is taken to be 0. ...

10

There is another option, using the relatively new tensor capabilities of Mathematica. This is pretty much copied from another answer by jose, but I don't need any assumptions here: TensorExpand[KroneckerProduct[X, X] + KroneckerProduct[-X, X]] (* ==> 0 *) TensorExpand[KroneckerProduct[2 X, 3 Y]] (* ==> 6 KroneckerProduct[X, Y] *) There is a ...

10

To elaborate a bit on Michael's comment, let's first consider this statement from the docs: Sum and Product use over 100 pages of Wolfram Language code. Executing ?Sum* will in fact show you some of the internal routines used behind the scenes by the function Sum[]. You, the regular user, are not usually intended to access these by yourself; however, ...

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

9

Consider Derivative[1][f[##] &] // FullForm Function[0] Function[0][x] 0 So the snippet you quote from the docs might not be entirely accurate; might not be considering such an edge case as ##. I believe that Derivative is looking for head Slot when detects a pure function goes on to rewrite it, so it ignores head SlotSequence -- i.e., ...

9

Update, December 22 I've developed a version that is more robust. I believe it should work in general, but I'm sure there are some corner cases that won't work (and probably some-not-so-corner cases too). As before we add rules to the almost-no-built-in-meaning NonCommutativeMultiply (**): Clear[ncm] ncm[a__] := NonCommutativeMultiply[a] ...

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

8

One way to avoid the singularity in 0-th coefficient is to regularize the original function. The problem is due to it being a polynomial, which is why we get powers of n in denominator by partial integration - the procedure that is obviously failing for the 0-th harmonic. Obviously this is a shortcoming for the current way Mathematica computes Fourier ...

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

7

I'm just going to walk through all of it. If something is too pedantic, skip it. Module[{f,g}... creates a scoping construct so the definitions of f and g are local to this code. Tally[a] produces a list of all the elements in a and a count for each element. For instance, Tally[{a,a,b,c,a,d,d}] would give {{a,3},{b,1},{c,1},{d,2}}. The strange ...

7

As a workaround you can generate a sequence and use FindSequenceFunction max = 10; seq = Sum[StirlingS2[i, 2], {i, 0, #}] & /@ Range[max] (* {0, 1, 4, 11, 26, 57, 120, 247, 502, 1013} *) f[n_] = FindSequenceFunction[seq][n] // Simplify (* -1 + 2^n - n *) seq === (f /@ Range[max]) (* True *)

7

The null space is going to be a very large matrix. I'll show how to generate the space of nonnull vectors (I think that might be called the coimage or something like that). I will demonstrate this method for dimensions 56 by 1000 (56 because that's how many xyz monomials there are through degree 5). deg = 5; monoms = Union[ Flatten[Outer[Times, Sequence ...

7

Simplify[a^2 + a*b^2 + b, b^2 == c - a] (* b + a c *) Or a^2 + a*b^2 + b /. b^2 -> c - a // Simplify (* b + a c *)

6

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

6

This function lives in the system as SimplifySimplifyCount.

6

As is well known, and has been discussed extensively in this forum, there may be problems in general with Integrate[] and the fundamental theorem of calculus, mostly due to discontinuities or other singularities in the antiderivative. But not in this case for version 8: $Version (* Out[1]= "8.0 for Microsoft Windows (64-bit) (October 7, 2011)" *) The ... 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 J.M.'s answer, I have improved my ugly code and used 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[#] & /@ ({u, ... 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 ...

6

Since Mathematica 10, there is the TypeSystem Context, that is nearly what you might be looking for. It is just a wrapper around patterns. TypeSystemConformsQ[ {1, 2, 3}, TypeSystemVector[TypeSystemIntegerT, 3] ] (* --> True *) It is the thing being used internally by Dataset-related functions. (Maybe one should say something like Dataset[{}] ...

5

The first result can be obtained using Dirichlet regularization: Sum[n, {n, 1, Infinity}, Regularization -> "Dirichlet"] -(1/12) The second can not be obtained, though. I don't have enough smarts to know if this is because it would actually require different regularization, or that Mma just doesn't know how to handle this case.

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