- #1
Monaliza Smile
- 6
- 0
Hi,
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.
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.
Last edited: