Items tagged with physics physics Tagged Items Feed

@ecterrab 

I figured I'd start a new thread for odd things I come across whilst using the new physics package. 

I have found this, and am not sure if it is expected. 

 


restart

with(Physics):

Setup(mathematicalnotation = true):

``

Setup(Commutator(Psigma[i], Psigma[j]) = Physics:-`*`(Physics:-`*`(I, ep_[i, j, k]), Psigma[k]), AntiCommutator(Psigma[i], Psigma[j]) = Physics:-`*`(2, kd_[i, j]));

[algebrarules = {%AntiCommutator(Physics:-Psigma[i], Physics:-Psigma[j]) = 2*Physics:-KroneckerDelta[i, j], %Commutator(Physics:-Psigma[i], Physics:-Psigma[j]) = I*Physics:-LeviCivita[i, j, k]*Physics:-Psigma[k]}]

(1)

NULL

Psigma[1].Psigma[1]

Physics:-Psigma[1]^2

(2)

Simplify(%)

Physics:-Psigma[1]^2

(3)

Simplify(Physics:-Psigma[1]^2)

1

(4)

``


Download Simplify2.mw

EDIT: Ok, it realy seems that this sum of commutators is something that takes Maple forever. I have written a new MWE. Is it possible to speed things up? Maybe using assumptions or so?

 

restart;with(Physics):with(LinearAlgebra): Setup(mathematicalnotation=true):Setup(noncommutativeprefix={M,H,S});

[noncommutativeprefix = {H, M, S}]

(1)

GetAdvCommutator0:=proc(power::integer,order::integer,M)
    if power <= 0 then return M fi:
    if power = 1 then

        return mtaylor(Commutator(M,add(lambda^l*S[l],l=1..order)),lambda, order+1) fi:
    
    return mtaylor(Commutator(GetAdvCommutator0(power-1,order,M),add(lambda^l*S[l],l=1..order)),lambda,order+1):
end proc:

HOffDiag:=n->eval(add(1/((2*j+1)!)*'GetAdvCommutator0'(2*j+1,n,H[0]),j=0..iquo(n-1,2)+1)+add(1/((2*j+1)!)*'GetAdvCommutator0'(2*j+1,n,lambda*H[1]),j=0..iquo(n-2,2)+1)+add(1/((2*j)!)*'GetAdvCommutator0'(2*j,n,lambda*H[2]),j=0..iquo(n-1,2)+1)):

HOffDiag(3); # still fast

lambda^3*Physics:-Commutator(H[0], S[3])+lambda^2*Physics:-Commutator(H[0], S[2])+lambda*Physics:-Commutator(H[0], S[1])+(1/6)*lambda^3*Physics:-Commutator(Physics:-Commutator(Physics:-Commutator(H[0], S[1]), S[1]), S[1])+lambda^2*Physics:-Commutator(H[1], S[1])+lambda^3*Physics:-Commutator(H[1], S[2])+lambda*H[2]+(1/2)*lambda^3*Physics:-Commutator(Physics:-Commutator(H[2], S[1]), S[1])

(2)

HOffDiag(6); # takes a very long time, I didn't even try entering higher numbers

Warning,  computation interrupted

 

 

 

SumOfCommutators.mw

 

Hi,

I know this question is really unspecific. However, since I am still new to Maple, and since you don't program with Maple as you would do with c++, I would appreciate some advise. I have written a program in Maple and I don't know if it works correctly. All I know is, it is pretty slow :(.

So if anyone of you could just have a short look at my attached worksheet and could tell me, if I at some point used an obvious "don't", I would greatly appreciate it.

 

Cheers

NOh

 

 

A Maple worksheet

NULL

Setup Maple

 

NULL

restart;with(Physics):with(LinearAlgebra):Setup(mathematicalnotation=true):Setup(noncommutativeprefix={MA,MB,H,S});

[noncommutativeprefix = {H, MA, MB, S}]

(1.1)

NULL

NULL

Input parameter

 

NULL

H0:=Matrix([[ 0 , 0 , 0 , 0 ],
            [ 0 , 0 , 0 , 0 ],
            [ 0 , 0 , U , 0 ],
            [ 0 , 0 , 0 , U ]]);

H0 := Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = U, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = U})

(2.1)

H1:=Matrix([[ 0 , 0 , 0 , 0 ],
            [ 0 , 0 , 0 , 0 ],
            [ 0 , 0 , 0 , 0 ],
            [ 0 , 0 , 0 , 0 ]]);

H1 := Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0})

(2.2)

H2:=Matrix([[  0 , 0 , -t , -t ],
            [  0 , 0 ,  t ,  t ],
            [ -t , t ,  0 ,  0 ],
            [ -t , t ,  0 ,  0 ]]);

H2 := Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = -t, (1, 4) = -t, (2, 1) = 0, (2, 2) = 0, (2, 3) = t, (2, 4) = t, (3, 1) = -t, (3, 2) = t, (3, 3) = 0, (3, 4) = 0, (4, 1) = -t, (4, 2) = t, (4, 3) = 0, (4, 4) = 0})

(2.3)

orderNumber:= 4 ;

4

(2.4)

NULL

 

 

 

Define all necessary functions

 

 

 

GetAdvCommutator0:=proc(power::integer,order::integer)
    local Comm:
    if power <= 0 then return H[0] fi:
    if power = 1 then return add(coeff(Commutator(H[0],add(lambda^l*S[l],l=1..order)),lambda,n)*lambda^n,n=0..order) fi:
    
    return add(coeff(Commutator(GetAdvCommutator0(power-1,order),add(lambda^l*S[l],l=1..order)),lambda,n)*lambda^n,n=0..order):
end proc:

GetAdvCommutator1:=proc(power::integer,order::integer)
    local Comm:
    if power <= 0 then return lambda*H[1] fi:
    if power = 1 then return add(coeff(Commutator(lambda*H[1],add(lambda^l*S[l],l=1..order)),lambda,n)*lambda^n,n=0..order) fi:
    
    return add(coeff(Commutator(GetAdvCommutator1(power-1,order),add(lambda^l*S[l],l=1..order)),lambda,n)*lambda^n,n=0..order):
end proc:

GetAdvCommutator2:=proc(power::integer,order::integer)
    local Comm:
    if power <= 0 then return lambda*H[2] fi:
    if power = 1 then return add(coeff(Commutator(lambda*H[2],add(lambda^l*S[l],l=1..order)),lambda,n)*lambda^n,n=0..order) fi:
    
    return add(coeff(Commutator(GetAdvCommutator2(power-1,order),add(lambda^l*S[l],l=1..order)),lambda,n)*lambda^n,n=0..order):
end proc:


HOffDiag:=n->eval(add(1/((2*j+1)!)*'GetAdvCommutator0'(2*j+1,n),j=0..iquo(n-1,2)+1)+add(1/((2*j+1)!)*'GetAdvCommutator1'(2*j+1,n),j=0..iquo(n-2,2)+1)+add(1/((2*j)!)*'GetAdvCommutator2'(2*j,n),j=0..iquo(n-1,2)+1)):

 

 


HOnDiag:=n->eval(add(1/((2*j)!)*'GetAdvCommutator0'(2*j,n),j=0..iquo(n,2)+1)+add(1/((2*j)!)*'GetAdvCommutator1'(2*j,n),j=0..iquo(n-1,2)+1)+add(1/((2*j+1)!)*'GetAdvCommutator2'(2*j+1,n),j=0..iquo(n-2,2)+1)):

 

computeHBlockDiag:=proc( n::posint,firstBlockWidth::posint, H0::Matrix, H1::Matrix, H2::Matrix )
    local expr, Orders, i, eq, j, eq2, orders,smatrices,rows::posint,evallist,m,l,cols,Hdiag,ff;
    
    
    expr:=HOffDiag(n);       # !!!!! this one is one of the slowest parts I think                                     
    Orders:=[$1..n];                                              
    for i from 1 to n do                                          
        eq:=add(coeff(expr,lambda,l)*lambda^l,l=0..i)=0;       
        for j from 1 to i-1 do
            eq:=eval(eq,Commutator(H[0],S[j])=Orders[j]);
        od;
        eq:=subs(Commutator(H[0],S[i])=MX,eq);
        eq2:=solve(eq,MX);
        Orders[i]:=eq2;
    od;

    
    rows,cols:=Dimension(H0);                                    
    smatrices:=[seq(H0,i=1..n)];
    for i from 1 to n do
        evallist:=[`*`=`.`,H[1]=H1,H[2]=H2];
        for j from 1 to i-1 do
            evallist:=[op(evallist),S[j]=smatrices[j]];        
        od;
        smatrices[i]:=eval(Orders[i],evallist);
        for m from 1 to firstBlockWidth do
            for l from firstBlockWidth+1 to rows do
                smatrices[i][m,l]:=smatrices[i][m,l]*1/(H0[m][m]-H0[l][l]);
                smatrices[i][l,m]:=smatrices[i][l,m]*1/(H0[m][m]-H0[l][l]);
            od;
        od;
    od;


    expr:=HOnDiag(n);            # !!!!! and this one of course (almost identical to the one above)                                       
    Hdiag:=eval(add(coeff(expr,lambda,l)*lambda^l,l=0..n),lambda=1);
    evallist:= [op(evallist), H[0]=H0,S[n]=smatrices[n]];
    Hdiag:=eval(Hdiag,evallist);


    
    return Hdiag;
end proc:

 

 

NULL

computeHBlockDiag(2,2,H0,H1,H2);

Matrix(4, 4, {(1, 1) = -2*t^2/U, (1, 2) = 2*t^2/U, (1, 3) = 0, (1, 4) = 0, (2, 1) = 2*t^2/U, (2, 2) = -2*t^2/U, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = U+2*t^2/U, (3, 4) = 2*t^2/U, (4, 1) = 0, (4, 2) = 0, (4, 3) = 2*t^2/U, (4, 4) = U+2*t^2/U})

(1)

Eigenvalues(%);

Vector(4, {(1) = 0, (2) = U, (3) = -4*t^2/U, (4) = (U^2+4*t^2)/U})

(2)

 

Testing

 

``

#Fast

computeHBlockDiag(2,2,H0,H1,H2);

Matrix(4, 4, {(1, 1) = -2*t^2/U, (1, 2) = 2*t^2/U, (1, 3) = 0, (1, 4) = 0, (2, 1) = 2*t^2/U, (2, 2) = -2*t^2/U, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = U+2*t^2/U, (3, 4) = 2*t^2/U, (4, 1) = 0, (4, 2) = 0, (4, 3) = 2*t^2/U, (4, 4) = U+2*t^2/U})

(4.1)

#Not so fast

computeHBlockDiag(4,2,H0,H1,H2);

Matrix(4, 4, {(1, 1) = -2*t^2/U-(8/3)*t^4/U^3, (1, 2) = 2*t^2/U+(8/3)*t^4/U^3, (1, 3) = 0, (1, 4) = 0, (2, 1) = 2*t^2/U+(8/3)*t^4/U^3, (2, 2) = -2*t^2/U-(8/3)*t^4/U^3, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = U+2*t^2/U+(8/3)*t^4/U^3, (3, 4) = 2*t^2/U+(8/3)*t^4/U^3, (4, 1) = 0, (4, 2) = 0, (4, 3) = 2*t^2/U+(8/3)*t^4/U^3, (4, 4) = U+2*t^2/U+(8/3)*t^4/U^3})

(4.2)

#Already pretty slow :(

computeHBlockDiag(6,2,H0,H1,H2);

Warning,  computation interrupted

 

 

``

 

Download MapleWorksheet.mw

Hi,

I've noticed there are settings to set the type of index for spinors or gauge index in the physics package. i.e Setup(spinorindices=lowercaselatin). I also notice there is a setting for specifying the form of tetrads. 

I cannot find any further documention or examples on how to use these functions. Could anyone point me in the direction of a text or help function as to how these are implemented. 

Simple examples of things I am trying to do:

> with(Physics); Setup(spinorindices=lowercaselatin, metric = <some_line_element>)

> tetrad[`mu`,`~a`] = Matrix(<some tetrad matrix>) 

> Define(%)

I recieve the following error: invalid input: unknown uses a 2nd argument, a, which is missing.

I am hoping for a tensor that uses the metric to raise/lower the `mu` component and the minkowskian metric to raise/lower the `a` component. 

If there is further documentation that I am missing, I'm happy to check that out instead of asking lots of questions here. 

Thanks again.

Hi,

This may be just my lack of maple syntax, however I cannot seem to find a way to add upper indicies in tensors (without first converting them to some other object, array, matrix etc)

In the physics package an example is just the metric tensor. 

I am trying to do something like this:

 

with(Physics);

add(g_[~mu,2], mu=1..2) 

Is there an easy way of summing upper indicies? Obviously lower indicies work, because the add/sum command recognizes the variable to iterate. 

Thanks in advance,

Age

 

Hi again,

 

I am lost... again. I worked with the Physics package and have obtained my result in form of a lengthy equation of commutators of non-commuting objects. So basically my problem is solved, except that I now want to compute some examples to see, if everything is correct. For that purpose I want to replace now the non-commuting objects with explicit matrices, compute the result and see if it agrees with numerical studies. However, I have no clue which command to use, because if I try it with subs, then the multiplication is of the wrong type and Maple won't multiply my matrices. I tried to use eval but wasn't successful.

Here is an exampe to see what I mean.

Test2.mw

 

Thank you for your time

 

NOh

Last week the Physics package was presented in a talk at the Perimeter Institute for Theoretical Physics and in a combined Applied Mathematics and Physics Seminar at the University of Waterloo. The presentation at the Perimeter Institute got recorded. It was a nice opportunity to surprise people with the recent advances in the package. It follows the presentation with sections closed, and at the end there is a link to a pdf with the sections open and to the related worksheet, used to run the computations in real time during the presentation.

COMPUTER ALGEBRA FOR THEORETICAL PHYSICS

 

  

Generally speaking, physicists still experience that computing with paper and pencil is in most cases simpler than computing on a Computer Algebra worksheet. On the other hand, recent developments in the Maple system implemented most of the mathematical objects and mathematics used in theoretical physics computations, and dramatically approximated the notation used in the computer to the one used in paper and pencil, diminishing the learning gap and computer-syntax distraction to a strict minimum. In connection, in this talk the Physics project at Maplesoft is presented and the resulting Physics package illustrated tackling problems in classical and quantum mechanics, general relativity and field theory. In addition to the 10 a.m lecture, there will be a hands-on workshop at 1pm in the Alice Room.

 

... Why computers?

 

 

We can concentrate more on the ideas instead of on the algebraic manipulations

 

We can extend results with ease

 

We can explore the mathematics surrounding a problem

 

We can share results in a reproducible way

 

Representation issues that were preventing the use of computer algebra in Physics

 

 

Notation and related mathematical methods that were missing:


coordinate free representations for vectors and vectorial differential operators,

covariant tensors distinguished from contravariant tensors,

functional differentiation, relativity differential operators and sum rule for tensor contracted (repeated) indices

Bras, Kets, projectors and all related to Dirac's notation in Quantum Mechanics

 

Inert representations of operations, mathematical functions, and related typesetting were missing:

 

inert versus active representations for mathematical operations

ability to move from inert to active representations of computations and viceversa as necessary

hand-like style for entering computations and texbook-like notation for displaying results

 

Key elements of the computational domain of theoretical physics were missing:

 

ability to handle products and derivatives involving commutative, anticommutative and noncommutative variables and functions

ability to perform computations taking into account custom-defined algebra rules of different kinds

(problem related commutator, anticommutator, bracket, etc. rules)

Vector and tensor notation in mechanics, electrodynamics and relativity

   

Dirac's notation in quantum mechanics

   

 

• 

Computer algebra systems were not originally designed to work with this compact notation, having attached so dense mathematical contents, active and inert representations of operations, not commutative and customizable algebraic computational domain, and the related mathematical methods, all this typically present in computations in theoretical physics.

• 

This situation has changed. The notation and related mathematical methods are now implemented.

 

Tackling examples with the Physics package

 

Classical Mechanics

 

Inertia tensor for a triatomic molecule

 

 

Problem: Determine the Inertia tensor of a triatomic molecule that has the form of an isosceles triangle with two masses m[1] in the extremes of the base and mass m[2] in the third vertex. The distance between the two masses m[1] is equal to a, and the height of the triangle is equal to h.

Solution

   

Quantum mechanics

 

Quantization of the energy of a particle in a magnetic field

 


Show that the energy of a particle in a constant magnetic field oriented along the z axis can be written as

H = `&hbar;`*`&omega;__c`*(`#msup(mi("a",mathcolor = "olive"),mo("&dagger;"))`*a+1/2)

where `#msup(mi("a",mathcolor = "olive"),mo("&dagger;"))`and a are creation and anihilation operators.

Solution

   

The quantum operator components of `#mover(mi("L",mathcolor = "olive"),mo("&rarr;",fontstyle = "italic"))` satisfy "[L[j],L[k]][-]=i `&epsilon;`[j,k,m] L[m]"

   

Unitary Operators in Quantum Mechanics

 

(with Pascal Szriftgiser, from Laboratoire PhLAM, Université Lille 1, France)

A linear operator U is unitary if 1/U = `#msup(mi("U"),mo("&dagger;"))`, in which case, U*`#msup(mi("U"),mo("&dagger;"))` = U*`#msup(mi("U"),mo("&dagger;"))` and U*`#msup(mi("U"),mo("&dagger;"))` = 1.Unitary operators are used to change the basis inside an Hilbert space, which physically means changing the point of view of the considered problem, but not the underlying physics. Examples: translations, rotations and the parity operator.

1) Eigenvalues of an unitary operator and exponential of Hermitian operators

   

2) Properties of unitary operators

   

3) Schrödinger equation and unitary transform

   

4) Translation operators

   

Classical Field Theory

 

The field equations for a quantum system of identical particles

 

 

Problem: derive the field equation describing the ground state of a quantum system of identical particles (bosons), that is, the Gross-Pitaevskii equation (GPE). This equation is particularly useful to describe Bose-Einstein condensates (BEC).

Solution

   

The field equations for the lambda*Phi^4 model

   

Maxwell equations departing from the 4-dimensional Action for Electrodynamics

   

General Relativity

 

Given the spacetime metric,

g[mu, nu] = (Matrix(4, 4, {(1, 1) = -exp(lambda(r)), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = -r^2, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -r^2*sin(theta)^2, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = exp(nu(r))}))

a) Compute the trace of

"Z[alpha]^(beta)=Phi R[alpha]^(beta)+`&Dscr;`[alpha]`&Dscr;`[]^(beta) Phi+T[alpha]^(beta)"

where `&equiv;`(Phi, Phi(r)) is some function of the radial coordinate, R[alpha, `~beta`] is the Ricci tensor, `&Dscr;`[alpha] is the covariant derivative operator and T[alpha, `~beta`] is the stress-energy tensor

