Ask Your Question
3

Implicit differentiation displays extraneous x variable.

asked 2013-07-28 10:34:47 +0200

bxdin gravatar image

updated 2013-07-28 23:38:14 +0200

calc314 gravatar image

The problem is, given y = 9*x^(1/2) - 2*y^(3/5), find dy/dx The answer is supposed to be dy/dx = ( 45*y^(2/5) ) / ( 10*x^(1/2)*y^(2/5)+12*x^(1/2) )

When I enter the following syntax, there is an extraneous character, (x), displayed:

y=function('y',x)
temp=diff(9*x^(1/2) - 2*y^(3/5) - y)
solve (temp,diff(y))
show(solve (temp,diff(y)))

Is it possible to display the answer without showing (x)?

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
2

answered 2013-07-31 17:52:35 +0200

kcrisman gravatar image

I'm not seeing this. Indeed,

sage: latex(solve (temp,diff(y)))
\left[D[0]\left(y\right)\left(x\right) = \frac{45 \, y\left(x\right)^{\frac{2}{5}}}{2 \, {\left(5 \, \sqrt{x} y\left(x\right)^{\frac{2}{5}} + 6 \, \sqrt{x}\right)}}\right]

which shouldn't have this.

Unless you're referring to the D[0](y)(x) with the (x) part? But remember, you defined y to be a function of x. So solving for diff(y) will still solve for it in this sense. You can't (in Sage) ask for the "type" of a symbolic function to change like that. At least, I think that might be what you are referring to?

edit flag offensive delete link more
2

answered 2013-08-01 14:13:31 +0200

Eviatar Bach gravatar image

There is a way to change the LaTeX representation of functions, but unfortunately it doesn't survive the trip back from Maxima:

sage: y = function('y', x, print_latex_func=lambda x, args: 'y')
sage: latex(y(x))
y
sage: latex(solve(y, x)[0].lhs())
y\left(x\right)

This should be fixed, although it's probably not trivial to do so.

edit flag offensive delete link more
1

answered 2013-07-31 22:37:59 +0200

slelievre gravatar image

When you do:

sage: y = function('y',x)
sage: temp = diff(9*x^(1/2) - 2*y^(3/5) - y)
sage: a = solve(temp,diff(y)); a
[D[0](y)(x) == 45/2*y(x)^(2/5)/(5*sqrt(x)*y(x)^(2/5) + 6*sqrt(x))]

You see that the result is a list containing one equality.

If I understand correctly you would like to have just "y" instead of "y(x)" in the equation. Probably on the left-hand side you also want to get rid of the "(x)", and let's also have "y'" instead of "D[0](y)".

Since you're interested in the displayed result, there are two ways we could go.

One is to try to manipulate the expression itself. It's possible to explore the equation and get to all the individual pieces, but replacing "y(x)" by "y" in the symbolic expression is going to be too hard: even when you just ask for "y", you get "y(x)".

sage: y
y(x)

The second option is to just work on the string. Here is what I would do.

For the left-hand side it's easier to just input y' by hand, and let's throw in the equal sign.

sage: sa = 'y\' = '

Then we can work on the right-hand side.

sage: b = a[0].rhs(); b
45/2*y(x)^(2/5)/(5*sqrt(x)*y(x)^(2/5) + 6*sqrt(x))

Get the latex string.

sage: c = str(latex(b)); c
'\\frac{45 \\, y\\left(x\\right)^{\\frac{2}{5}}}{2 \\, ...'

Now replace.

sage: sb = c.replace('y\\left(x\\right)','y'); sb
'\\frac{45 \\, y^{\\frac{2}{5}}}{2 \\, ...'

Put things together, make it into a latex expression again, and display.

sage: aa = LatexExpr(sa+sb); aa
sage: show(aa)
edit flag offensive delete link more
1

answered 2013-08-24 20:55:47 +0200

viejolitico gravatar image

Try this:

sage: g=function('g',x)
sage: var('y')
sage: temp=diff(9*x^(1/2) - 2*g^(3/5) - g)
sage: pretty=solve(temp,diff(g))[0].right().subs({g(x):y})
sage: show(pretty)
edit flag offensive delete link more

Comments

Two things: You may want to define 'gx=function('g',x)' to keep the difference between the expression 'g(x)' and the bare function 'g' (both get defined by the statement above) Also, you may want to write '.subs({gx:y})' which doesn't trigger the deprecation warning your original code does.

nbruin gravatar imagenbruin ( 2013-08-25 13:21:58 +0200 )edit

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: 2013-07-28 10:34:47 +0200

Seen: 2,227 times

Last updated: Aug 24 '13