Applications, Examples and Libraries

Share your work here

Let us consider 

MmaTranslator:-FromMma(" Table[0,{n=10},{m=2}]");

[seq([seq(0,i=1..(m := 2))],j=1..(n := 10))]

The above result is syntactically incorrect in Maple language. The translation should be 

Matrix(10,2)
#or
[seq([seq(0,i=1.. 2)],j=1..10)]

up to the Mmma's result

Table[0, {n = 10}, {m = 2}]

{{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0,0}, {0, 0}}

Another bug is as follows.

MmaTranslator:-FromMma("Sinc[x]");

Sinc(x)

whereas the expected result is piecewise(x=0,1,sin(x)/x) up to http://reference.wolfram.com/language/ref/Sinc.html

In general, the MmaTranslator package is outdated. It often returns working Mma's commands as incorrect (Concrete examples are long and need a context. These may be exposed on demand.). The question arises about the quality of other Maple translations. 

The command

plots:-implicitplot(evalc(argument((1+x+I*y)/(1-x-I*y))) <= (1/4)*Pi, x = -5 .. 5, y = -5 .. 5, crossingrefine = 1, gridrefine = 2, rational = true, filled, signchange = true, resolution = 1000);

produces an incorrect result

in view of

evalf(argument((1-4+4*I)/(1+4-4*I)));
                          2.889038378

There is a workaround 

plots:-inequal(evalc(argument((1+x+I*y)/(1-x-I*y))) <= (1/4)*Pi, x = -5 .. 5, y = -5 .. 5);

 

The command 

restart; st := time(): FunctionAdvisor(EllipticE); time()-st;

produces the result on my comp in 805.484 s. Too much time.

The command

J := int(sin(x)/(x*(1-2*a*cos(x)+a^2)), x = 0 .. infinity)assuming a::real,a^2 <>0;

outputs 

(infinity*I)*signum(a^3*(Sum(a^_k1, _k1 = 0 .. infinity))-a^2*(Sum(a^_k1, _k1 = 0 .. infinity))-a*(Sum(a^(-_k1), _k1 = 0 .. infinity))+a^2+Sum(a^(-_k1), _k1 = 0 .. infinity)+a)

which is wrong in view of 

evalf(eval(J, a = 1/2));
                       Float(undefined) I

The correct answer is Pi/(4*a)*(abs((1+a)/(1-a))-1) according to G&R 3.792.6. Numeric calculations confirm it.

Both the commands 

maximize(x*sin(t)+y*sin(2*t), t = 0 .. 2*Pi)assuming x>=0,y>=0;
minimize(x*sin(t)+y*sin(2*t), t = 0 .. 2*Pi)assuming x>=0,y>=0;

output 0. Simply no words.

The following three commands 

plots:-implicitplot(3*cos(x) = tan(y)^3, x = -Pi .. Pi, y = -(1/2)*Pi-1 .. (1/2)*Pi+1, thickness = 3, crossingrefine = 1, rational = true, signchange = true, resolution = 1000, gridrefine = 2);
plots:-implicitplot(3*cos(x) = tan(y)^3, x = -Pi .. Pi, y = -(1/2)*Pi-1 .. (1/2)*Pi+1, thickness = 3, crossingrefine = 1, rational = true, signchange = false, resolution = 1000, gridrefine = 2);
plots:-implicitplot(3*cos(x) = tan(y)^3, x = -Pi .. Pi, y = -(1/2)*Pi-1 .. (1/2)*Pi+1, thickness = 3, crossingrefine = 1, rational = true, resolution = 1000, gridrefine = 2);

produce the same incorrect plot 

It is clear the sraight lines given by y=Pi/2 and y=-Pi/2 are superfluous. It should be noticed that the Mmma's ContourPlot command without any options produces a correct plot.

Up to http://www.maplesoft.com/support/help/Maple/view.aspx?path=solve&term=solve

• 

If the solve command does not find any solutions, then if the second argument is a name or set of names, then the empty sequence (NULL) is returned; if the second argument is a list, then the empty list is returned. This means that there are no solutions, or the solve command cannot find the solutions. In the second case, a warning is issued, and the global variable_SolutionsMayBeLost is set to true.

 Let us consider 

solve({x > -Pi, (tan(x)-tan(x)^2)^2-cos(x+4*tan(x)) = -1, x < Pi}, [x]);
                               []

We see the command omits the solution x=0 without any warning. It should be noticed that Mathematica solves it, outputting

{{x -> 0}, {x -> 0}}

and the warning

Solve::incs: Warning: Solve was unable to prove that the solution set found is complete.

One may draw a conclusion on her/his own.

 

Just a simple graphical view of Maple releases over the years.

with(plots):
MapleVersions := [[1, 1982], [1.1, 1982.05], [2, 1982.33], [2.1, 1982.42], [2.15, 1982.58], [2.2, 1982.92], [3, 1983.17], [3.1, 1983.75], [3.2, 1984.25], [3.3, 1985.17], [4, 1986.25], [4.1, 1987.33], [4.2, 1987.92], [4.3, 1989.17], [5.1, 1990.58], [5.2, 1992.83], [5.3, 1994.17], [5.4, 1996], [5.5, 1997.83], [6, 1999.92], [7, 2001.5], [8, 2002.25], [9, 2003.42], [9.5, 2004.25], [10, 2005.33], [10.01, 2005.58], [10.02, 2005.83], [10.03, 2006.17], [10.04, 2006.42], [10.05, 2006.5], [10.06, 2006.75], [11, 2007.08], [11.01, 2007.5], [11.02, 2007.83], [12, 2008.33], [12.01, 2008.75], [12.02, 2008.92], [13, 2009.25], [13.01, 2009.5], [13.02, 2009.75], [14, 2010.25], [14.01, 2010.75], [15, 2011.25], [15.01, 2011.42], [16, 2012.17], [16.01, 2012.33], [17, 2013.17], [17.01, 2013.5], [18, 2014.17], [18.01, 2014.33], [18.015, 2014.5], [18.02, 2014.83], [19, 2015.17], [19.1, 2015.33], [20, 2016.17], [20.1, 2016.25], [20.15, 2016.30]]
a:=map(ListTools:-Reverse,MapleVersions): #swap x-y axis
plot(a, style = point, symbol = point)

