Tag Info

New answers tagged


You really want to define the collection of vs when you produce a realization of vel, so I'd replace this with vel[n_] := Module[{}, Table[ v[k] = v[k - 1] + f[k - 1] + Random[NormalDistribution[0, s]], {k, 0, n}] ] This generates a new set of vs every time you call vel[]. (The bulk of this could be replaced by NestList[], but I'm not convinced ...


Suggested solution If I understood the question right, then the simplest solution here would probably be to define a helper function like the following: vv[n_] := Internal`InheritedBlock[{v}, v /@ Range[n]]; Then, you get vel = vv[m] and every run of vv would result in different set of values, while the values in the set will all come from the same ...


I like this (equivalent) one better: ClearAll[sd]; t = Transpose; sd@{} = 1; sd@m_:= sd@m= sd@t@m= m[[1,1]] /; Length@m == 1 sd@m_:= sd@m= sd@t@m= Sum[m[[1,j]] (-1)^(j + 1) sd@Drop[m,{1},{j}], {j, Length@m}]


This is how I would write it: sneakydeterminant[m_] := sneakydeterminant[m] = sneakydeterminant[Transpose[m]] = If[Length[m] == 1, m[[1, 1]]], Sum[Power[-1, j + 1] m[[1, j]] sneakydeterminant[ m[[Complement[Range[Length[m]], {1}], Complement[Range[Length[m]], {j}]]]], {j, 1, Length[m]}] The only difference is the ...

Top 50 recent answers are included