-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add differentiation to parserRoot, and improve parentheses in TeX output #267
Conversation
In And then if so, it appears based on the comment in the new code that the derivative is only taken with respect to the second variable. Is it doable to make
I'm hoping I differentiated that right. It might be a good precedent for functions in There is a puzzle here with how to handle differentiating
I don't need to use Separate observation: if you open this up again, it might be nice to have a flag that controls whether |
No, but it does have to be an integer, so it can be a formula as long as that formula only produces integers. The purpose of As you know, in general, |
That all sounds fair. I was also seeing this as a convenience for display purposes. So if I want to display a function to students as Would you mind adding a line to the documentation about the restrictions on |
I should probably add a check in the differentiation routine that |
My tests are all good. You can even use this to take a complicated derivative of x^2: |
I'm still thinking about Alex's comments, so wait for a bit. I'll probably make another commit with at least something that gives a warning if |
…properly for the case where the root is not constant
OK, I've patched the file so that the root can be a non-integer (where defined), and the derivative can be taken when the root is non-constant. So I think that covers the situations that you need. |
Works for me. It even marks you as incorrect if you answer 1/3 x^(-2/3) to the derivative of root(3,x) and says you have the wrong domain. I'm looking forward to explaining the difference between principle roots and real roots to someone who uses this :) (I had to look it up myself. For completeness: http://blog.wolframalpha.com/2013/04/26/get-real-with-wolframalpha-computing-roots/) |
Add differentiation to parserRoot, and improve parentheses in TeX output
This resolves issue #266 by adding the
D()
method needed for differentiation. To test it, useWithout the patch, the code will throw an error (
Differentiation of 'root' not implemented
), and with the patch, you should get the result0.25*[root(4,x)]^(-3)
.This patch also improves the TeX output so that parentheses are used when appropriate. To test this, use
With the patch, you should get
\left(\sqrt[3]{x}\right)^{2}
, but without it, you would get\sqrt[3]{x}^{2}
.