\limitsputs them directly above or below the integral sign. That does seem better for non-inline mode, especially if the limits can be long.
I am working in a simple QFT calculation and would like to do it using Sympy to learn (and also check my result). I have found the Quantum Mechanics module but cannot see how to start using it for my purpose. I have defined these quantities:
import sympy.physics.quantum as Q vacuum = Q.OrthogonalKet(0) annihilation_op = Q.Operator('a') creation_op = Q.Dagger(annihilation_op)
and now I want to tell Sympy that if else and . How would I do this? Also, how do I impose the commutation relations between and ?
I am just a new user for SymPy. I am self learning this library for my undergrauate research. But in the middle of the process I am stucked with one code.
So I have defined a function with a subscript.
U_n= x^n + 1/x^n
When I consider (U_1)^3 I get (substitute n=1)
(U_1)^3 = (x+1/x)^3
Then after simplifying this I get
(U_1)^3 = (x^3 + 1/x^3) + 3(x+ 1/x)
But one can see this answer as
(U_1)^3 = U_3 + 3U_1
How to get the output in terms of U_n 's ?
Can someone please give an idea how to build this code using SymPy. It would be a very big help for my research.
Thank you very much.
dr*(k-1) < dr*(k+1), which is obviously true, since
dr = symbols('Delta',real=True,positive=True,nonzero=True)and
k = symbols('k',integer=True,real=True), yet sympy doesn't seem to thing this is the case. Am I doing something wrong?
Also I get
In : print(ask(dr*(k-1) < dr*(k+1))) None
In : print(ask(dr*k-dr < dr*k+dr)) True
My function is
U_n= x^n + 1/x^n.
As an example when I compute (U_1)^3 I get (x^3 + 1/x^3) + 3(x+ 1/x).---------(i)
And if I compute (U_2)^2 I get x^4 + 1/x^4 + 2---------(ii)
But since in (i), (x^3 + 1/x^3)= U_3 and 3(x+ 1/x)=3U_1 I want to get the answer U_3+3U_1.
In (ii) I want to get the answer U_4 +2 since x^4 + 1/x^4 = U_4.
aman@amanUBUNTU:~/Desktop$ python3 Un.py Enter Value of n and k as in (U_n)^k n = 1 k = 3 3*U_1 + U_3 aman@amanUBUNTU:~/Desktop$ python3 Un.py Enter Value of n and k as in (U_n)^k n = 1 k = 2 U_2 + 2 aman@amanUBUNTU:~/Desktop$ python3 Un.py Enter Value of n and k as in (U_n)^k n = 2 k = 10 45*U_12 + 10*U_16 + U_20 + 210*U_4 + 120*U_8 + 252
@mostlyaman Yes.This is kind of same what I want.But in my case it is bit advanced.
U(n)=x^n + 1/x^n
V(n)=x^n - 1/x^n
So if I ask for any expression I should get the answer in U(n)'s and V(n)'s.I have buil it for U(n) and V(n) separately but cannot combine them.
v(1)^2 - u(1)^2 =2*u(2)
This is the program which I want.
@mostlyaman is your program executable in jupyter notebook?. If you have an idea please let me know.