You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.
nerdamer.diff("x * sqrt(y)","x") function returning incorrect expression during partial differentiation if the constant term in the equation (in this case sqrt(y)) is under square root
#675
Open
sg13041995 opened this issue
Aug 19, 2022
· 1 comment
So, I have conducted multiple tests and found out that, this issue is occurring if,
"The constant term during partial differentiation, in the equation or function is under square-root"
Example:
f(x,y) = the expression = y * sqrt(x)
f(x,y) = the expression = y / sqrt(x)
In this case if we try nerdamer.diff("y * sqrt(x)","y") or nerdamer.diff("y/sqrt(x)","y") where sqrt(x) is a constant, then output is coming wrong.
But it perfectly works if nerdamer.diff("y*sqrt(x)","x") where y is constant now and we are differentiating w.r.t x.
It will again throw wrong out put => 0.5*sqrt(x^0.5)*y^(-0.5) if we try nerdamer.diff("sqrt(y)*sqrt(x)", "y") as sqrt(x) in the equation was a constant in the context of the partial differentiation.
The major mistake is in the output equation that I have observed is, where it should throw sqrt(x) it is throwing sqrt(x^0.5).
The text was updated successfully, but these errors were encountered:
In my vector field plotter and curl divergence calculator project I have applied a get around to make things work.
In my curl equation where we do (dq/dx - dp/dy) I know that in in q expression any y term will going to be constant and in p expression the x term.
So, if we have any y term under square root in q expression , I replaced that with Q. So, now in the q equation, in the place of sqrt(y) there will be Q. Now, nerdamer can handle it properly and treat it as proper constant.
After the solution, I have converted Q back into sqrt(y).
I did the same for p expression and also for the divergence equation separately.
Things are working fine for me now.
You can check my code as well.
divergence(), curl() functions in mainsketch.js under the provided commit.
nerdamer.diff("y * sqrt(x)","y") returns => (sqrt(x^0.5));
But is should return (sqrt(x)) or (x)^0.5
So, I have conducted multiple tests and found out that, this issue is occurring if,
"The constant term during partial differentiation, in the equation or function is under square-root"
Example:
f(x,y) = the expression = y * sqrt(x)
f(x,y) = the expression = y / sqrt(x)
In this case if we try nerdamer.diff("y * sqrt(x)","y") or nerdamer.diff("y/sqrt(x)","y") where sqrt(x) is a constant, then output is coming wrong.
But it perfectly works if nerdamer.diff("y*sqrt(x)","x") where y is constant now and we are differentiating w.r.t x.
It will again throw wrong out put => 0.5*sqrt(x^0.5)*y^(-0.5) if we try nerdamer.diff("sqrt(y)*sqrt(x)", "y") as sqrt(x) in the equation was a constant in the context of the partial differentiation.
The major mistake is in the output equation that I have observed is, where it should throw sqrt(x) it is throwing sqrt(x^0.5).
The text was updated successfully, but these errors were encountered: