New answers tagged

0

Use //Together//Numerator to get result in 0.047 seconds. T2 = {{n2x, o2x, a2x, p2x}, {n2y, o2y, a2y, p2y}, {n2z, o2z, a2z, p2z}, {0, 0, 0, 1}}; T3 = {{n3x, o3x, a3x, p3x}, {n3y, o3y, a3y, p3y}, {n3z, o3z, a3z, p3z}, {0, 0, 0, 1}}; Rp = {px, py, pz, 1}; eq1 = (IdentityMatrix[4] - T2.Inverse[T3]).Rp; ff = (# // Together // Numerator // Simplify &) /@ ...


1

With a 6-processor, 16 GB PC and $Version (* 12.3.1 for Microsoft Windows (64-bit) (June 19, 2021) *) I can perform the integral in about seven minutes (AbsoluteTiming). The result is too large (LeafCount of 1854) to reproduce here, so I provide only the integral of one of the 46 terms in the integrand. Rationalize[Expand[a1][[29]], 0] (* (1514341 (-((-(...


1

c[x] is not possible because MMA may need several constants and these are written: c[1], c[2].. However, you may indicate that the constant depends on x by using GeneratedParameters -> C[x] what will result in: c[x][1] what is displayed as e.g. with your example: u[x_, y_] := 4 x^4 + 6 x y - 24 x^2 y^2 + 4 y^4 Integrate[\!\( \*SubscriptBox[\(\[PartialD]\...


4

Beside following the good advice Rohit Namjoshi has given in a comment, you need to become aware that pattern matching against Plusand Times is tricky because these operators have attributes (special rules) that cause strange things to happen when the patterns containing them are evaluated. Consider the following: You don't want MatchQ[Plus[a, b, foo[x, y]], ...


3

I don't think your table is necessarily incorrect, but I don't think it's the best way to think about it. In Mathematica, everything is an expression (see the linked tutorial for more details). Every1 expression is one of two things: Atomic: Things like numbers, symbols, etc. AtomQ[expr] returns True, and the head is not necessarily "part" of the ...


3

I would suggest to use Piecewise instead, which is designed for functions that take different values depending on some condition (it also plays nicer with a large part of the symbolic functionality of Mathematica). You can either use PiecewiseExpand to convert the If: f[x1] = a; f[x2] = b; g[y_] := If[y > 0, f[x1], f[x2]]; PiecewiseExpand@g[y] (* ...


3

It turns out that one solution is to use the Evaluate[] function, as in the following: f[x1] = a; f[x2] = b; g[y_] := If[y > 0, Evaluate[f[x1]], Evaluate[f[x2]]]; This achieves the desired outcome.


Top 50 recent answers are included