Am Dienstag, den 07.07.2009, 20:44 -0500 schrieb Barton Willis:
> This sounds like a good idea. Does your sdiffgrad extension handle mixed
> derivatives
> such as diff(gamma_incomplete(a^2,x^42),a,2,x) OK?
>
Thank you very much for your comment. You are right, there is a problem.
In principle it works, but the results are not as simple as expected in
all cases.
First a simple and correct result:
(%i6) diff(gamma_incomplete(a,x),x,1,a,1);
(%o6) -x^(a-1)*%e^-x*log(x)
We change the order of the derivation. Because in a first step the
derivative wrt a is applied, a noun form is generated (The sign of a is
unknown). We get the fully simplified result only after applying a
second evaluation:
(%i7) diff(gamma_incomplete(a,x),a,1,x,1);
(%o7) 'diff(-x^(a-1)*%e^-x,a,1)
(%i8) %,nouns;
(%o8) -x^(a-1)*%e^-x*log(x)
In this case the sign of the argument is positive. Now the derivative
wrt a is known to Maxima. The result looks much more complicated and
depends on the order of the derivation. Mathematically, both results
should be equivalent:
(%i9) diff(gamma_incomplete(a^2,x),x,1,a,1);
(%o9) -2*a*x^(a^2-1)*%e^-x*log(x)
(%i10) diff(gamma_incomplete(a^2,x),a,1,x,1);
(%o10) 2*a
*(-x^(a^2-1)*%e^-x*log(x)+gamma(a^2)^2
*'diff(
hypergeometric_regularized(
[a^2,a^2],[a^2+1,a^2+1],-x),x,1)*x^a^2
+a^2*gamma(a^2)^2
*hypergeometric_regularized(
[a^2,a^2],[a^2+1,a^2+1],-x)*x^(a^2-1)
-(gamma(a^2)-gamma_incomplete(a^2,x))/x)
Again an example, when the sign of a is unknown:
(%i11) diff(gamma_incomplete(a^3,x),x,1,a,1);
(%o11) -3*a^2*x^(a^3-1)*%e^-x*log(x)
(%i12) diff(gamma_incomplete(a^3,x),a,1,x,1);
(%o12) 'diff(-x^(a^3-1)*%e^-x,a,1)
(%i13) %,nouns;
(%o13) -3*a^2*x^(a^3-1)*%e^-x*log(x)
Now your example:
(%i17) diff(gamma_incomplete(a^2,x^42),a,2,x,1);
(%o17) 2*a
*(3528*a^3*gamma(a^2)^2
*hypergeometric_regularized([a^2,a^2],[a^2+1,a^2+1],-x^42)
*abs(x)^(42*a^2)*log(abs(x))
/x
+84*a*gamma(a^2)^2
*'diff(hypergeometric_regularized([a^2,a^2],[a^2+1,a^2
+1],-x^42),
x,1)*abs(x)^(42*a^2)*log(abs(x))
-42*(2*a*psi[0](a^2)*gamma(a^2)
-2*a
*(gamma(a^2)^2*hypergeometric_regularized(
[a^2,a^2],[a^2+1,a^2
+1],-x^42)*abs(x)^(42*a^2)
-42*(gamma(a^2)-gamma_incomplete(a^2,x^42))*log(x)
+psi[0](a^2)*gamma(a^2)))
/x
+84*a*log(x)
*(42*a^2*gamma(a^2)^2
*hypergeometric_regularized([a^2,a^2],[a^2+1,a^2
+1],-x^42)
*abs(x)^(42*a^2)
/x
+gamma(a^2)^2*'diff(hypergeometric_regularized(
[a^2,a^2],[a^2+1,a^2+1],-x^42),x,1)
*abs(x)^(42*a^2)
-1764*x^41*%e^-x^42*log(x)*abs(x)^(42*(a^2-1))
-42*(gamma(a^2)-gamma_incomplete(a^2,x^42))/x)
+42*a^2*gamma(a^2)^2
*'diff(hypergeometric_regularized([a^2,a^2],[a^2+1,a^2
+1],-x^42),
a,1)*abs(x)^(42*a^2)
/x
+168*a^3*psi[0](a^2)*gamma(a^2)^2
*hypergeometric_regularized([a^2,a^2],[a^2+1,a^2+1],-x^42)
*abs(x)^(42*a^2)
/x
+84*a*gamma(a^2)^2
*hypergeometric_regularized([a^2,a^2],[a^2+1,a^2+1],-x^42)
*abs(x)^(42*a^2)
/x
+4*a*psi[0](a^2)*gamma(a^2)^2
*'diff(hypergeometric_regularized([a^2,a^2],[a^2+1,a^2
+1],-x^42),x,
1)*abs(x)^(42*a^2)
+gamma(a^2)^2*'diff(hypergeometric_regularized(
[a^2,a^2],[a^2+1,a^2+1],-x^42),a,1,x,1)
*abs(x)^(42*a^2))
+2*(42*a^2*gamma(a^2)^2
*hypergeometric_regularized([a^2,a^2],[a^2+1,a^2+1],-x^42)
*abs(x)^(42*a^2)
/x
+gamma(a^2)^2*'diff(hypergeometric_regularized(
[a^2,a^2],[a^2+1,a^2+1],-x^42),x,1)
*abs(x)^(42*a^2)
-1764*x^41*%e^-x^42*log(x)*abs(x)^(42*(a^2-1))
-42*(gamma(a^2)-gamma_incomplete(a^2,x^42))/x)
When we change the order of derivation the result is much more simple,
because the derivative wrt x is much more simple:
(%i18) diff(gamma_incomplete(a^2,x^42),x,1,a,2);
(%o18) -296352*a^2*x^41*%e^-x^42*abs(x)^(42*(a^2-1))*log(abs(x))^2
-3528*x^41*%e^-x^42*abs(x)^(42*(a^2-1))*log(abs(x))
I think all results are in principle correct. Unfortunately, not always
simplified completely.
Dieter Kaiser