Ask Your Question
0

solve and calculate

asked 2012-01-26 19:21:21 +0100

Mebus gravatar image

How can I solave an equation like x+z^2=1 and then calculate x with z=3 from the solution?

Thanks.

edit retag flag offensive close merge delete

Comments

If you think you have made a mistake in your question you can edit your question. Please do not post duplicate.

Shashank gravatar imageShashank ( 2012-01-26 19:58:28 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-01-26 19:56:53 +0100

Shashank gravatar image
z=var('z')
solve(x+z^2==1,x)[0].substitute(z==3)
edit flag offensive delete link more

Comments

This 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)

Mebus gravatar imageMebus ( 2012-01-27 03:31:40 +0100 )edit

This 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.

Mebus gravatar imageMebus ( 2012-01-27 03:31:40 +0100 )edit
1

answered 2012-01-27 01:25:54 +0100

A 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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-01-26 19:21:21 +0100

Seen: 941 times

Last updated: Jan 27 '12