ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 27 Jan 2012 03:31:40 +0100solve and calculatehttps://ask.sagemath.org/question/8673/solve-and-calculate/How can I solave an equation like x+z^2=1 and then calculate x with z=3 from the solution?
Thanks.Thu, 26 Jan 2012 19:21:21 +0100https://ask.sagemath.org/question/8673/solve-and-calculate/Comment by Shashank for <p>How can I solave an equation like x+z^2=1 and then calculate x with z=3 from the solution?</p>
<p>Thanks.</p>
https://ask.sagemath.org/question/8673/solve-and-calculate/?comment=20414#post-id-20414If you think you have made a mistake in your question you can edit your question. Please do not post duplicate.Thu, 26 Jan 2012 19:58:28 +0100https://ask.sagemath.org/question/8673/solve-and-calculate/?comment=20414#post-id-20414Answer by Shashank for <p>How can I solave an equation like x+z^2=1 and then calculate x with z=3 from the solution?</p>
<p>Thanks.</p>
https://ask.sagemath.org/question/8673/solve-and-calculate/?answer=13198#post-id-13198 z=var('z')
solve(x+z^2==1,x)[0].substitute(z==3)Thu, 26 Jan 2012 19:56:53 +0100https://ask.sagemath.org/question/8673/solve-and-calculate/?answer=13198#post-id-13198Comment by Mebus for <pre><code>z=var('z')
solve(x+z^2==1,x)[0].substitute(z==3)
</code></pre>
https://ask.sagemath.org/question/8673/solve-and-calculate/?comment=20413#post-id-20413This works, but is there also a more comfortable way to write this:
solve(energiebilanz, h51x)[0].substitute(c_luft=12*m/s, mw=(1/3600)*kg/s, hw=146.68*J/g, TL=313*K)Fri, 27 Jan 2012 03:31:40 +0100https://ask.sagemath.org/question/8673/solve-and-calculate/?comment=20413#post-id-20413Comment by Mebus for <pre><code>z=var('z')
solve(x+z^2==1,x)[0].substitute(z==3)
</code></pre>
https://ask.sagemath.org/question/8673/solve-and-calculate/?comment=20412#post-id-20412This works, but is there also a more comfortable way to write this:
solve(energiebilanz, h51x)[0].substitute(c_luft=12*m/s, mw=(1/3600)*kg/s, hw=146.68*J/g, TL=313*K)
maybe like in a set of parameters?
Thanks.Fri, 27 Jan 2012 03:31:40 +0100https://ask.sagemath.org/question/8673/solve-and-calculate/?comment=20412#post-id-20412Answer by Laurent Claessens for <p>How can I solave an equation like x+z^2=1 and then calculate x with z=3 from the solution?</p>
<p>Thanks.</p>
https://ask.sagemath.org/question/8673/solve-and-calculate/?answer=13200#post-id-13200A variation on the Shashank'answer :
sage: z=var('z')
sage: f(z)=solve(x+z^2==1,x)[0].rhs()
sage: f
z |--> -z^2 + 1
sage: f.diff(z)
z |--> -2*z
sage: f.plot()
Here you consider the function "solution of the equation as function of z", and you do whatever with it.Fri, 27 Jan 2012 01:25:54 +0100https://ask.sagemath.org/question/8673/solve-and-calculate/?answer=13200#post-id-13200