Insights Blog
-- Browse All Articles --
Physics Articles
Physics Tutorials
Physics Guides
Physics FAQ
Math Articles
Math Tutorials
Math Guides
Math FAQ
Education Articles
Education Guides
Bio/Chem Articles
Technology Guides
Computer Science Tutorials
Forums
General Math
Calculus
Differential Equations
Topology and Analysis
Linear and Abstract Algebra
Differential Geometry
Set Theory, Logic, Probability, Statistics
MATLAB, Maple, Mathematica, LaTeX
Trending
Featured Threads
Log in
Register
What's new
Search
Search
Search titles only
By:
General Math
Calculus
Differential Equations
Topology and Analysis
Linear and Abstract Algebra
Differential Geometry
Set Theory, Logic, Probability, Statistics
MATLAB, Maple, Mathematica, LaTeX
Menu
Log in
Register
Navigation
More options
Contact us
Close Menu
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
"Do" loop with "If" conditional
Reply to thread
Message
[QUOTE="JorisL, post: 5478529, member: 340962"] With the export-to-file in mind I'd suggest creating the table as follows [code=Mathematica] data = Table[ If[ Y[z]>0 && Y[z]<1, {F[x,y,z], x, y, z}, 0 ], {x,1,2,1}, {y,-2,-1,1}, {z,3,5,1}] // DeleteCases[0]; [/code] Next you can use [URL='https://reference.wolfram.com/language/tutorial/ImportingAndExportingFiles.html']Export[ file, data, format][/URL]. Remark; [B]1.[/B] I'm not sure what would happen if you leave the else-case empty in the If[] statement. Perhaps it doesn't add an element or maybe a zero. I'm lazy so I went for a way that certainly works. [B]2. [/B]For ranges like ##\{x,1,2,1\}## you don't have to add the step size if it is one. Question; Is the function ##Y[z_]## always the same? Then you can simply solve the constraint and avoid it. Otherwise you could try to automate it by solving the inequalities and using the answer in the range. [/QUOTE]
Insert quotes…
Post reply
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
"Do" loop with "If" conditional
Back
Top