# HG changeset patch
# User Eviatar Bach <eviatarbach@gmail.com>
# Date 1375857451 25200
# Node ID 82511eed8f2981d0bbd983a7c61b1788a11c29fd
# Parent 2276f8addef20c5d1f59ebe11e82e7d5451e5cae
Fixing differentiation
diff --git a/sage/functions/bessel.py b/sage/functions/bessel.py
a
|
b
|
|
351 | 351 | import mpmath |
352 | 352 | return mpmath_utils.call(mpmath.besselj, n, x, parent=parent) |
353 | 353 | |
354 | | def _derivative_(self, n, x, diff_param=None): |
| 354 | def _derivative_(self, n, x, diff_param): |
355 | 355 | """ |
356 | 356 | Return the derivative of the Bessel J function. |
357 | 357 | |
… |
… |
|
361 | 361 | sage: derivative(f, z) |
362 | 362 | z |--> -1/2*bessel_J(11, z) + 1/2*bessel_J(9, z) |
363 | 363 | """ |
364 | | return (bessel_J(n - 1, x) - bessel_J(n + 1, x)) / Integer(2) |
| 364 | if diff_param == 1: |
| 365 | return (bessel_J(n - 1, x) - bessel_J(n + 1, x)) / Integer(2) |
| 366 | else: |
| 367 | raise NotImplementedError('derivative with respect to order') |
365 | 368 | |
366 | 369 | def _print_latex_(self, n, z): |
367 | 370 | """ |
… |
… |
|
511 | 514 | import mpmath |
512 | 515 | return mpmath_utils.call(mpmath.bessely, n, x, parent=parent) |
513 | 516 | |
514 | | def _derivative_(self, n, x, diff_param=None): |
| 517 | def _derivative_(self, n, x, diff_param): |
515 | 518 | """ |
516 | 519 | Return the derivative of the Bessel Y function. |
517 | 520 | |
… |
… |
|
521 | 524 | sage: derivative(f, x) |
522 | 525 | x |--> -1/2*bessel_Y(11, x) + 1/2*bessel_Y(9, x) |
523 | 526 | """ |
524 | | return (bessel_Y(n - 1, x) - bessel_Y(n + 1, x)) / Integer(2) |
| 527 | if diff_param == 1: |
| 528 | return (bessel_Y(n - 1, x) - bessel_Y(n + 1, x)) / Integer(2) |
| 529 | else: |
| 530 | raise NotImplementedError('derivative with respect to order') |
525 | 531 | |
526 | 532 | def _print_latex_(self, n, z): |
527 | 533 | """ |
… |
… |
|
683 | 689 | import mpmath |
684 | 690 | return mpmath_utils.call(mpmath.besseli, n, x, parent=parent) |
685 | 691 | |
686 | | def _derivative_(self, n, x, diff_param=None): |
| 692 | def _derivative_(self, n, x, diff_param): |
687 | 693 | """ |
688 | 694 | Return the derivative of the Bessel I function `I_n(x)` with respect |
689 | 695 | to `x`. |
… |
… |
|
694 | 700 | sage: derivative(f, x) |
695 | 701 | z |--> 1/2*bessel_I(11, x) + 1/2*bessel_I(9, x) |
696 | 702 | """ |
697 | | return (bessel_I(n - 1, x) + bessel_I(n + 1, x)) / Integer(2) |
| 703 | if diff_param == 1: |
| 704 | return (bessel_I(n - 1, x) + bessel_I(n + 1, x)) / Integer(2) |
| 705 | else: |
| 706 | raise NotImplementedError('derivative with respect to order') |
698 | 707 | |
699 | 708 | def _print_latex_(self, n, z): |
700 | 709 | """ |
… |
… |
|
869 | 878 | import mpmath |
870 | 879 | return mpmath_utils.call(mpmath.besselk, n, x, parent=parent) |
871 | 880 | |
872 | | def _derivative_(self, n, x, diff_param=None): |
| 881 | def _derivative_(self, n, x, diff_param): |
873 | 882 | """ |
874 | 883 | Return the derivative of the Bessel K function. |
875 | 884 | |
… |
… |
|
879 | 888 | sage: derivative(f, x) |
880 | 889 | x |--> 1/2*bessel_K(11, x) + 1/2*bessel_K(9, x) |
881 | 890 | """ |
882 | | return (bessel_K(n - 1, x) + bessel_K(n + 1, x)) / Integer(2) |
| 891 | if diff_param == 1: |
| 892 | return (bessel_K(n - 1, x) + bessel_K(n + 1, x)) / Integer(2) |
| 893 | else: |
| 894 | raise NotImplementedError('derivative with respect to order') |
883 | 895 | |
884 | 896 | def _print_latex_(self, n, z): |
885 | 897 | """ |