Hi Mapleprimes,

I have made this little procedure with Maple. 

check_g_conjecture_10.pdf

similar to this next one check_g_conjecture_10.mw

This may be worth a look.

Regards,

Matthew

P.S.   see  https://en.wikipedia.org/wiki/Goldbach%27s_conjecture

In My Humble Opinion, Wikipedia is a good crowd sourced resource.

 

This post - this is a generalization of the question from  here .
Suppose we have  m  divisible objects that need to be divided equally between n persons, and so that the total number of parts (called  N  in the text of the procedure) after cutting should be a minimum. Cutting procedure exactly solves this problem. It can be proved that the estimate holds  n<=N<=n+m-1, and  N<n+m-1 if and only if there are several objects (< m), whose measures sum to be a multiple of the share (Obj in the text of the procedure).

In the attached file you can find also the text of the second procedure Cutting1, which is approximately solves the problem. The procedure Cutting1 is much faster than Cutting. But the results of their work are usually the same or Cutting procedure gives a slightly better result than Cutting1.

Required parameters of the procedure: L is the list of the measures of the objects to be cutted, n is the number of persons. The optional parameter  Name is a name or the list of names of the objects of L (if the latter then should be nops(L)=nops(Name) ).

 

Cutting:=proc(L::list(numeric), n::posint, Name::{name,list(name)}:=Object)

local m, n1, L1, L11, mes, Obj, It, M, N;

uses combinat, ListTools;

m:=nops(L); L1:=sort([seq([`if`(Name::name,Name||i,Name[i]),L[i]], i=1..m)], (a,b)->a[2]<=b[2]);

mes:=table(map(t->t[1]=t[2],L1));

Obj:=`+`(L[])/n;

It:=proc(L1, n)

local i, M, m1, S, n0, a, L2;

if nops(L1)=1 then return [[[L1[1,1],Obj]] $ n] fi;

if n=1 then return [L1] fi;

for i from 1 while `+`(seq(L1[k,2],k=1..i))<=Obj do

od;

M:=[seq(choose(L1,k)[], k=1..ceil(nops(L1)/2))];

S:=[];

for m1 in M while nops(S)=0 do n0:=`+`(seq(m1[k,2],k=1..nops(m1)))/Obj;

if type(n0,integer) then S:=m1 fi;

od;

if nops(S)=0 then

a:=Obj-`+`(seq(L1[k,2],k=1..i-1));

L2:=[[L1[i,1],L1[i,2]-a],seq(L1[k],k=i+1..nops(L1))];

 [[seq(L1[k], k=1..i-1),`if`(a=0,NULL,[L1[i,1],a])],It(L2,n-1)[]] else L2:=sort(convert(convert(L1,set) minus convert(S,set), list),(a,b)->a[2]<=b[2]);

[It(S,n0)[], It(L2,n-n0)[]] fi;

end proc;

M:=It(L1,n);

N:=add(nops(M[i]), i=1 ..nops(M));

Flatten(M, 1);

[Categorize((a,b)->a[1]=b[1],%)];

print(``);

print(cat(`Cutting scheme (total  `, N, `  parts):`) );

print(map(t->[seq(t[k,2]/`+`(seq(t[k,2],k=1..nops(t)))*t[1,1],k=1..nops(t))], %)[]);

print(``);

print(`Scheme of sharing out:`);

seq([Person||k,`+`(seq(M[k,i,2]/mes[M[k,i,1]]*M[k,i,1], i=1..nops(M[k])))],k=1..n);

end proc:

 

Examples of use.

First example from the link above:

Cutting([225,400,625], 4, Cake);  # 3 cakes must be equally divided by 4 persons

eval(%,[Cake1,Cake2,Cake3]=~[225,400,625]);  # Check

          

 

 

 

Second example (the same for 10 persons):

Cutting([225,400,625], 10, Cake);

        

 

 

Third example (7 identical apples should be divided between 12 persons):

Cutting([1 $ 7], 12, apple); 

 

 

Cutting.mw

 

 Edited:

1. Fixed a bug in the procedure Cutting  (I forgot sort the list  L2  in sub-procedure  It  if  nops(S)<>0 ).

2. Changes made to the sub-procedure  It  for the case if there are several objects (>1  and  < m), whose measures                     sum to be a multiple of the share  Obj .

 

The material below was presented in the "Semantic Representation of Mathematical Knowledge Workshop", February 3-5, 2016 at the Fields Institute, University of Toronto. It shows the approach I used for “digitizing mathematical knowledge" regarding Differential Equations, Special Functions and Solutions to Einstein's equations. While for these areas using databases of information helps (for example textbooks frequently contain these sort of databases), these are areas that, at the same time, are very suitable for using algorithmic mathematical approaches, that result in much richer mathematics than what can be hard-coded into a database. The material also focuses on an interesting cherry-picked collection of Maple functionality, that I think is beautiful, not well know, and seldom focused inter-related as here.

 

 

Digitizing of special functions,

differential equations,

and solutions to Einstein’s equations

within a computer algebra system

 

Edgardo S. Cheb-Terrab

Physics, Differential Equations and Mathematical Functions, Maplesoft

Editor, Computer Physics Communications

 

 

Digitizing (old paradigm)

 

• 

Big amounts of knowledge available to everybody in local machines or through the internet

• 

Take advantage of basic computer functionality, like searching and editing

 

 

Digitizing (new paradigm)

• 

By digitizing mathematical knowledge inside appropriate computational contexts that understand about the topics, one can use the digitized knowledge to automatically generate more and higher level knowledge

 

 

Challenges


1) how to identify, test and organize the key blocks of information,

 

2) how to access it: the interface,

 

3) how to mathematically process it to automatically obtain more information on demand

 

 

 

 

                                           Three examples


Mathematical Functions

 

"Mathematical functions, are defined by algebraic expressions. So consider algebraic expressions in general ..."

The FunctionAdvisor (basic)

 

"Supporting information on definitions, identities, possible simplifications, integral forms, different types of series expansions, and mathematical properties in general"

Examples

   

General description

   

References

   

 

Differential equation representation for generic nonlinear algebraic expressions - their use

 

"Compute differential polynomial forms for arbitrary systems of non-polynomial equations ..."

The Differential Equations representing arbitrary algebraic expresssions

   

Deriving knowledge: ODE solving methods

   

Extending the mathematical language to include the inverse functions

   

Solving non-polynomial algebraic equations by solving polynomial differential equations

   

References

   

 

Branch Cuts of algebraic expressions

 

"Algebraically compute, and visualize, the branch cuts of arbitrary mathematical expressions"

Examples

   

References

   

 

Algebraic expresssions in terms of specified functions

 

"A conversion network for arbitrary mathematical expressions, to rewrite them in terms of different functions in flexible ways"

Examples

   

General description

   

References

   

 

Symbolic differentiation of algebraic expressions

 

"Perform symbolic differentiation by combining different algebraic techniques, including functions of symbolic sequences and Faà di Bruno's formula"

Examples

   

References

   

 

Ordinary Differential Equations

 

"Beyond the concept of a database, classify an arbitrary ODE and suggest solution methods for it"

General description

   

Examples

   

References

   

 

Exact Solutions to Einstein's equations

 

 

Lambda*g[mu, nu]+G[mu, nu] = 8*Pi*T[mu, nu]

 

"The authors of "Exact solutions toEinstein's equations" reviewed more than 4,000 papers containing solutions to Einstein’s equations in the general relativity literature, organized the whole material into chapters according to the physical properties of these solutions. These solutions are key in the area of general relativity, are now all digitized and become alive in a worksheet"


The ability to search the database according to the physical properties of the solutions, their classification, or just by parts of keywords (old paradigm) changes the game.

More important, within a computer algebra system this knowledge becomes alive (new paradigm).

• 

The solutions are turned active by a simple call to one commend, called the g_  spacetime metric.

• 

Everything else gets automatically derived and set on the fly ( Christoffel symbols  , Ricci  and Riemann  tensors orthonormal and null tetrads , etc.)

• 

Almost all of the mathematical operations one can perform on these solutions are implemented as commands in the Physics  and DifferentialGeometry  packages.

• 

All the mathematics within the Maple library are instantly ready to work with these solutions and derived mathematical objects.

 

Finally, in the Maple PDEtools package , we have all the mathematical tools to tackle the equivalence problem around these solutions.

Examples

   

References

   

 

Download:  Digitizing_Mathematical_Information.mw,    Digitizing_Mathematical_Information.pdf

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

This presentation is on an undergrad intermediate Quantum Mechanics topic. Tackling the problem within a computer algebra worksheet in the way shown below is actually the novelty, using the Physics package to formulate the problem with quantum operators and related algebra rules in tensor notation.

 

Quantization of the Lorentz Force

 

Pascal Szriftgiser1 and Edgardo S. Cheb-Terrab2 

(1) Laboratoire PhLAM, UMR CNRS 8523, Université Lille 1, F-59655, France

(2) Maplesoft

 

We consider the case of a quantum, non-relativistic, particle with mass m and charge q evolving under the action of an arbitrary time-independent magnetic field "B=Curl(A(x,y,z)), "where `#mover(mi("A",mathcolor = "olive"),mo("&rarr;"))` is the vector potential. The Hamiltonian for this system is

H = (`#mover(mi("p",mathcolor = "olive"),mo("&rarr;"))`-q*`#mover(mi("A",mathcolor = "olive"),mo("&rarr;"))`(X))^2/(2*m)

where `#mover(mi("p",mathcolor = "olive"),mo("&rarr;"))` is the momentum of the particle, and the force acting in this particle, also called the Lorentz force, is given by

 

`#mover(mi("F",mathcolor = "olive"),mo("&rarr;"))` = m*(diff(v(t), t))

 

where `#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))` is the quantized velocity of the particle, and all of  H, `#mover(mi("p",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("A",mathcolor = "olive"),mo("&rarr;"))` and `#mover(mi("F",mathcolor = "olive"),mo("&rarr;"))` are Hermitian quantum operators representing observable quantities.

 

In the classic (non-quantum) case, `#mover(mi("F"),mo("&rarr;"))` for such a particle in the absence of electrical field is given by

 

`#mover(mi("F"),mo("&rarr;"))` = `&x`(q*`#mover(mi("v"),mo("&rarr;"))`, `#mover(mi("B"),mo("&rarr;"))`) ,

 

Problem: Departing from the Hamiltonian, show that in the quantum case the Lorentz force is given by [1]

 

`#mover(mi("F",mathcolor = "olive"),mo("&rarr;"))` = (1/2)*q*(`&x`(`#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))`)-`&x`(`#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))`))

 

