Ask Your Question

ARV's profile - activity

2023-01-27 12:20:35 +0200 received badge  Famous Question (source)
2022-02-23 15:59:06 +0200 received badge  Notable Question (source)
2021-07-05 01:20:58 +0200 received badge  Popular Question (source)
2020-12-21 09:29:02 +0200 commented answer How to do quantum mechanics integrals in Sage?

Thanks for your answer! I will give FriCAS a try. I will need to familiarize myself with the Sage ecosystem quite a bit more.

2020-12-21 08:09:59 +0200 received badge  Scholar (source)
2020-12-20 20:15:14 +0200 commented question How to do quantum mechanics integrals in Sage?

@slelievre Thanks for the tip! In this case, the outputs are not distinguishable from my set-up. Maxyma requires increasingly complicated assumptions about which I can know nothing.

2020-12-20 19:42:58 +0200 commented question How to do quantum mechanics integrals in Sage?

I am indeed using Sage 9.0. Surely there can't be a huge difference between 9.0 and 9.2? I'll definitely consider updating as a last option if I have no other solutions since I have sage working for everything else I need.

2020-12-20 19:31:55 +0200 received badge  Nice Question (source)
2020-12-20 18:48:21 +0200 commented question How to do quantum mechanics integrals in Sage?

@Cyrille I think the constants are generally required in these integrals for normalization purposes. For e.g., in this case, see here: https://www.youtube.com/watch?v=wcrXc...

2020-12-20 15:38:37 +0200 received badge  Supporter (source)
2020-12-20 15:34:21 +0200 received badge  Student (source)
2020-12-20 15:33:08 +0200 asked a question How to do quantum mechanics integrals in Sage?

Hi.

I am a newcomer to Sage. I am trying to do integrals of the form shown below. This is from an introductory course in quantum mechanics.

$ \psi(x, t) = \int_{-\infty}^{+\infty} f(p) \psi_p(x - x_0, t) d\mathrm{p} $

where,

$ \psi_p(x, t) = \dfrac{1}{\sqrt{2\pi\hbar}}e^\left( -\dfrac{i}{\hbar}\left(\dfrac{p^2}{2m}t - px \right)\right) $

$ f(p) = \dfrac{1}{(2\pi)^{1/4} \sqrt{\sigma_p}}e^\left( -\dfrac{(p - p_0)^2}{4{\sigma_p}^2}\right) $

I have tried the following in sage thus far:

forget()
var('x,t,p,p_0, m,h,x_0,sigma_p')

psi_p(x, t) = 1/(2*pi*h)^(1/2)*exp(-i/h*(p^2*t/(2*m) - p*(x - x_0)))
f(p) = 1/(2*pi)^(1/4)*1/sqrt(sigma_p)*exp(-(p - p_0)^2/(4*sigma_p^2))

show(psi_p(x, t))
show(f(p))

assume(m, 'constant')
assume(m > 0)
assume(h, 'constant')
assume(h > 0)
assume(p_0, 'constant')
assume(p_0 > 0)
assume(sigma_p, 'constant')
assume(sigma_p > 0)
assume(x, 'real')
assume(t, 'real')

from sage.symbolic.integration.integral import definite_integral
definite_integral(f(p)*psi_p(x, t), p, -oo, +oo)

Sage keeps complaining about requiring assumptions that I can't easily provide. Here is a sample output:

ValueError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(2*sigma_p^2*t
>0)', see `assume?` for more details)
Is 2*sigma_p^2*t
    *sin(atan((2*sigma_p^2*t)/(h*m))
          /2)
    +h*m
                *cos(atan((2*sigma_p^2*t)
                           /(h*m))
                      /2) positive, negative or zero?

My question: how would you do integrals like this in Sage? Is my fundamental approach correct?