80 Reputation

5 Badges

9 years, 233 days

MaplePrimes Activity

These are questions asked by w-Teilchen

Hello everyone,

I'm trying to do some fitting using NonlinearFit, for the coefficients I know in advance, that they have to fulfill a condition (a+b>c+1). I couldn't find a way to make Maple take this condition into consideration while fitting my data. I tried to use Parameterrange to make the difference a+b-c+1 positive, this works for linear conditions like mine but leads to computational difficulties and errors like "no improved point could be found".

Thanks in advance,


Hi everyone,

I was trying to write a Maple sheet to calculate some perturbation theory expension as close to the "book notation" as possible. Lets for example consider a linearly perturbed harmonic oscillator with H = hω(n+1/2) and V = λ(a+a), this is one of the classical examples as it can be solved analytically by completing the square. In the Kato formulation (as used in the appended Maple worksheet), as well as in Rayleigh-Schrödinger perturbation theory one uses the projector onto the complement of the unperturbed state. I would like to do this by defining a projector in Maple. I've read the examples concerning projectors in Maple but it seems I have to use a rather ugly workaround by treating the states "below" the unperturbed state and the ones "above" separately. While this is a little annoying in one dimension it becomes a major nuisance in higher dimensions.

My question would be: How do I define the projector onto the complement of some state?

Cheers, Sören

restart; with(Physics); Setup(mathematicalnotation = true)

a := Annihilation(N, 1):

assume(`and`(`in`(m, nonnegint), m > 0)):

Physics:-Ket(N, m)


H := Physics:-`*`(Physics:-`*`(h, omega), n+1/2):

`ΔE__2` := simplify(value(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Dagger(psi), V), 1/(E(m)-H)), V), psi)))



`ΔE__4,111` := simplify(value(Dagger(psi).V.(1/(E(m)-H)).V.(1/(E(m)-H)).V.(1/(E(m)-H)).V.psi))

Error, (in Physics:-Dagger) numeric exception: division by zero


`ΔE__4,201` := -simplify(value(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Physics:-`*`(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Dagger(psi), V), 1/(E(m)-H)^2), V), psi), Dagger(psi)), V), 1/(E(m)-H)), V), psi)))



`ΔE__4` := `ΔE__4,111`+`ΔE__4,201`




Download kato_perturbation_theory.mw

Hi everyone,

I wanted to plot the fourier series up to a given order of a step function using the code I attached, to change the order I used a sum with upper boundary M. When setting M to a particular value and plotting the function the result is obtained within a second, when on the otherhand using plot(subs(M=11,...),...) it takes close to a minute to produce a picture.

This might be a misuse of subs, in any case, I wanted to share my experience and maybe get an explanation about why this takes that much longer.




f := proc (t) options operator, arrow; sum(-4*sin((2*n+1)*t)/(Pi*(2*n+1)), n = 0 .. M) end proc

proc (t) options operator, arrow; sum(-4*sin((2*n+1)*t)/(Pi*(2*n+1)), n = 0 .. M) end proc


plot(subs(M = 11, f(t)), t = 0 .. 2*Pi)


M := 11; plot(f(t), t = 0 .. 2*Pi)


Download fourier_subs.mw

1 2 3 Page 3 of 3