## 20 Reputation

7 years, 308 days

## Thank you!...

@tomleslie Thank you a lot! Could you please tell me the difference between assume(phi,real) and phi::real? I got the latter syntax online but it seems not working. I want to understand the problem a bit bettter. Thanks again!

## Thank you!...

@tomleslie Thank you! You are right that the trick is not very useful and makes the code more difficult to follow.

## Thank you!...

@Kitonum I see. I didn't know that when an operator is defined as a combination of several operators, the operand has to be operated separately, instead of operated after the combination is made. Thanks for teaching me the syntax.

Best,

Toby

## But I didn't use e^(I*phi)...

Dear Kitonum,

Thank you for your answer. I tried your code and it works. However, I did not use any e^ in my code. I always used exp. The function is generated by using operators. My code is given below. May I ask you to take a look into it. Again, your help is appreciated!

Best,

Toby

restart;
Pr := proc (f) options operator, arrow; -I*(diff(f, r)) end proc;
/ d   \
f -> -I |--- f|
\ dr  /
Mphi := proc (f) options operator, arrow; -I*(diff(f, phi)) end proc;
/  d    \
f -> -I |----- f|
\ dphi  /
rplus := proc (f) options operator, arrow; r*exp(I*phi)*f end proc;
f -> r exp(I phi) f
rminus := proc (f) options operator, arrow; r*exp(-I*phi)*f end proc;
f -> r exp(-I phi) f
Pplus := proc (f) options operator, arrow; exp(I*phi)*(Pr+I*Mphi/r)(f) end proc;
/     I Mphi\
f -> exp(I phi) |Pr + ------|(f)
\       r   /
Pminus := proc (f) options operator, arrow; exp(-I*phi)*(Pr-I*Mphi/r)(f) end proc;
/     I Mphi\
f -> exp(-I phi) |Pr - ------|(f)
\       r   /
Rpp := proc (f) options operator, arrow; (Pplus+I*rplus)(f) end proc;
f -> (Pplus + I rplus)(f)
Rmp := proc (f) options operator, arrow; (Pplus-I*rplus)(f) end proc;
f -> (Pplus - I rplus)(f)
Rpm := proc (f) options operator, arrow; (Pminus+I*rminus)(f) end proc;
f -> (Pminus + I rminus)(f)
mm := proc (f) options operator, arrow; (Pminus-I*rminus)(f) end proc;
f -> (Pminus - I rminus)(f)
Psi00 := sqrt(1/pi)*exp(-(1/2)*r^2);
(1/2)
/1 \         /  1  2\
|--|      exp|- - r |
\pi/         \  2   /
Rpm(Rpp(Psi00));
/
|
|
|
exp(-I phi) |
|
|
|
\
/                   (1/2)
|               /1 \         /  1  2\
-I |2 I exp(I phi) |--|      exp|- - r |
\               \pi/         \  2   /

(1/2)               \
/1 \       2    /  1  2\|
- 2 I exp(I phi) |--|      r  exp|- - r ||
\pi/            \  2   //

(1/2)                 \
/ 1\           /  1  2\   |
2 exp(I phi) |--|      r exp|- - r |   |
\pi/           \  2   /   |
+ -----------------------------------------|
/                   (1/2)              \|
|               /1 \           /  1  2\||
r|2 I exp(I phi) |--|      r exp|- - r |||
\               \pi/           \  2   ///

(1/2)
2                        /1 \         /  1  2\
- 2 r  exp(-I phi) exp(I phi) |--|      exp|- - r |
\pi/         \  2   /
simplify(%);
/                  (1/2) /
1                   |     /  1  2\ /1 \      |
- ------------------------------------ |2 exp|- - r | |--|      |2
/                          (1/2)  \ \     \  2   / \pi/      \
|       /        1  2\ /1 \       |
r|2 I exp|I phi - - r | |--|      r|
\       \        2   / \pi/       /

/                          (1/2)  \
|       /        1  2\ /1 \       |  2
r|2 I exp|I phi - - r | |--|      r| r
\       \        2   / \pi/       /

/                          (1/2)  \    \\
|       /        1  2\ /1 \       |    ||
- r|2 I exp|I phi - - r | |--|      r| - r||
\       \        2   / \pi/       /    //

 Page 1 of 1
﻿