On Monday, June 23, 2014 9:18:29 PM UTC-4, Chris Maness wrote:
>
> I am trying to plot a superposition of two static states psi1 and psi2 
> that compose a state system Psi.  Here is my code so far: 
>
>
I'm not sure what happened here.   I should point out that you don't need 
to declare a variable unless you are going to actually use it as a 
math-style variable, as opposed to just using it as a name.

sage: var('n,a')
(n, a)
sage: hbar, m = 1,1
sage: psi(x,t,n)=sqrt(2/a)*sin(n*pi*x/a)*e^(-i*n^2*pi^2*hbar*t/(2*m*a^2)); 
sage: psi
(x, t, n) |--> sqrt(2)*sqrt(1/a)*e^(-1/2*I*pi^2*n^2*t/a^2)*sin(pi*n*x/a)
sage: Psi(x,t)=1/sqrt(2)*psi(x,t,1)+1/sqrt(2)*psi(x,t,2); 
sage: Psi
(x, t) |--> sqrt(1/a)*e^(-2*I*pi^2*t/a^2)*sin(2*pi*x/a) + 
sqrt(1/a)*e^(-1/2*I*pi^2*t/a^2)*sin(pi*x/a)
sage: P(x,t,a) = Psi.conjugate()*Psi
sage: P.expand()
(x, t, a) |--> sqrt(1/a)*conjugate(sqrt(1/a))*e^(-2*I*pi^2*t/a^2 + 
2*I*pi^2*conjugate(t)/conjugate(a)^2)*sin(2*pi*x/a)*sin(2*pi*conjugate(x)/conjugate(a))
 
+ sqrt(1/a)*conjugate(sqrt(1/a))*e^(-1/2*I*pi^2*t/a^2 + 
2*I*pi^2*conjugate(t)/conjugate(a)^2)*sin(pi*x/a)*sin(2*pi*conjugate(x)/conjugate(a))
 
+ sqrt(1/a)*conjugate(sqrt(1/a))*e^(-2*I*pi^2*t/a^2 + 
1/2*I*pi^2*conjugate(t)/conjugate(a)^2)*sin(2*pi*x/a)*sin(pi*conjugate(x)/conjugate(a))
 
+ sqrt(1/a)*conjugate(sqrt(1/a))*e^(-1/2*I*pi^2*t/a^2 + 
1/2*I*pi^2*conjugate(t)/conjugate(a)^2)*sin(pi*x/a)*sin(pi*conjugate(x)/conjugate(a))
sage: plot(P(x,1,1),x,0,1) 
verbose 0 (2395: plot.py, generate_plot_points) WARNING: When plotting, 
failed to evaluate function at 198 points.
verbose 0 (2395: plot.py, generate_plot_points) Last error message: 'unable 
to simplify to float approximation'

but it plotted nicely - should it look like 1-abs(x-.5) ?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to