T[alpha, beta] = (Matrix(4, 4, {(1, 1) = 8*exp(lambda(r))*Pi, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 8*r^2*Pi, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 8*r^2*sin(theta)^2*Pi, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 8*exp(nu(r))*Pi*epsilon}))

b) Compute the components of "W[alpha]^(beta)"" &equiv;"the traceless part of  "Z[alpha]^(beta)" of item a)

c) Compute an exact solution to the nonlinear system of differential equations conformed by the components of  "W[alpha]^(beta)" obtained in b)

Background: paper from February/2013, "Withholding Potentials, Absence of Ghosts and Relationship between Minimal Dilatonic Gravity and f(R) Theories", by P. Fiziev.

a) The trace of "  Z[alpha]^(beta)=Phi R[alpha]^(beta)+`&Dscr;`[alpha]`&Dscr;`[]^(beta) Phi+T[alpha]^(beta)"

   

b) The components of "W[alpha]^(beta)"" &equiv;"the traceless part of " Z[alpha]^(beta)"

   

c) An exact solution for the nonlinear system of differential equations conformed by the components of  "W[alpha]^(beta)"

   

The Physics Project

 

 

"Physics" is a software project at Maplesoft that started in 2006. The idea is to develop a computational symbolic/numeric environment specifically for Physics, targeting educational and research needs in equal footing, and resembling as much as possible the flexible style of computations used with paper and pencil. The main reference for the project is the Landau and Lifshitz Course of Theoretical Physics.

 

A first version of "Physics" with basic functionality appeared in 2007. Since then the package has been growing every year, including now, among other things, a searcheable database of solutions to Einstein equations and a new dedicated programming language for Physics.

 

Since August/2013, weekly updates of the Physics package are distributed on the web, including the new developments related to our plan as well as related to people's feedback.

 

 

Presentation_at_PI_and_UW.pdf     Presentation_at_PI_and_UW.mw

 

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

I am trying the following:

restart; 
with(Physics);
with(Library);
Setup(mathematicalnotation = true);
Setup(op = A);
assume(n::integer);

type(A^n, Physics:-`^`(PhysicsType:-ExtendedQuantumOperator, integer));
type(A^n, PhysicsType:-ExtendedQuantumOperator^integer);

the result is

false
false

However, I expected to get true in both cases. How to construct correct type for A^n?
Thank you.

Hi!

I seem to run into problems with (quantum) perturbation theory. In the following minimal working example, an energy denominator, as occuring in perturbation theory is not evaluated if I previously assume that the quantum number is a positive integer. It's supposed to return an error, as the energy denominator is 0.

restart; with(Physics)

a := Annihilation(N, 1, notation = explicit):

psi := Ket(N, m);

Physics:-Ket(N, m)

(1)

E := proc (g) options operator, arrow; (1/2)*g*(g-1)-mu*g end proc:

simplify(value(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Dagger(psi), 1/(E(m)-H)), psi)))

-I/(Im(m)*(2*Re(m)-1-2*mu))

(2)

assume(`in`(m, nonnegint), m > 0);

simplify(value(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Dagger(psi), 1/(E(m)-H)), psi)))

-2*Physics:-Bracket(Physics:-Bra(N, m), 1/(-2*mu*Physics:-`*`(`a-`[N[1]], `a+`[N[1]])+2*mu*m-m^2+Physics:-`*`(Physics:-`^`(`a-`[N[1]], 2), Physics:-`^`(`a+`[N[1]], 2))-4*Physics:-`*`(`a-`[N[1]], `a+`[N[1]])+2*mu+m+2), Physics:-Ket(N, m))

(3)

Parse:-ConvertTo1D, "invalid input %1", `.`(Dagger(psi), 1/(E-H), psi)

2/(2*mu*m-m^2+2*E+m)

(4)

``

Download energy_denominator.mw

 

Best regards,

Sören

