Re: small program in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg40893] Re: [mg40869] small program in Mathematica
- From: Bobby Treat <drmajorbob+MathGroup3528 at mailblocks.com>
- Date: Wed, 23 Apr 2003 01:18:11 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Your If statement has only two parameters -- a condition and the
CompoundExpression (expressions separated by semicolons) that's
executed if the condition is true. If it isn't true, the result is
Null (the missing or default third parameter). That's probably is
what's happening. It looks like "nothing" happening.
Bobby
-----Original Message-----
From: Rebeca Choy <rchoy at ula.ve>
To: mathgroup at smc.vnet.net
Subject: [mg40893] [mg40869] small program in Mathematica
Hi everybody,
I'm trying to do a small program in Mathematica with control functions,
but I have a problem with the if function.
The code is this:
If[
errort â?¤ 10.^(-6),
v = w - ((0.3)*(errot_deriv));
d2D = Table[
Sqrt[(w[[i, 1]] - w[[k, 1]])^2 + (w[[i, 2]] - w[[k, 2]])^2], {i,
26}, {k, 26}];
errort = (1/Sum[If[i < j, d3D[[i, j]], 0], {i, 26}, {j, 26}])*(Sum[
If[i < j, (((d3D[[i, j]] - d2D[[i, j]])^2)/(d3D[[i, j]])),
0],
{i,
26}, {j, 26}]);
errot_deriv = (-2/Sum[If[i < j, d3D[[i, j]], 0], {i, 26}, {j,
26}])*(Sum[
If[j â? p, ((d3D[[p, j]] - d2D[[p, j]])/(d2D[[p, j]]*
d3D[[p, j]]))*(w[[p, k]] - w[[j, k]]), 0], {p,
26}, {j,
26}, {k, 2}]);
m = m + 1;
Print[m];
Print[v]
]
Everything is previously declared, but it doesn't give any answers. The
program is supposed to check if a certain error is under a value and
if
it isn't it should re-calculate a matrix else it should print it.
Is it good? or what else can i do?
Thanks,
Rebeca Choy