Hot answers tagged

6

Everything you want in the question can be done by defining the derivative of the Norm: Derivative[1][Norm][z_] := z/Norm[z] D[Norm[x - y], {x}] (* ==> (x - y)/Norm[x - y] *) Simplify[D[Norm[x - y], {y}]] (* ==> (-x + y)/Norm[x - y] *) Here, the syntax I used for the derivatives is such that it would remain valid if x or y were replaced by vectors ...


5

You can do something like this: Simplify[Sqrt[x^2]] (* Sqrt[x^2] *) $Assumptions = _ ∈ Reals (* _ ∈ Reals *) Simplify[Sqrt[x^2]] (* Abs[x] *) This tells those functions that have an Assumptions option that any expression is considered real. Caveat: This refers to any expression, not just any variable! So you get this now: Simplify[Sqrt[x] ∈ Reals] (* ...


5

Here is code for a function bSolve which is to be used essentially like Solve. Given some equations as its first argument and some variables (or in fact more complicated expressions) as its second argument, it finds the values of the variables, eliminating all occurrences of p[...]. The probability of a is denoted by p[a] and the conditional probability of ...


4

We can get a long way by directly declaring that the symbols in question are NumericQ. For example, θ is normally treated as non-scalar: CircleDot[a, Times[θ, b]] (* CircleDot[a, Times[b, θ]] *) CircleDot[a, Times[Sin[θ], b]] (* CircleDot[a, Times[b, Sin[θ]]] *) NumericQ is a protected symbol, but its built-in definition still permits direct assignment (...


3

Try adding this to your existing definitions: (x_scalar a_)\[CircleDot]b_ := x (a\[CircleDot]b) This specifies a definition similar to your last one that only applies when the Head of $x$ is scalar, an auxiliary operator we introduce. Now, suppose that you want $t$ to be a scalar and $vec_i$ to be vectors: (scalar[t] vec1) \[CircleDot] vec2 (* Out: ...


3

This solution gets a trivial step away from the answer. (Strikeout after addressing the comments.) You can consider the difference diff = int - intpaper, and check that it vanishes. Rather than having Mathematica take the imaginary part, do it "by hand": intpaperz = 2/Sqrt[-1 - (Sqrt[-1 + Sqrt[3]] l - 2 I \[Tau])^2/(3 + Sqrt[3])]; intpaperzc = 2/Sqrt[-1 ...


2

My solution is in the experimental mathematics style: Series[int - intpaper, {τ, \[Infinity], 12}] // Normal // FullSimplify (* 0 *) You have to believe that if two series expansions are equal up to 12th order this is an identity. Advantage of the approach is its unbeatable simplicity. Of course, sceptics with faster computers can verify even higher ...


2

To some extent (and with some care) this can be done with FeynCalc. At least I used it several times when I needed to compute gradients and divergences of Cartesian vectors. The trick is to work with D-dimensional 4-vectors and take the limit $D \to 3$ at the end. Since FeynCalc doesn't distinguish between upper and lower indices, the results are the same as ...


1

You can create your own discrete probability distributions and then use built-in functions. The following uses this approach if the following are known: p(a),p(b},p(a|b). It can be adapted for other scenario. I present it as motivation. pr[pa_, pb_, pagb_] := Module[{s}, s = First@ Solve[{p00 + p10 + p01 + p11 == 1, p11 == pagb pb, p10 + p11 == ...



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