[1] Photons et atomes, Introduction à l'électrodynamique quantique, p. 179, Claude Cohen-Tannoudji, Jacques Dupont-Roc et Gilbert Grynberg - EDP Sciences janvier 1987.

 

Solution

 

We choose to tackle the problem in Heisenberg's picture of quantum mechanices, where the state of a system is static and only the quantum operators evolve in time according to

``

diff(O(t), t) = I*Physics:-Commutator(H, O(t))/`&hbar;`

 

Also, the algebraic manipulations are simpler using tensor abstract notation instead of the standard 3D vector notation. We then start setting the framework for the problem, a system of coordinates X, indicating the dimension of the tensor space to be 3 and the metric Euclidean, and that we will use lowercaselatin letters to represent tensor indices. In addition, not necessary but for convenience, we set the lowercase latin i to represent the imaginary unit and we request automaticsimplification so that the output of everything comes automatically simplified in size.

 

restart; with(Physics); interface(imaginaryunit = i)

Setup(mathematicalnotation = true, automaticsimplification = true, coordinates = X, dimension = 3, metric = Euclidean, spacetimeindices = lowercaselatin, quiet)

[automaticsimplification = true, coordinatesystems = {X}, dimension = 3, mathematicalnotation = true, metric = {(1, 1) = 1, (2, 2) = 1, (3, 3) = 1}, spacetimeindices = lowercaselatin]

(1)

 

Next we indicate the letters we will use to represent the quantum operators with which we will work, and also the standard commutation rules between position and momentum, always the starting point when dealing with quantum mechanics problems

 

Setup(quantumoperators = {F}, hermitianoperators = {A, B, H, p, r, v, x}, realobjects = {`&hbar;`, m, q}, algebrarules = {%Commutator(p[k], p[n]) = 0, %Commutator(x[k], p[l]) = I*`&hbar;`*KroneckerDelta[k, l], %Commutator(x[k], x[l]) = 0})

[algebrarules = {%Commutator(p[k], p[n]) = 0, %Commutator(x[k], p[l]) = I*`&hbar;`*Physics:-KroneckerDelta[k, l], %Commutator(x[k], x[l]) = 0}, hermitianoperators = {A, B, H, p, r, v, x}, quantumoperators = {A, B, F, H, p, r, v, x}, realobjects = {`&hbar;`, m, q, x1, x2, x3, %dAlembertian, Physics:-dAlembertian}]

(2)

 

Note that we start not indicating F as Hermitian, in order to arrive at that result. The quantum operators A, B, and F are explicit functions of X, so to avoid redundant display of this functionality on the screen we use

 

CompactDisplay((A, B, F)(X))

A(x1, x2, x3)*`will now be displayed as`*A

 

B(x1, x2, x3)*`will now be displayed as`*B

 

F(x1, x2, x3)*`will now be displayed as`*F

(3)

Define now as tensors the quantum operators that we will use with tensorial notation (recalling: for these, Einstein's sum rule for repeated indices will be automatically applied when simplifying)

 

Define(x, p, v, A, B, F, quiet)

{A, B, F, p, v, x, Physics:-Dgamma[a], Physics:-Psigma[a], Physics:-d_[a], Physics:-g_[a, b], Physics:-KroneckerDelta[a, b], Physics:-LeviCivita[a, b, c], Physics:-SpaceTimeVector[a](X)}

(4)

The Hamiltonian,

H = (`#mover(mi("p",mathcolor = "olive"),mo("&rarr;"))`-q*`#mover(mi("A",mathcolor = "olive"),mo("&rarr;"))`(X))^2/(2*m)

in tensorial notation, is given by

H = (p[n]-q*A[n](X))^2/(2*m)

H = (1/2)*Physics:-`^`(p[n]-q*A[n](X), 2)/m

(5)

Generally speaking to arrive at  ```#mover(mi("F",mathcolor = "olive"),mo("&rarr;"))` = (1/2)*q*(`&x`(`#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))`)-`&x`(`#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))`)) what we now need to do is

1) Express this Hamiltonian (5) in terms of the velocity

 

And, recalling that, in Heisenberg's picture, quantum operators evolve in time according to

diff(O(t), t) = I*Physics:-Commutator(H, O(t))/`&hbar;`

 

2) Take the commutator of H with the velocity itself to obtain its time derivative and, from `#mover(mi("F",mathcolor = "olive"),mo("&rarr;"))` = m*(diff(v(t), t)) , that commutator is already the force up to some constant factors.

 

To get in contact with the basic commutation rules between position and momentum behind quantum phenomena, the quantized velocity itself can be computed as the time derivative of the position operator, i.e as the commutator of x[k] with H

I*Commutator(H = (1/2)*Physics[`^`](p[n]-q*A[n](X), 2)/m, x[k])/`&hbar;`

I*Physics:-Commutator(H, x[k])/`&hbar;` = (1/2)*(I*q^2*Physics:-AntiCommutator(A[n](X), Physics:-Commutator(A[n](X), x[k]))-I*q*Physics:-AntiCommutator(p[n], Physics:-Commutator(A[n](X), x[k]))-2*(q*A[n](X)-p[n])*Physics:-KroneckerDelta[k, n]*`&hbar;`)/(`&hbar;`*m)

(6)

This expression for the velocity, that involves commutators between the potential A[n](X), the position x[k] and the momentum p[n], can be simplified taking into account the basic quantum algebra rules between position and momentum. We assume that A[n](X)(X) can be decomposed into a formal power series (possibly infinite) of the x[k], hence all the A[n](X) commute between themselves as well as with all the x[k]

 

{%Commutator(A[k](X), x[l]) = 0, %Commutator(A[k](X), A[l](X)) = 0}

{%Commutator(A[k](X), x[l]) = 0, %Commutator(A[k](X), A[l](X)) = 0}

(7)

(Note: in some cases, this is not true, but those cases are beyond the scope of this worksheet.)

 

Add these rules to the algebra rules already set so that they are all taken into account when simplifying things

 

Setup(algebrarules = {%Commutator(A[k](X), x[l]) = 0, %Commutator(A[k](X), A[l](X)) = 0})

[algebrarules = {%Commutator(p[k], p[n]) = 0, %Commutator(x[k], p[l]) = I*`&hbar;`*Physics:-KroneckerDelta[k, l], %Commutator(x[k], x[l]) = 0, %Commutator(A[k](X), x[l]) = 0, %Commutator(A[k](X), A[l](X)) = 0}]

(8)

Simplify(I*Physics[Commutator](H, x[k])/`&hbar;` = (1/2)*(I*q^2*Physics[AntiCommutator](A[n](X), Physics[Commutator](A[n](X), x[k]))-I*q*Physics[AntiCommutator](p[n], Physics[Commutator](A[n](X), x[k]))-2*(q*A[n](X)-p[n])*Physics[KroneckerDelta][k, n]*`&hbar;`)/(`&hbar;`*m))

I*Physics:-Commutator(H, x[k])/`&hbar;` = (-A[k](X)*q+p[k])/m

(9)

The right-hand side of (9) is then the kth component of the velocity tensor quantum operator, the relationship is the same as in the classical case

v[k] = rhs(I*Physics[Commutator](H, x[k])/`&hbar;` = (-A[k](X)*q+p[k])/m)

v[k] = (-A[k](X)*q+p[k])/m

(10)

and with this the Hamiltonian (5) can now be rewritten in term of the velocity completing step 1)

simplify(H = (1/2)*Physics[`^`](p[n]-q*A[n](X), 2)/m, {SubstituteTensorIndices(k = n, (rhs = lhs)(v[k] = (-A[k](X)*q+p[k])/m))})

H = (1/2)*m*Physics:-`^`(v[n], 2)

(11)

For step 2), to compute

 `#mover(mi("F",mathcolor = "olive"),mo("&rarr;"))` = m*(diff(v(t), t)) and m*(diff(v(t), t)) = I*m*Physics:-Commutator(H, v(t)[k])/`&hbar;` 

 

we need the commutator between the different components of the quantized velocity which, contrary to what happens in the classical case, do not commute. For this purpose, take the commutator between (10) with itself after replacing the free index

Commutator(v[k] = (-A[k](X)*q+p[k])/m, SubstituteTensorIndices(k = n, v[k] = (-A[k](X)*q+p[k])/m))

Physics:-Commutator(v[k], v[n]) = -q*(Physics:-Commutator(A[k](X), p[n])+Physics:-Commutator(p[k], A[n](X)))/m^2

(12)

To simplify (12), we use the fact that if f  is a commutative mapping that can be decomposed into a formal power series in all the complex plan (which is assumed to be the case for all A[n](X)(X)), then

Physics:-Commutator(p[k], f(x, y, z)) = -I*`&hbar;`*`&PartialD;`[k](f(x, y, z))

where p[k]"=-i `&hbar;` `&PartialD;`[k] " is the momentum operator along the x[k] axis. This relation reads in tensor notation:

Commutator(p[k], A[n](X)) = -I*`&hbar;`*d_[k](A[n](X))

Physics:-Commutator(p[k], A[n](X)) = -I*`&hbar;`*Physics:-d_[k](A[n](X), [X])

(13)

Add this rule to the rules previously set in order to automatically take it into account in (12)

Setup(Physics[Commutator](p[k], A[n](X)) = -I*`&hbar;`*Physics[d_][k](A[n](X), [X]))

[algebrarules = {%Commutator(p[k], p[n]) = 0, %Commutator(p[k], A[n](X)) = -I*`&hbar;`*Physics:-d_[k](A[n](X), [X]), %Commutator(x[k], p[l]) = I*`&hbar;`*Physics:-KroneckerDelta[k, l], %Commutator(x[k], x[l]) = 0, %Commutator(A[k](X), x[l]) = 0, %Commutator(A[k](X), A[l](X)) = 0}]

(14)

Physics[Commutator](v[k], v[n]) = -q*(Physics[Commutator](A[k](X), p[n])+Physics[Commutator](p[k], A[n](X)))/m^2

Physics:-Commutator(v[k], v[n]) = -I*q*`&hbar;`*(Physics:-d_[n](A[k](X), [X])-Physics:-d_[k](A[n](X), [X]))/m^2

(15)

Also add this other rule so that it is taken into account automatically

Setup(Physics[Commutator](v[k], v[n]) = -I*q*`&hbar;`*(Physics[d_][n](A[k](X), [X])-Physics[d_][k](A[n](X), [X]))/m^2)

[algebrarules = {%Commutator(p[k], p[n]) = 0, %Commutator(p[k], A[n](X)) = -I*`&hbar;`*Physics:-d_[k](A[n](X), [X]), %Commutator(v[k], v[n]) = -I*q*`&hbar;`*(Physics:-d_[n](A[k](X), [X])-Physics:-d_[k](A[n](X), [X]))/m^2, %Commutator(x[k], p[l]) = I*`&hbar;`*Physics:-KroneckerDelta[k, l], %Commutator(x[k], x[l]) = 0, %Commutator(A[k](X), x[l]) = 0, %Commutator(A[k](X), A[l](X)) = 0}]

(16)

Recalling now the expression of the Hamiltonian (11) as a function of the velocity, one can compute the components of the force operator  "()Component(v*B,k)=m (v[k])=(i m [H,v[k]][-])/`&hbar;`"

F[k](X) = I*m*%Commutator(rhs(H = (1/2)*m*Physics[`^`](v[n], 2)), v[k])/`&hbar;`

F[k](X) = I*m*%Commutator((1/2)*m*Physics:-`^`(v[n], 2), v[k])/`&hbar;`

(17)

Simplify this expression for the quantized force taking the quantum algebra rules (16) into account

Simplify(F[k](X) = I*m*%Commutator((1/2)*m*Physics[`^`](v[n], 2), v[k])/`&hbar;`)

F[k](X) = (1/2)*q*(-Physics:-`*`(Physics:-d_[n](A[k](X), [X]), v[n])+Physics:-`*`(Physics:-d_[k](A[n](X), [X]), v[n])-Physics:-`*`(v[n], Physics:-d_[n](A[k](X), [X]))+Physics:-`*`(v[n], Physics:-d_[k](A[n](X), [X])))

(18)

It is not difficult to verify that this is the antisymmetrized vector product `&x`(`#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))`). Departing from `#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))` = `&x`(VectorCalculus[Nabla], `#mover(mi("A",mathcolor = "olive"),mo("&rarr;"))`) expressed using tensor notation,

B[c](X) = LeviCivita[c, n, m]*d_[n](A[m](X))

B[c](X) = -Physics:-LeviCivita[c, m, n]*Physics:-d_[n](A[m](X), [X])

(19)

and taking into acount that

 Component(`&x`(`#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))`), k) = `&epsilon;`[b, c, k]*v[b]*B[c](X) 

multiply both sides of (19) by `&epsilon;`[b, c, k]*v[b], getting

LeviCivita[k, b, c]*v[b]*(B[c](X) = -Physics[LeviCivita][c, m, n]*Physics[d_][n](A[m](X), [X]))

Physics:-LeviCivita[b, c, k]*Physics:-`*`(v[b], B[c](X)) = -Physics:-LeviCivita[b, c, k]*Physics:-LeviCivita[c, m, n]*Physics:-`*`(v[b], Physics:-d_[n](A[m](X), [X]))

(20)

Simplify(Physics[LeviCivita][b, c, k]*Physics[`*`](v[b], B[c](X)) = -Physics[LeviCivita][b, c, k]*Physics[LeviCivita][c, m, n]*Physics[`*`](v[b], Physics[d_][n](A[m](X), [X])))

Physics:-LeviCivita[b, c, k]*Physics:-`*`(v[b], B[c](X)) = Physics:-`*`(v[m], Physics:-d_[k](A[m](X), [X]))-Physics:-`*`(v[n], Physics:-d_[n](A[k](X), [X]))

(21)

Finally, replacing the repeated index m by n 

SubstituteTensorIndices(m = n, Physics[LeviCivita][b, c, k]*Physics[`*`](v[b], B[c](X)) = Physics[`*`](v[m], Physics[d_][k](A[m](X), [X]))-Physics[`*`](v[n], Physics[d_][n](A[k](X), [X])))

Physics:-LeviCivita[b, c, k]*Physics:-`*`(v[b], B[c](X)) = Physics:-`*`(v[n], Physics:-d_[k](A[n](X), [X]))-Physics:-`*`(v[n], Physics:-d_[n](A[k](X), [X]))

(22)

Likewise, for

 Component(`&x`(`#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))`), k) = `&epsilon;`[b, c, k]*B[b]*B[c](X) 

multiplying (19), this time from the right instead of from the left, we get

Simplify(((B[c](X) = -Physics[LeviCivita][c, m, n]*Physics[d_][n](A[m](X), [X]))*LeviCivita[k, b, c])*v[b])

Physics:-LeviCivita[b, c, k]*Physics:-`*`(B[c](X), v[b]) = Physics:-`*`(Physics:-d_[k](A[m](X), [X]), v[m])-Physics:-`*`(Physics:-d_[n](A[k](X), [X]), v[n])

(23)

SubstituteTensorIndices(m = n, Physics[LeviCivita][b, c, k]*Physics[`*`](B[c](X), v[b]) = Physics[`*`](Physics[d_][k](A[m](X), [X]), v[m])-Physics[`*`](Physics[d_][n](A[k](X), [X]), v[n]))

Physics:-LeviCivita[b, c, k]*Physics:-`*`(B[c](X), v[b]) = Physics:-`*`(Physics:-d_[k](A[n](X), [X]), v[n])-Physics:-`*`(Physics:-d_[n](A[k](X), [X]), v[n])

(24)

Simplifying now the expression (18) for the quantized force taking into account (22) and (24) we get

simplify(F[k](X) = (1/2)*q*(-Physics[`*`](Physics[d_][n](A[k](X), [X]), v[n])+Physics[`*`](Physics[d_][k](A[n](X), [X]), v[n])-Physics[`*`](v[n], Physics[d_][n](A[k](X), [X]))+Physics[`*`](v[n], Physics[d_][k](A[n](X), [X]))), {(rhs = lhs)(Physics[LeviCivita][b, c, k]*Physics[`*`](v[b], B[c](X)) = Physics[`*`](v[n], Physics[d_][k](A[n](X), [X]))-Physics[`*`](v[n], Physics[d_][n](A[k](X), [X]))), (rhs = lhs)(Physics[LeviCivita][b, c, k]*Physics[`*`](B[c](X), v[b]) = Physics[`*`](Physics[d_][k](A[n](X), [X]), v[n])-Physics[`*`](Physics[d_][n](A[k](X), [X]), v[n]))})

F[k](X) = (1/2)*q*Physics:-LeviCivita[b, c, k]*(Physics:-`*`(v[b], B[c](X))+Physics:-`*`(B[c](X), v[b]))

(25)

i.e.

`#mover(mi("F",mathcolor = "olive"),mo("&rarr;"))` = (1/2)*q*(`&x`(`#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))`)-`&x`(`#mover(mi("B",mathcolor = "olive"),mo("&rarr;"))`, `#mover(mi("v",mathcolor = "olive"),mo("&rarr;"))`))

in tensor notation. Finally, we note that this operator is Hermitian as expected

(F[k](X) = (1/2)*q*Physics[LeviCivita][b, c, k]*(Physics[`*`](v[b], B[c](X))+Physics[`*`](B[c](X), v[b])))-Dagger(F[k](X) = (1/2)*q*Physics[LeviCivita][b, c, k]*(Physics[`*`](v[b], B[c](X))+Physics[`*`](B[c](X), v[b])))

F[k](X)-Physics:-Dagger(F[k](X)) = 0

(26)



Download:  Quantization_of_the_Lorentz_force.mw,   Quantization_of_the_Lorentz_force.pdf


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

After days of fruitlessly searching the help files and the Internet for a means of converting a Dataseries of strings into numeric values in Maple I changed tack and determined how to do it myself.

I was surprised there was no built in Maple function to do this. From searching the Internet I can see I am not alone.
Since there are no other solutions on the net, here is mine:

toNumeric := (y) -> map(x->parse(x),y);

This creates the function toNumeric() that accepts a DataSeries of text values and returns it converted to a Dataseries of numeric values.

thing := DataSeries(["10", "20", "30", "55.9"], 'labels' = ["a", "b", "c", "d"]);
thing := toNumeric(thing); 

dataframething := DataFrame([["cow", "sheep", "goat", "alpaca"], ["10", "20", "30", "55.9"]], rows = ["a", "b", "c", "d"]);
dataframething[2] := toNumeric(dataframething[2]);


If you want to see this in Maple, try:
 typecastdataseries-maple




 

Students using Maple often have different needs than non-students. Students need more than just a final answer; they are looking to gain an understanding of the mathematical concepts behind the problems they are asked to solve and to learn how to solve problems. They need an environment that allows them to explore the concepts and break problems down into smaller steps.

The Student packages in Maple offer focused learning environments in which students can explore and reinforce fundamental concepts for courses in Precalculus, Calculus, Linear Algebra, Statistics, and more. For example, Maple includes step-by-step tutors that allow students to practice integration, differentiation, the finding of limits, and more. The Integration Tutor, shown below, lets a student evaluate an integral by selecting an applicable rule at each step. Maple will also offer hints or show the next step, if asked.  The tutor doesn't only demonstrate how to obtain the result, but is designed for practicing and learning.

For this blog post, I’d like to focus in on an area of great interest to students: showing step-by-step solutions for a variety of problems in Maple.

Several commands in the Student packages can show solution steps as either output or inline in an interactive pop-up window. The first few examples return the solution steps as output.

Precalculus problems:

The Student:-Basics sub-package provides a collection of commands to help students and teachers explore fundamental mathematical concepts that are core to many disciplines. It features two commands, both of which return step-by-step solutions as output.

The ExpandSteps command accepts a product of polynomials and displays the steps required to expand the expression:

with(Student:-Basics):
ExpandSteps( (a^2-1)/(a/3+1/3) );

The LinearSolveSteps command accepts an equation in one variable and displays the steps required to solve for that variable.

with(Student:-Basics):
LinearSolveSteps( (x+1)/y = 4*y^2 + 3*x, x );

This command also accepts some nonlinear equations that can be reduced down to linear equations.

Calculus problems:

The Student:-Calculus1 sub-package is designed to cover the basic material of a standard first course in single-variable calculus. Several commands in this package provide interactive tutors where you can step through computations and step-by-step solutions can be returned as standard worksheet output.

Tools like the integration, differentiation, and limit method tutors are interactive interfaces that allow for exploration. For example, similar to the integration-methods tutor above, the differentiation-methods tutor lets a student obtain a derivative by selecting the appropriate rule that applies at each step or by requesting a complete solution all at once. When done, pressing “Close” prints out to the Maple worksheet an annotated solution containing all of the steps.

For example, try entering the following into Maple:

with(Student:-Calculus1):
x*sin(x);

Next, right click on the Matrix and choose “Student Calculus1 -> Tutors -> Differentiation Methods…

The Student:-Calculus1 sub-package is not alone in offering this kind of step-by-step solution finding. Other commands in other Student packages are also capable of returning solutions.

Linear Algebra Problems:

The Student:-LinearAlgebra sub-package is designed to cover the basic material of a standard first course in linear algebra. This sub-package features similar tutors to those found in the Calculus1 sub-package. Commands such as the Gaussian EliminationGauss-Jordan Elimination, Matrix Inverse, Eigenvalues or Eigenvectors tutors show step-by-step solutions for linear algebra problems in interactive pop-up tutor windows. Of these tutors, a personal favourite has to be the Gauss-Jordan Elimination tutor, which were I still a student, would have saved me a lot of time and effort searching for simple arithmetic errors while row-reducing matrices.

For example, try entering the following into Maple:

with(Student:-LinearAlgebra):
M:=<<77,9,31>|<-50,-80,43>|<25,94,12>|<20,-61,-48>>;

Next, right click on the Matrix and choose “Student Linear Algebra -> Tutors -> Gauss-Jordan Elimination Tutor

This tutor makes it possible to step through row-reducing a matrix by using the controls on the right side of the pop-up window. If you are unsure where to go next, the “Next Step” button can be used to move forward one-step. Pressing “All Steps” returns all of the steps required to row reduce this matrix.

