Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: cannot work a "conditional If"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130572] Re: cannot work a "conditional If"
  • From: Peter Pein <petsie at dordos.net>
  • Date: Tue, 23 Apr 2013 00:02:24 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <kl2nvh$2dg$1@smc.vnet.net>

Am 22.04.2013 09:13, schrieb patrice.haldemann at gmail.com:
> Hi everybody
> 
> I am a newcomer in the mathematica world and I have been facing an issue for some days.
> 
> I have used mathematica to solve an NDSolve and it has worked well
> 
> I have tested  expressions with the solution of NDSolve and its has worked well.
> 
> Now if I use an expression in an "Conditional If", it does not work. 
> 
> Thank you for your help
> 
> 
> See below
> 
> signy[t_] := y[t] /. orbit   where y[t] is the solution of the NDSolve
> 
> signy[1]
> 
> {-1.96861}
> 
>  ang12[t_] := If[signy[t] > 3, 10, 6]
> 
>  ang12[1]
> 
> If[{-1.96861} > 3, 10, 6]
> 
> 
>  
> 

Hi Patrice,

 You might have noticed the curly braces around the computed value.
Your function signy returns a list with one element, not a value.

signy[t_] := y[t] /. First[orbit]

should work.

Peter




  • Prev by Date: Re: Re: Mathematica integration Vs Sympy
  • Next by Date: Re: Speak errors (was Re: audio)
  • Previous by thread: Re: cannot work a "conditional If"
  • Next by thread: Re: cannot work a "conditional If"