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
How to Use If Statements Inside a Do Loop with Complex Numbers?
Reply to thread
Message
[QUOTE="Poirot, post: 5736869, member: 587460"] I have a Do loop running which, for some values will become complex, and I want to make it so for these situations, we take the negative root and for others the positive root. In this scenario, I've simplified what I actually have and chose to look at the case where I need it to take the negative root [Code] Do[e[o] = 0.5 + o, {o, 0, 10}] Do[If[Element[x[n, o] = (e[o] - n)^(1/2), Complexes], -[x[n, o]], x[n, o]], {n, -10, 10}, {o, -10, 10}] [/Code] I can't seem to get the syntax right here, and if I print a table with the results it's as if the If is just being ignored. Ideally, this would be the best approach for my problem as my actual code is quite complex and values in the Do loops are called upon, so I fear any other method will cause grief elsewhere. Thanks for any help! [/QUOTE]
Insert quotes…
Post reply
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
How to Use If Statements Inside a Do Loop with Complex Numbers?
Back
Top