Tag Info

Hot answers tagged

9

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


5

We will go by solving one equation at a time and generating the corresponding replacement rules. Beware of possible numerical instabilities. The following is the equivalence between the code in your edited example and my code on the previous incarnation of this answer. I think this is enough for you to use it. Please note that the only claim on the ...


3

How about: av = Array[Subscript[a, ##] &, {2}]; bv = Array[Subscript[b, ##] &, {2}]; KroneckerProduct[av, bv] + KroneckerProduct[-av, bv] {{0, 0}, {0, 0}}


3

Perhaps what you are looking for is: A = {{2, -1, 0}, {-1, 2, -1}, {0, -1, 1}}; Integrate[Exp[(-x . A . x)/2], x ∈ FullRegion[3]] 2 Sqrt[2] π^(3/2)


2

If I understand the question properly, you would like to differentiate the expression f = Sum[c[k] Exp[-(a - t[k])^2], {k, kmax}] with respect to t[n], where n is an integer between 1 and kmax, to obtain (* 2 E^-(a - t[n])^2 c[n] (a - t[n]) *) Almost certainly, a similar question has been raised before, but I cannot find it now. In any case, the ...


2

As noted, what you want is to use a Gröbner basis to eliminate the parameter: curve = 2 {t (3 t^4 + 50 t^2 - 33), 7 t^6 - 60 t^4 + 15 t^2 + 2}/(t^2 + 1)^3; implicit = GroebnerBasis[Thread[{x, y} == curve], {x, y}, t] // First 550731776 - 41620992 x^2 + 585816 x^4 + 625 x^6 - 182250 x^4 y - 41620992 y^2 + 1171632 x^2 y^2 + 1875 x^4 y^2 + 364500 x^2 y^3 ...


2

Okay, sometimes you get so involved in an idea that you don't realize how foolish it is. I was fooled or seduced by the simplicity of the Chebyshev expansion. Basically, my original answer was a complicated way to do this: cosEq = 64 x^7 - 112 x^5 - 8 x^4 + 56 x^3 + 8 x^2 - 7 x - 1 /. x -> Cos[Pi t] //TrigToExp; t /. Solve[cosEq == 0 && 0 <= ...


1

Second update -- I should state in simplest terms the issue the OP is facing. The set-up. The equations for a given a are eqs = Table[Power[Sqrt[λ2/(μ2 c2)], n] p[0, n + 1] == β[n] p[0, 0] + Sum[α[n, k] p[0, k], {k, 0, a}] /. NumVal, {n, 0, a - 1}]; All the variables involved in eqs are given by vars = Table[p[0, n], {n, 0, a}]; (* starts ...


1

As a recurrence: ComputePoly[{}] := 1; ComputePoly[{0}] := x1 ComputePoly[{1}] := x2 ComputePoly[l_List] := ComputePoly[l[[1 ;; 1]]]*ComputePoly[Rest@l] ComputePoly[{0, 1, 0, 1, 1, 1, 1}] (* x1^2 x2^5 *) Of course different recurrence relationships need different implementations. As you don't mention your actual one it's very difficult to provide more ...


1

I slightly modified the set partition code from the book Computational Discrete Mathematics by Pemmaraju and Skiena. kSetPartitions[{}, 0] := {{}} kSetPartitions[s_List, 0] := {} kSetPartitions[s_List, k_Integer] := {} /; (k > Length[s]) kSetPartitions[s_List, k_Integer] := {Map[{#} &, s]} /; (k === Length[s]) kSetPartitions[s_List, k_Integer] := ...


1

Just another way to calculate volume of hypersphere and then relevant probability using recursion: vs[n_] := Most@Nest[{#[[2]]/(#[[3]] + 1), 2 Pi #[[1]], #[[3]] + 1} &, {1, 2, 0}, n] v[n_] := vs[n][[1]] The probabilities: Grid[Prepend[{#1, #2, N@#2} & @@@ ({#, v[#]/2^#} & /@ Range[10]), Style[#, Bold] & /@ {"n", ...



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