Tag Info

Hot answers tagged

6

As already explained, this happens because MatrixForm act as a wrapper. The answer to the question about how this behavior is implemented and how can eventually be reproduced is contained in the Informmation of the system symbol $OutputForms. Indeed ?? $OutputForms returns: $OutputForms is a list of the formatting functions that get stripped off ...


3

SeedRandom[42]; m1 = .5; m2 = 0; m3 = 0; m4 = .5; n1 = .5; n2 = 0; n3 = 0; n4 = .5; k1 = .5; k2 = 0; k3 = 0; k4 = .5; F = {({{m1, m2}, {m3, m4}}.# + {0, 0}) &, {{n1, n2}, {n3, n4}}.# + {1/2, Sqrt[3]/2} &, {{k1, k2}, {k3, k4}}.# + {1, 0} &}; ListPlot@NestList[RandomChoice[F][#] &, {1, 1}, 1000]


2

I realize I am basically asking "how to handle custom objects", but I thought giving the context would make it easier to point me in the right direction. It seems that you are. I believe the most natural way to do that in Mathematica is to use a custom head. I'll use obj for my examples. First you might define a pattern for your custom object: p0 = ...


1

RotationMatrix is not Listable Attributes[RotationMatrix] (* {Protected, ReadProtected} *) So you have to use Map (or Table) here matList = RotationMatrix /@ t (* {{{1, 0}, {0, 1}}, {{Cos[1], -Sin[1]}, {Sin[1], Cos[1]}}, ...} *) You can define custom listable function like this r[t_] := RotationMatrix[t] SetAttributes[r, Listable] r[t] (* {{{1, 0}, ...


1

Position by default looks at all parts of the expression, including those that do not have sub-parts to extract. You can use levelspec and the Option Heads to restrict what it tests: Position[{{1, 2, 3}, {2, 3, 4}}, _?(#[[1 ;; 2]] == {1, 2} &), {1}, Heads -> False] {{1}} More generally you can simply use a pattern like this: Position[{{1, 2, ...


1

The Gamma function has a property that $ \Gamma(x+1)=x*\Gamma(x) $ So in the result that Mathematica returns $ \sqrt{\frac{\Gamma(n-m+1)\Gamma(n+m+2)}{\Gamma(n-m)\Gamma(n+m+1)}} = \sqrt{\frac{\Gamma(n-m+1)}{\Gamma(n-m)}}\times\sqrt{\frac{\Gamma(n+m+2)}{\Gamma(n+m+1)}} = \sqrt{(n-m)(n+m+1)}$ which is exactly the result shown in the website.



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