![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/local/lib/python3.6/dist-packages/sympy/sandbox/tests/ |
Upload File : |
from sympy.sandbox.indexed_integrals import IndexedIntegral from sympy import IndexedBase, Idx, symbols, sin, cos def test_indexed_integrals(): A = IndexedBase('A') i, j = symbols('i j', integer=True) a1, a2 = symbols('a1:3', cls=Idx) assert isinstance(a1, Idx) assert IndexedIntegral(1, A[i]).doit() == A[i] assert IndexedIntegral(A[i], A[i]).doit() == A[i] ** 2 / 2 assert IndexedIntegral(A[j], A[i]).doit() == A[i] * A[j] assert IndexedIntegral(A[i] * A[j], A[i]).doit() == A[i] ** 2 * A[j] / 2 assert IndexedIntegral(sin(A[i]), A[i]).doit() == -cos(A[i]) assert IndexedIntegral(sin(A[j]), A[i]).doit() == sin(A[j]) * A[i] assert IndexedIntegral(1, A[a1]).doit() == A[a1] assert IndexedIntegral(A[a1], A[a1]).doit() == A[a1] ** 2 / 2 assert IndexedIntegral(A[a2], A[a1]).doit() == A[a1] * A[a2] assert IndexedIntegral(A[a1] * A[a2], A[a1]).doit() == A[a1] ** 2 * A[a2] / 2 assert IndexedIntegral(sin(A[a1]), A[a1]).doit() == -cos(A[a1]) assert IndexedIntegral(sin(A[a2]), A[a1]).doit() == sin(A[a2]) * A[a1]