Problem with conditional statement in Mathematica

  • Context: Mathematica 
  • Thread starter Thread starter projektMayhem
  • Start date Start date
  • Tags Tags
    Conditional Mathematica
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 4K views
projektMayhem
Messages
4
Reaction score
1
I am trying to iterate a solution to a non-linear differential equation - but I am unable to evaluate a statement within a Do loop

Code:

Do[q = Cos[Evaluate[x'/.up]]; If[ q <= 1, Print[q], Print, Print[i^2]], {i, 0.1, 1, .1}]

x' is a solution to NDSolve

The output is i^2, which is absurd as q is necessarily <= 1.

In other words, it's not properly evaluating the conditional statement. I am lost as what to do with this, any help is greatly appreciated.

edit: I'm using Mathematica 5.0
 
Physics news on Phys.org
Nevermind, problem resolved.