Got it. I'm a college chemistry professor, just terrible at math solvers :) 
I've found where I can find answers to those types of questions now. Thanks 
again!



On Friday, September 22, 2017 at 8:51:38 AM UTC-5, Emmanuel Charpentier 
wrote:

>
>
> Le vendredi 22 septembre 2017 15:42:40 UTC+2, Natalie Ulrich a écrit :
>>
>> That is extremely helpful. Many thanks, and have a beautiful day!
>>
>
> Thanks !
>
> Two notes :
>
>    1. This kind of question, which is more oriented at learning how to 
>    use Sage than at reporting a problem with it or suggesting a new 
>    development, is probably more useful when asked on ask.sagemath.org 
>    2. Most potential answerers, being scholars/teachers/etc.., are wary 
>    of "homework" questions, and won't answer them (maybe providing helpful 
>    hints). Giving the context of the question and showing what parts of the 
>    work you did yourself may help them choosing the right answer...
>
>
> HTH,
>
> --
> Emmanuel Charpentier
>
>
>>
>> On Friday, September 22, 2017 at 7:03:38 AM UTC-5, Emmanuel Charpentier 
>> wrote:
>>
>>> Even more Pythonish, and more direct (no conversions, Sage will take 
>>> care of the (hairy !) exact arithmetics)...) :
>>>
>>> [s for s in solve([eq1, eq2, eq3],[x, y, z], solution_dict=True) if 
>>> all(map(lambda t:bool(t>0), s.values()))]
>>>
>>> [{z: 1/200000*sqrt(2496889) - 83/200000,
>>>   y: 1/200000*sqrt(2496889) - 83/200000,
>>>   x: -1/200000*sqrt(2496889) + 15083/200000}]
>>>
>>> HTH,
>>>
>>> --
>>> Emmanuel Charpentier
>>>
>>> Le vendredi 22 septembre 2017 13:47:39 UTC+2, Emmanuel Charpentier a 
>>> écrit :
>>>>
>>>> Some may find my first answer a bit Lispish. More Pythonish :
>>>>
>>>> [[s.lhs()==s.rhs().n() for s in S] for S in 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]]
>>>>
>>>> HTH,
>>>>
>>>> --
>>>> Emmanuel Charpentier
>>>>
>>>> Le vendredi 22 septembre 2017 13:40:45 UTC+2, Emmanuel Charpentier a 
>>>> écrit :
>>>>>
>>>>> 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