MathGroup Archive 2011

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

Search the Archive

Re: How to force numeric output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115658] Re: How to force numeric output
  • From: Peter Pein <petsie at dordos.net>
  • Date: Mon, 17 Jan 2011 05:41:59 -0500 (EST)
  • References: <igrqb1$qmq$1@smc.vnet.net> <iguirf$8tl$1@smc.vnet.net>

On 16.01.2011 11:55, KenR wrote:
> On Jan 15, 4:45 am, KenR<ramsey2... at msn.com>  wrote:
>> I am new to Mathematica and cant seem to get it to give a numeric
>> answer to
>>
>>   input    y = 5; x = floor[sqrt[y+1.0]]; x.
>>
>> instead of a numeric it gives "out floor[sqrt[6.0]]"
>>
>> what am I doing wrong?
>>
>> I have Mathematica 8.0
>>
>> Thankyou, Kenneth Ramsey
>
> I was looking at past posts and came upon a similar situation.  Thanks
> to those who e-mail me I am aware that the functions Floor and Sqrt
> must be capitalized.  It still apparently will not work because
> Mathematica does not know whether a positive or negative answer is
> desired.
>
> A similar situation was posted below where the sqrt of meter^2 etc was
> desired. A reader responded to write the code "Assuming[
> {Positive[Meter], Positive[Second]},
>    Refine[(Sqrt[Meter^2/Second^2] Second)/Meter^2]
>
> How would I invoke a similar solution to my case?
>
Sorry, this does not make sense to me.
You've got y=5 and z in z=Sqrt[y+1] is defined to be the positive 
solution of x^2=6 (in this case). So there are no assumption needed.
Maybe I misunderstand your question :(

Do you want both values Floor[+/-Sqrt[6]]?
With[{y = 5},
  x = Floor[z] /. Solve[z^2 == 1 + y, z]
  ]
will assign {-3,2} to x

Peter


  • Prev by Date: Re: How to force numeric output
  • Next by Date: InstallServices doesn't work for European Patent Office webservices
  • Previous by thread: Re: How to force numeric output
  • Next by thread: NSolve unable to find all possible roots