When this tutor is closed, it does not return results to the Maple worksheet, however it is still possible to use the Maple interface to step through performing elementary row operations and to capture the output in the Maple worksheet. By loading the Student:-LinearAlgebra package, you can simply use the right-click context menu to apply elementary row operations to a Matrix in order to step through the operations, capturing all of your steps along the way!

An interactive application for showing steps for some problems:

While working on this blog post, it struck me that we did not have any online interactive applications that could show solution steps, so using the commands that I’ve discussed above, I authored an application that can expand, solve linear problems, integrate, differentiate, or find limits. You can interact with this application here, but note that this application is a work in progress, so feel free to email me (maplepm (at) Maplesoft.com) any strange bugs that you may encounter with it.

More detail on each of these commands can be found in Maple’s help pages.

 

We assume that the radius of the outer stationary circle is  1. If we set the radius  x  of the inner stationary circle, all the other circles are uniquely determined by solving the system Sys.  Should be  x<=1/3 . If  x=1/3  then all the inner circles have a radius  1/3 . The following picture explains the meaning of symbols in the procedure Circles:

                                   

 

 

Circles:=proc(x)

local OO, O1, O2, O3, O4, O2x, O2y, O3x, O3y, OT, T1, T2, T3, s, t, dist, Sys, Sol, sol, y, u, v, z, C0, R0, P;

uses plottools, plots;

OO:=[0,0]: O1:=[x+y,0]: O2:=[O2x,O2y]: O3:=[O3x,O3y]: O4:=[-x-z,0]: OT:=[x+2*y-1,0]:

T1:=(O2*~y+O1*~u)/~(y+u): T2:=(O3*~u+O2*~v)/~(u+v): T3:=(O4*~v+O3*~z)/~(v+z):

solve({(T2-T1)[1]*(s-((T1+T2)/2)[1])+(T2-T1)[2]*(t-((T1+T2)/2)[2])=0, (T3-T2)[1]*(s-((T2+T3)/2)[1])+(T3-T2)[2]*(t-((T3+T2)/2)[2])=0}, {s,t}):

assign(%);

dist:=(A,B)->sqrt((B[1]-A[1])^2+(B[2]-A[2])^2):

Sys:={dist(O1,O2)^2=(y+u)^2, dist(OO,O2)^2=(x+u)^2, dist(O2,O3)^2=(u+v)^2, dist(OO,O3)^2=(x+v)^2, dist(O3,O4)^2=(z+v)^2, x+y+z=1, dist(O2,OT)^2=(1-u)^2, dist(O3,OT)^2=(1-v)^2};

Sol:=op~([allvalues([solve(Sys)])]);

sol:=select(i->is(eval(convert([y>0,u>0,v>0,z>0,O2y>0,x<=y,u<=y,v<=u,z<=v],`and`),i)), Sol)[];

assign(sol);

O1:=[x+y,0]: O2:=[O2x,O2y]: O3:=[O3x,O3y]: O4:=[-x-z,0]: OT:=[x+2*y-1,0]:

C0:=eval([s,t],sol);

R0:=eval(dist(T1,C0),sol):

P:=proc(phi)

local eq, r1, r, R, Ot, El, i, S, s, t, P1, P2;

uses plots,plottools;

eq:=1-dist([r*cos(s),r*sin(s)],OT)=r-x;

r1:=solve(eq,r);

r:=eval(r1,s=phi);

R[1]:=evalf(r-x);

Ot[1]:=evalf([r*cos(phi),r*sin(phi)]);

El:=plot([r1*cos(s),r1*sin(s),s=0..2*Pi],color="Green",thickness=3);

for i from 2 to 6 do

S:=[solve({1-dist(OT,[s,t])=dist(Ot[i-1],[s,t])-R[i-1], 1-dist(OT,[s,t])=dist(OO,[s,t])-x})];

P1:=eval([s,t],S[1]); P2:=eval([s,t],S[2]);

Ot[i]:=`if`(evalf(Ot[i-1][1]*P1[2]-Ot[i-1][2]*P1[1])>0,P1,P2);

R[i]:=dist(Ot[i],OO)-x;

od;

display(El,seq(disk(Ot[k],0.012),k=1..6),circle(C0,R0,color=gold,thickness=3),circle([x+2*y-1,0],1, color=blue,thickness=4), circle(OO,x, color=red,thickness=4), seq(circle(Ot[k],R[k], thickness=3),k=1..6), scaling=constrained, axes=none);

end proc:

animate(P,[phi], phi=0..Pi, frames=120);

end proc:  

 

Example of use (I got  x=0.22  just by measuring the ruler displayed original animation):

Circles(0.22);

                               

 

 

The curve on the following animation is an astroid (a special case of hypocycloid). See wiki for details. Hypocycloid procedure creates animation for any hypocycloid.  Parameters of the procedure: R is the radius of the outer circle, r is the radius of the inner circle.

Hypocycloid:=proc(R,r)

local A, B, f, g, F;

uses plots,plottools;

A:=circle(R,color=green,thickness=4):

B:=display(circle([R-r,0],r,color=red,thickness=4),line([R-r,0],[R,0],color=red,thickness=4)):

f:=t->plot([(R-r)*cos(s)+r*cos((R-r)/r*s),(R-r)*sin(s)-r*sin((R-r)/r*s),s=0..t],color=blue,thickness=4):

g:=t->rotate(rotate(B,-R/r*t,[R-r,0]),t):

F:=t->display(A,f(t),g(t),scaling=constrained):

animate(F,[t], t=0..2*Pi*denom(R/r), frames=90);

end proc:

 

Examples of use:

Hypocycloid(4,1); 

                                      

 

 

Hypocycloid(5,3);

                                      

 

 

 Круги.mw

First 30 31 32 33 34 35 36 Last Page 32 of 71