First time here? Check out the FAQ!

Ask Your Question
3

Implicit differentiation displays extraneous x variable.

asked 11 years ago

bxdin gravatar image

updated 11 years ago

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

Preview: (hide)

4 Answers

Sort by » oldest newest most voted
2

answered 11 years ago

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?

Preview: (hide)
link
2

answered 11 years ago

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.

Preview: (hide)
link
1

answered 11 years ago

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)
Preview: (hide)
link
1

answered 11 years ago

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)
Preview: (hide)
link

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 ( 11 years ago )

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: 11 years ago

Seen: 2,370 times

Last updated: Aug 24 '13