Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'how to automatize a code' topicStudent Support Forum > General > "how to automatize a code"

Help | Reply To Topic
Author Comment/Response
paulo mauricio
06/27/10 2:29pm

How can I get a industrial amount of results, and not only one?

Clear["Global`*"]


k = 2; Put["phiout"]; Put["omegadiffout"];

Random[NormalDistribution[0, 0.1]];

For[i = 1, i < 31,
rnd[i] = Random[NormalDistribution[0, 0.1]]; i++]

Table[rnd[i], {i, 1, 30}]


Table[Table[rnd[i], {i, 1, 30}], {j, 1, 5}]

For[i = 1, i < 30,
rnddf[i] = rnd[i + 1] - rnd[i]; i++
]

diffomega = Table [rnddf[i], {i, 1, 29}];


Table[
Table [rnddf[i], {i, 1, 29}], {j, 1, 100}];

PutAppend[Table[
diffomega, {j, 1, 100}] , "diffomega"]


eqs0 = Table [
k*phi[i + 1] + k*phi[i - 1] - 2*k*phi[i] - rnddf[i] == 0, {i, 1,
28}];

eqs1 = eqs0 /. {phi[0] -> phi[30], phi[31] -> phi[1]};

Sum[phi[i], {i, 1, 29}];

eqs2 = Append[eqs1, - phi[1] - phi[27] - 3 phi[29] == 0];

eqs3 = eqs2 /. {phi[30] -> -Sum[phi[i], {i, 1, 29}]};

vars = Table [phi[i], {i, 1, 29}];

eqs = NSolve[eqs3, vars];

PutAppend[diffomega, eqs , "phiout"]

Attachment: problemazito.nb, URL: ,
Help | Reply To Topic