Hello everyone,

I've been trying to do some perturbation theory and ran into some problems I don't quite understand. I implemented the Hamiltonian of the Bose-Hubbard model and treated the hopping as a perturbation. Calculating the second order energy shift is easily accomplished, but when I'm only interested in one of the two occuring terms, I run into problems. The calculation takes minutes to finally fail, giving me an "too many levels of recursion"-error. I need to be able to just pick a few terms for some calculations, I'm doing, and can't figure out what I might be doing wrong. Here is the source code (download is below):

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

a__1 := Annihilation(N, 1):

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

Physics:-Ket(N, m, m)

(1)

H := Physics:-`*`(Physics:-`*`(1/2, n__1), n__1-1)+Physics:-`*`(Physics:-`*`(1/2, n__2), n__2-1):

`&Delta;E__2` := Physics:-`*`(Physics:-`*`(2, d), simplify(value(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Dagger(psi), V), 1/(E(m, m)-H)), V), psi))))

-4*d*J^2*m*(m+1)

(2)

simplify(value(((Dagger(psi).c__2)*a__1.(1/(E(m, m)-H)).c__1)*a__2.psi))

Error, (in PatternMatching:-AlgStruct:-Match) too many levels of recursion

 

``

Download too_many_levels_of_recursion.mw

It would be great, if someone could point out the mistake, I'm making. I copy/pasted the last line, so there shouldn't be any typos.

Thanks in advance,

Sören

Hi, 

I'm trying to set up the dirac algebra using the Physics package in maple 18. There are dirac gamma matricies (Dgamma) already specified, but I can't seem to manipulate their commutation relations. 

So I've tried building my own: 

restart;
with(Physics);

Setup(noncommutativeprefix = {gamma});

g[1] := gamma[1]; g[2] := gamma[2]; g[3] := gamma[3]; g[4] := gamma[0];

InverseMetric := rhs(g_[`~mu`, `~nu`, matrix])

Algebra :=  (a, b) -> %AntiCommutator(g[a], g[b]) = 2*InverseMetric[a, b];

Rules := Matrix(4, 4, Algebra);

Setup(algebrarules = Rules);

Error, (in Physics:-Setup) unable to set AntiCommutator(gamma[0], gamma[1]) = 0 because, taking into account {AntiCommutator(gamma[0], gamma[0]) = 2}, we would have gamma[0] and gamma[0] anticommutative and AntiCommutator(gamma[0], gamma[0]) <> 0

It seems like Maple can't handle the Dirac Algebra? Or have I done something obviously wrong?

Any help is appreciated. 

Thanks

I have been learning to use the Physics package in Maple 18.  I just updated to the latest version of the Physics package to see if it would fix the problem by my results are the same.

When I take a covariant derivative in spherical coordinates it does not appear to have a scale factor such as g_kk below.  

 A_(j;k)=1/(g_(kk))(partialA_j)/(partialx_k)-Gamma_(jk)^iA_i,

This definition of comes from the Mathworld web site.  I think they have a typo such that it should actually read h_k which is the scale factor instead of g_kk which is the metric.  They are related by h_k^2 = g_kk.

Why doesn't Maple's covariant derivative have the scale factor when I am differentiating in spherical coordinates?

Thanks!

Hello everybody,

I'm trying to solve for a challenging problem : a moving inclined plane with a block

I want to solve for the acceleration components for the block and the plane and the normal force acting on the block.

Let O=(0,0) be an external origin.

Let h be the upper left height of the inclined plane.

Let x1 be the x-position of the center of gravity of the inclined plane.

Let x2 be the x-postion of the center of gravity of the block.

Let y be the y-position of the center of gravity of the block.

Let m1 be the mass of the plane. Let m2 be the mass of the block.

Let  mu[1] be the coeffiction of kinetic friction between the bottom of the inclined plane and the level surface.

Let mu[2]  be the coeffiction of kinetic friction between the block and the upper surface of the inclined plane.

