mardi 19 juin 2018

If conditional with several statements in a table of Mathematica

How can I use the if statement in a Table of Mathematica with several instructions in the loop? For example the following instructions does not work: In theta = Pi/2, the right answer is a = 3 and b = 7, but Mathematica, with these instructions, gives a = 5, b = 6.

  v = Pi; 
  Table[ nom = {thetaiter, z[theta_] = theta; 
  If[Abs[z[theta] - v] < 0.1, {a = 5; b = 6}, {a = 3; b = 7}]; 
  z[thetaiter], a, b}, {thetaiter, Pi/2, Pi, Pi/2}]

Aucun commentaire:

Enregistrer un commentaire