Search NKS | Online
171 - 180 of 681 for Novo Curso De Direito Civil - Vol. 1 - Parte Geral - 26ª EdGagliano, Pablo StolzeSaraiva Jur
The magnetic energy of the system is taken to be
e[s_] := -1/2 Apply[Plus, s ListConvolve[ {{0, 1, 0}, {1, 0, 1}, {0, 1, 0}}, s, 2], {0, 1}]
so that each pair of adjacent spins contributes -1 when they are parallel and +1 when they are not. … One marginally more complicated case effectively involving 13 neighbors is
IsingEvolve[list_, t_Integer] := First[Nest[IsingStep, {list, Mask[list]}, t]]
IsingStep[{a_, mask_}] := {MapThread[ If[#2 2 && #3 1, 1 - #1, #1]&, {a, ListConvolve[ {{0, 1, 0}, {1, 0, 1}, {0, 1, 0}}, a, 2], mask}, 2], 1 - mask}
where
Mask[list_] := Array[Mod[#1 + #2, 2]&, Dimensions[list]]
is set up so that alternating checkerboards of cells are updated on successive steps.
… The transition occurs at e = - √ 2 , corresponding to p = (1 ± 2 -1/4 )/2 .
Dragon curve
The pattern shown here can be obtained in several related ways, including from numbers in base -1 (see below ) and from a doubled version of the paths generated by 1D paperfolding substitution systems (see page 892 ). Its boundary has fractal dimension 2 Log[2, Root[2 + # 2 - # 3 , 1]] ≃ 1.52 .
In d dimensions (2d)^DigitCount[t, 2, 1] cells are black at step t . The fractal dimension of the (d + 1) -dimensional structure formed from all black cells is Log[2, 1 + 2d] .
The 2D analog of rule 150 yields the patterns below; the fractal dimension of the structure in this case is Log[2, (1 + Sqrt[1 + 4/d]) d] .
For rational functions f[x] , Integrate[f[x], {x, 0, 1}] must always be a linear function of Log and ArcTan applied to algebraic numbers ( f[x] = 1/(1 + x 2 ) for example yields π /4 ). Multiple integrals of rational functions can be more complicated, as in
Integrate[1/(1 + x 2 + y 2 ), {x, 0, 1}, {y, 0, 1}] HypergeometricPFQ[{1/2, 1, 1}, {3/2, 3/2}, 1/9]/6 + 1/2 π ArcSinh[1] - Catalan
and presumably often cannot be expressed at all in terms of standard mathematical functions.
For equations of the form
∂ tt u[t, x] ∂ xx u[t, x] + f[u[t, x]]
one can set up a simple finite difference method by taking f in the form of pure function and creating from it a kernel with space step dx and time step dt :
PDEKernel[f_, {dx_, dt_}] := Compile[{a,b,c,d}, Evaluate[(2 b - d) + ((a + c - 2 b)/dx 2 + f[b]) dt 2 ]]
Iteration for n steps is then performed by
PDEEvolveList[ker_, {u0_, u1_}, n_] := Map[First, NestList[PDEStep[ker, #]&, {u0, u1}, n]]
PDEStep[ker_, {u1_, u2_}] := {u2, Apply[ker, Transpose[ {RotateLeft[u2], u2, RotateRight[u2], u1}], {1}]}
With this approach an approximation to the top example on page 165 can be obtained from
PDEEvolveList[PDEKernel[ (1 - # 2 )(1 + #)&, {.1, .05}], Transpose[ Table[{1, 1} N[Exp[-x 2 ]], {x, -20, 20, .1}]], 400]
For both this example and the middle one the results converge rapidly as dx decreases.
Block cellular automata
With a rule of the form {{1, 1} {1, 1}, {1, 0} {1, 0}, {0, 1} {0, 0}, {0, 0} {0, 1}} the evolution of a block cellular automaton with blocks of size n can be implemented using
BCAEvolveList[{n_Integer, rule_}, init_, t_] := FoldList[BCAStep[{n, rule}, #1, #2]&, init, Range[t]] /; Mod[Length[init], n] 0
BCAStep[{n_, rule_}, a_, d_] := RotateRight[ Flatten[Partition[RotateLeft[a, d], n]/.rule], d]
Starting with a single black cell, none of the k = 2 , n = 2 block cellular automata generate anything beyond simple nested patterns.
And as the pictures on the facing page indicate, for any curve like Sin[x] + Sin[ α x] the relative arrangements of these crossing points turn out to be related to the output of a generalized substitution system in which the rule at each step is obtained from a term in the continued fraction representation of ( α – 1)/( α + 1) .
The second multiway system generates only the n+1 strings where black comes before white—and all of these strings appear after at most 7n steps. The third multiway system generates a complicated collection of strings; the numbers of lengths up to 8 are 1, 2, 4, 8, 14, 22, 34, 45.
Implementation of totalistic cellular automata
To handle totalistic rules that involve k colors and nearest neighbors, one can add the definition
CAStep[TotalisticCARule[rule_List, 1], a_List] := rule 〚 -1 - (RotateLeft[a] + a + RotateRight[a]) 〛
to what was given on page 867 . The following definition also handles the more general case of r neighbors:
CAStep[TotalisticCARule[rule_List, r_Integer], a_List] := rule 〚 -1 - Sum[RotateLeft[a, i], {i, -r, r}] 〛
One can generate the representation of totalistic rules used by these functions from code numbers using
ToTotalisticCARule[num_Integer, k_Integer, r_Integer] :=
TotalisticCARule[IntegerDigits[num, k, 1 + (k - 1)(2r + 1)], r]
Properties [of example Turing machines]
The maximum numbers of steps increase with input size according to:
(a) 14 2^Floor[n/2] - 11 + 2Mod[n, 2]
(b) (does not halt for x = 1 )
(c) 2 n - 1
(d) (7(1 + Mod[n, 2])4^Floor[n/2] + 2Mod[n, 2] - 7)/3
(h) (see note below)
(i) (does not halt for various x > 53 )
(j) (does not halt for various x > 39 )
(k) (does not halt for x = 1 )
(l) 5 (2 n - 2 - 1)