Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'For loop iteration' topicStudent Support Forum > General > "For loop iteration"

Next Comment >Help | Reply To Topic
Author Comment/Response
Subramanian
09/30/11 4:02pm

a = 106.5;
Pm = 7.75;
delV = 0.216;
se = 0;
delE = 0;
For[r = 0.3, r <= 95, r = r + 0.6
For[z = 0.3, z <= 40, z = z + 0.6
If[(SH[r, z]*Pm) > 0.83,
delE = SH[r, z]*delV;
se = se + delE;
]
]
]
Print[se];

SH[r,z] is a function of r and z and I need this loop to calculate the value of SH[r,z] for each (r,z) and if the condition in If is satisfied, go perform the other operations. I need the final output of se.

Now I am getting the result as 0. Why does the loop not run the way i want it to? CAn someone help?

Thanks

URL: ,

Subject (listing for 'For loop iteration')
Author Date Posted
For loop iteration Subramanian 09/30/11 4:02pm
Re: For loop iteration Forum Modera... 10/01/11 2:22pm
Re: For loop iteration Subramanian 10/01/11 2:52pm
Re: For loop iteration Patrick 10/02/11 1:59pm
Re: For loop iteration Subramanian 10/02/11 4:38pm
Re: For loop iteration Subramanian 10/04/11 01:01am
Next Comment >Help | Reply To Topic