Ah, I see. Thank you.

On Friday, September 22, 2017 at 9:38:43 AM UTC-5, Dima Pasechnik wrote:

>
>
> On Friday, September 22, 2017 at 12:44:50 PM UTC+1, Natalie Ulrich wrote:
>>
>> So.. is all of that just converting all the crazy square roots into 
>> rational numbers? Thanks for your help!
>>
>
> more precisely, it provided approximations of the crazy roots by floating 
> point numbers.
> (most square roots cannot be exactly represented by rational numbers, e.g. 
> sqrt(2) already cannot...)
>  
>
>>
>>
>> On Friday, September 22, 2017 at 6:40:45 AM UTC-5, Emmanuel Charpentier 
>> wrote:
>>
>>> what's wrong with :
>>>
>>> map(lambda S:map(lambda s:s.lhs()==s.rhs().n(), S), solve([eq1, eq2, 
>>> eq3], [x, y, z]))
>>>
>>> [[x == 0.0675142263037092, y == 0.00748577369629076, z == 
>>> 0.00748577369629076],
>>>  [x == 0.0833157736962908,  y == -0.00831577369629076,  z == 
>>> -0.00831577369629076]]
>>>
>>> Which shows that the first solution fulfills your constraints ?
>>>
>>> HTH,
>>>
>>> --
>>> Emmanuel Charpentier
>>>
>>> Le jeudi 21 septembre 2017 20:27:43 UTC+2, Natalie Ulrich a écrit :
>>>>
>>>> I'm using SageMathCell to solve chemical equilibrium problems, so at 
>>>> least one set of my solutions has to be real and positive. 
>>>>
>>>> Here's my code: 
>>>>
>>>> var('x, y, z')
>>>>
>>>> xi=0
>>>>
>>>> yi=0.150/2.0
>>>>
>>>> zi=0.150/2.0
>>>>
>>>> K=8.3e-4
>>>>
>>>> eq1=K == y*z/ x
>>>>
>>>> eq2=xi+yi==x+y 
>>>>
>>>> eq3=2*xi+2*zi==2*x+2*z
>>>>
>>>> solve([eq1, eq2, eq3],[x, y, z])
>>>>
>>>>  
>>>>
>>>> And here are my solutions:
>>>>
>>>> [[x == -1/200000*sqrt(2496889) + 15083/200000, y == 
>>>> 1/200000*sqrt(2496889) - 83/200000, z == 1/200000*sqrt(2496889) - 
>>>> 83/200000], [x == 1/200000*sqrt(2496889) + 15083/200000, y == 
>>>> -1/200000*sqrt(2496889) - 83/200000, z == -1/200000*sqrt(2496889) - 83/
>>>> 200000]]
>>>> ------------------------------
>>>>
>>>>
>>>> Any thoughts? Thanks in advance.
>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to