Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I have a function defined by:

F[x_,y_,z_]:=3 x+y-2Y[z]

where

Y[z_]:=3/z

I'd like to run Do loop to calculate the value of this function for specific regions of x,y,z.

I can use:

Do[F[x,y,z],{x,1,2,1},{y,-2,-1,1},{z,3,5,1}],

But I have two questions here:

First: How to save the output in .dat file ? I 'd like to have something like:

F ##~~~~## x ##~~~~## y ##~~~~## z

Second: How Do loop can contain a conditional If, to put constrain on Y[z] -> 0 <Y[z] < 1, before evaluating F.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica "Do" loop with "If" conditional

Tags:

Have something to add?

Draft saved
Draft deleted

Loading...

Similar Threads for loop conditional |
---|

Mathematica Looping through vectorized functions for a piecewise solution |

Mathematica While Loop in Mathematica |

**Physics Forums | Science Articles, Homework Help, Discussion**