Let theta be the angle of the plane with the horizontal.

Let Fp a force applied to the inclined plane.

 

With those defined variables, I make two separable free body diagrams for the block and for the inclined plane, indicating all of the external forces acting on each. It then comes those two vectorial equations :

Block : m2a2=Wweight of block+Fplan acting on block+Ffriction from plan to block+Nnormal from plan to block

Plane : m1a1=Wweight of plane+Fpushing force+Fblock acting on plane+Ffriction from level to plan+Nnormal from level to plane+Ffriction from block to plane+Nnormal from block to plane

I am quite not sure whether I should include the Ffriction from block to plane and the Nnormal from block to plane into the plane's acceleration calculation. Am I right ?

I notice that from the geometry of the figure, I can write down the relation : tan(theta)=(h-y)/(x2-x1)

This implies the relation : -a2y=tan(theta)(a2x-a1x) (equation 1)

Writing down the equations for the x- and y- components of the accelerations of the block and of the plane , this yields :

( equation 2) : m2a2x=m1 sqrt(a1x2+a1y2) cos(theta) -    mu[2]  N1 sin(theta) +Ncos(theta

 

(equation 3) : m2a2y= m2g+m1 sqrt(a1x2+a1y2) sin(theta) +  mu[2]  N1 cos(theta) +Nsin(theta

(equation 4) : m1a1x=Fp - m2 sqrt(a2x2+a2y2)  sin(theta) +  mu[2]  N1 cos(theta) - Ncos(theta

(equation 5) : m1a1y=-m1g  - m2 sqrt(a2x2+a2y2)  cos(theta) - mu[1] N1 + N1 -  mu[2]  N1 sin(theta) -  mu[2]  N1 cos(theta)

Since N1=m1g,  equation 5 becomes : m1a1y= - m2 sqrt(a2x2+a2y2)  cos(theta)   -  mu[2]  N1 sin(theta) -  mu[2]  N1 cos(theta)

I am confused at this stage because a1y=0, that is to say, the plane remains at the ground level surface.

Where am I wrong ? Does this comes from my previous question ?

 

I want to solve this problem with Maple and plot the solutions. Thank you for any answer !

 

RandomCompositions:= proc(n::posint, k::posint)
local
C,
Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))],
Rand:= rand(1..nops(Compositions))
;
()-> Compositions[Rand()]
end proc:

R:= RandomCompositions(9,6):
n:= 2^13:
S:= 'R()' $ n:

 

I want to compile statistics each number in a sequence cannot  occur  over twice.

The sequences that do not fit the rule above must be ommitted.

The statistic is  Fermi-Dirac statistics.

confused the Bose-Einstein condensation and Fermi-Dirac statistics.

But the theory is right.

The Interactive Embedded Components in Physics are of great importance today and will be even more in the future. Hereand leave a small tutorial of Embedded Components in Physics applied to physics. I hope that somehow you motives to continue the development of science.

 

  Interactive_Embedded_Components_in_Physics.mw      (in spanish)                 

 

Atte.

Lenin Araujo Castillo

Physics Pure

Computer Science

 

Hi everyone,

I have a question regarding the derivation of tensors/matrices.
Let's assume for simplicity, that I have a vector (6x1) s and a matrix A (6x6)defining Transpose(s)*Inverse(A)*s. From this function I want to calculate the derivative w.r.t. s. My approach would be

restartwith(Physics):
with(LinearAlgebra):
Define(s,A)

Diff(
Transpose(s)*Inverse(A)*s, s)

As a result I get

though I'd rather expect something like Inverse(A)*s + Transpose(s)*Inverse(A)

Now as I'm pretty new to Maple, I can imagine that my approach is wrong, but I don't know any better and can't seem to get any information out of the help documents.

Thanks in advance for any of your suggestions!

1 2 3 4 5 6 7 Page 1 of 8