ecterrab

14727 Reputation

24 Badges

20 years, 330 days

MaplePrimes Activity


These are replies submitted by ecterrab

@Stev Eland 

Adjusments in all the packages mentioned in the title of this reply (so not just Physics) are included in the single mla Maple library distributed in the Maplesoft R&D Physics webpage. Just install it as per the instructions found in the zip file and you see the display of `*` within DifferentialGeometry corrected. Make sure you download the file for Maple 2015.

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

@Markiyan Hirnyk 

You need to realize that this thread, started by Samir impeccably, is about "What is new in Maple 2016" and impresses Samir the most, and not about "How does Maple and Mathematica compare with each other" in "this", then in that", which by the way was already discussed in Mapleprimes, beyond the answers given to you above, e.g. explaining that Physics in Maple 2016 is not at all just about General Relativity as you said, and that nothing like the Physics package exists in Mathematica. So I suggest please, Markiyan, let's keep the focus of the thread, and you are invited to continue comparing the systems in every aspect you find relevant, please, in the corresponding threads, or if you feel strong about just open another thread. Thanks.

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

PS: (back from vacations).

@Markiyan Hirnyk 

You answered vv  saying: “2. You wrote "Great Physics". The Physics package is targeted on general relativity which does not belong to the mainstream of modern physics.”

With due respect, I disagree with you regarding both statements, you seem to be uninformed. For what is going on in theoretical physics nowadays check for instance this map of the problems and their relationship from Aug/2015 (by the way a very nice summary for whoever is interested):

Consider how many of the titles above have to do with general relativity (almost all of them). You may want to read the article itself. In very short: the unification of gravity with the other forces (as well as what does that mean for our definition of space and time - brilliant and accessible presentation by Nima, from Princeton) is one of the main problems today. In the same line, consider for instance the recent detection of gravitational waves hailed as "breakthrough of the century" (for some people this is even bigger than the detection of the Higgs boson).

Regarding the “Physics” Maple package, it is not targeted to general relativity - it just includes it. Since this has also been asked in the past by Ogilvie, I repost here a reply given in October in Mapleprimes:

Please let’s not forget that general relativity (GR) is indeed part of physics, and this post just happened to be about that, which doesn’t mean that physics in Maple is only about GR.

As people using the package know, Physics has basic and advanced functionality for Quantum Mechanics since it entered the Maple library, including a full implementation of anticommutative and noncommutative operators and functions, related operations (including functional differentiation), Commutators, Anticommutators, Creation and Annihilation operator commands, pre-defined and customizable algebra rules, a whole implementation of Dirac notation for vector calculus on a space of quantum physical states, … to mention but a few; the list of functionality available is really large.

Perhaps it is useful to point to some application examples on Quantum Mechanics posted in this Mapleprimes forum in the past, developed using the same Physics package (that today implemented this most thorough digital database in existence for solutions to Einstein's equations):

The following link is also interesting because it shows a balanced set of applications in different physics areas, and the section on Quantum Mechanics also features a subsection on the use of the Physics package in developing proofs regarding properties of operations between quantum operators, something I don't recall having seen before in any computer algebra system, commercial or brewed at universities

For completeness, this other link to a mini-course on computer algebra for physicists is somehow ambitious, in that it shows an entry point to using such a wide-range-of-areas package as Physics is, while at the same time it is a compact tutorial for people who - simply put - never used computer algebra

Note as well that "what is new in Physics in Maple 2016" is not restricted to the database of solutions to Einstein's equations.

 

(Returning to my vacations)

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

Today we added 74 more solutions and derived information to the database, and with that we finished the book! It is a set of 989 spacetime metrics (solutions) , the largest databse of solutions to Einstein's equations in the world. The metrics added today are from Chapter 34, 35, 36, 37 and 38.

At this point, not only all these solutions are digitized. More important: they were digitized within a computer algebra sytem, where they become "computationally alive", it is possible to work with them algebraically, symbolically (tensor analysis), transforming them, analyzing their properties or those of the transformed metrics, classifying them, computing their invariants, working with them using the tetrads formalism, and a large etc. This is a historic result, that involved the efforts of many people, not to mention the authors of the more than 4,000 papers in the general relativity literature that in turn were condensed by the authors of the "Exact solutions to Einstein's equations" book. 

As usual, in order to have this new development installed in Maple 2015, you need to update your Physics library from the Maplesoft R&D Physics webpage.

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

@wgraf 
My understanding of this is that Physics actually handles different metrics in a much more compact way than GRTensor does, not the other way around (you may want to check for instance the online help page for ?Physics:-g_). Also, not only you can define your spacetime metric (tetrads included) in any desired manner but, also: regarding the coded metrics that come with GRTensor, Maple's Physics has really much more metrics coded, actually it has the largest database of metrics in the world - nothing less.

So, I cannot help you in the conversion activity you mention, but if I were you I would give a look at all this; chances are that facing the task of updating your work is less time-consuming or error-prone than staying stuck with an old package that in addition, apparently, from what you say, conflicts with Maple in basic ways (sqrt). Regarding the "error-prone": note that you can enter a metric in Physics in so many different ways, including by passing the corresponding line element or just a matrix, so maybe you do not need to retype anything at the time of updating your work.

Anyway, the best wishes for your project.

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

Updating this post: Today we added 54 more solutions and derived information to the database, so the current total is 897 spacetime metrics (solutions) and now we are rapidly approaching the end of this project. This is not only the largest database of solutions to Einstein's equations in the world but also the only one that provides the frame to algebraically work with these solutions in all directions, including of course transforming them and analyzing the corresponding result, etc. All this bring these metrics to a sort of "computationally alive" state unseen before. The metrics added today are from Chapter 32 and 33.

As usual, in order to have this new development installed in Maple 2015, you need to update your Physics library from the Maplesoft R&D Physics webpage.

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

@maple fan 

Hi

Note that Zernike's polynomials are rare 'functions', not mentioned for instance in the modern NIST Digital Library of Mathematical Functions (that includes all sorts of special polynomials, of course). So there is little chance these will be implemented ... unless someone comes up with an argument about the generality of their use or their potential or advantage of these functions for the future (e.g. as for the Heun functions - these actually found in the NIST library). And that is all for the negativity :)

 

What follows is an easy implementation of Zernike's polynomials that you could use in your worksheet if you need them in your work. The lines below also serve as a template for implementating other functions.

The definition of Zernike polynomials is

Z(m, n, rho, phi) = R(m, n, rho)*cos(m*phi)

Z(m, n, rho, phi) = R(m, n, rho)*cos(m*phi)

(1)

Where m and n are non-negative integers satisfying m <= n and R(m, n, rho) are the radial polynomials defined below.

So: first transform this definition of Z into a procedure that you could use

Z := unapply(rhs(Z(m, n, rho, phi) = R(m, n, rho)*cos(m*phi)), m, n, rho, phi)

proc (m, n, rho, phi) options operator, arrow; R(m, n, rho)*cos(m*phi) end proc

(2)

Now, introduce the definition for the radial polynomials, that can be expressed in terms of pFq hypergeometric functions, or the JacobiP polynomials, i.e

R(m, n, rho) = binomial(n, (n+m)*(1/2))*rho^n*hypergeom([-(n+m)*(1/2), -(n-m)*(1/2)], [-n], 1/rho^2)

R(m, n, rho) = binomial(n, (1/2)*n+(1/2)*m)*rho^n*hypergeom([-(1/2)*n-(1/2)*m, -(1/2)*n+(1/2)*m], [-n], 1/rho^2)

(3)

combine(simplify(convert(R(m, n, rho) = binomial(n, (1/2)*n+(1/2)*m)*rho^n*hypergeom([-(1/2)*n-(1/2)*m, -(1/2)*n+(1/2)*m], [-n], 1/rho^2), JacobiP)))

R(m, n, rho) = -sin((1/2)*Pi*m-(1/2)*Pi*n)*rho^n*JacobiP((1/2)*n+(1/2)*m, -n-1, 0, (rho^2-2)/rho^2)/sin(Pi*n)

(4)

Transform any of these into a procedure that you could use, say the definition in terms of pFq to avoid spurious "division by 0" when n is an integer

R := unapply(rhs(R(m, n, rho) = binomial(n, (1/2)*n+(1/2)*m)*rho^n*hypergeom([-(1/2)*n-(1/2)*m, -(1/2)*n+(1/2)*m], [-n], 1/rho^2)), m, n, rho)

proc (m, n, rho) options operator, arrow; binomial(n, (1/2)*n+(1/2)*m)*rho^n*hypergeom([-(1/2)*n-(1/2)*m, -(1/2)*n+(1/2)*m], [-n], 1/rho^2) end proc

(5)


Having defined things, you can now differentiate, expand in series, numerically evaluate, and also plot the Zernike polynomials.

Because of the way I coded this Z function, so that it always return in terms of its definition, you can differentiate it right away

diff(Z(m, n, rho, phi), rho)

binomial(n, (1/2)*n+(1/2)*m)*rho^n*n*hypergeom([-(1/2)*n-(1/2)*m, -(1/2)*n+(1/2)*m], [-n], 1/rho^2)*cos(m*phi)/rho+2*binomial(n, (1/2)*n+(1/2)*m)*rho^n*(-(1/2)*n-(1/2)*m)*(-(1/2)*n+(1/2)*m)*hypergeom([1-(1/2)*n+(1/2)*m, -(1/2)*n-(1/2)*m+1], [-n+1], 1/rho^2)*cos(m*phi)/(n*rho^3)

(7)

diff(Z(m, n, rho, phi), phi)

-binomial(n, (1/2)*n+(1/2)*m)*rho^n*hypergeom([-(1/2)*n-(1/2)*m, -(1/2)*n+(1/2)*m], [-n], 1/rho^2)*m*sin(m*phi)

(8)

For the case where you code Z in a more sophisticated manner, say where it could return 'unevaluated', you can still define a diff/Z rule (see the help page for diff ).

Either way, since you can now differentiate Z, you can also compute its series expansion, say with respect to phi or rho

series(Z(m, n, rho, phi), phi)

series(binomial(n, (1/2)*n+(1/2)*m)*rho^n*hypergeom([-(1/2)*n-(1/2)*m, -(1/2)*n+(1/2)*m], [-n], 1/rho^2)-((1/2)*binomial(n, (1/2)*n+(1/2)*m)*rho^n*hypergeom([-(1/2)*n-(1/2)*m, -(1/2)*n+(1/2)*m], [-n], 1/rho^2)*m^2)*phi^2+((1/24)*binomial(n, (1/2)*n+(1/2)*m)*rho^n*hypergeom([-(1/2)*n-(1/2)*m, -(1/2)*n+(1/2)*m], [-n], 1/rho^2)*m^4)*phi^4+O(phi^6),phi,6)

(9)

The expansion around rho = 0 requires specifying integer values for n and m, for example

series(Z(2, 4, rho, phi), rho)

series(-(3*cos(2*phi))*rho^2+(4*cos(2*phi))*rho^4,rho)

(10)

This is a good place to note that the restriction "m and n are non-negative integers satisfying m <= n" automatically makes Z a polynomial with respect to rho. Take for instance the argument of the series call above

Z(2, 4, rho, phi)

4*rho^4*hypergeom([-3, -1], [-4], 1/rho^2)*cos(2*phi)

(11)

The arguments of this pFq are all negative integers, and the main variable appears in the denominator, so this is just a polynomial in rho

simplify(4*rho^4*hypergeom([-3, -1], [-4], 1/rho^2)*cos(2*phi))

rho^2*(4*rho^2-3)*cos(2*phi)

(12)

NULL

This motivates redefining Z to take advantage of the polynomial simplified form we know that always exists:

Z := unapply(('simplify')(rhs(eval(Z(m, n, rho, phi) = R(m, n, rho)*cos(m*phi), 1))), m, n, rho, phi)

proc (m, n, rho, phi) options operator, arrow; simplify(R(m, n, rho)*cos(m*phi)) end proc

(13)

So that now we have the polynomial form directly, in one go

Z(2, 4, rho, phi)

rho^2*(4*rho^2-3)*cos(2*phi)

(14)

Their numerical evaluation of course works

Z(2, 4, .5, (1/3)*Pi)

.2500000000

(15)

Here again, if you want to define Z such that it could return unevaluated, you can always define its numerical evaluation the way you prefer by coding a routine `evalf/Z` (see the help page for evalf ).

 

A plot of Z for some values of its parameters (all but "rho)"

plots:-complexplot3d(Z(2, 4, rho, (1/3)*Pi), rho = -1-I .. 1+I)

 

To understand the plot above, see the help page for complexplot3d.  

Alternatively, perhaps easier to understand, a plot for the real and imaginary parts of Z(2, 4, rho, (1/3)*Pi),

plots:-plotcompare(Z(2, 4, rho, (1/3)*Pi), expression_plot, 10)

 

Download Zernike_polynomials.mw


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

 

Hi

A small change in design, towards making things more natural regarding the output of the FunctionAdvisor: by indicating only the name of a mathematical function, instead of returning an unsorted table of of all kinds of information (as before this change), the new behavior is to return a sorted and organized section plus sub-sections of information topics. This is the same new output you were get when entering, for instance, FunctionAdvisor(display, sin)). To recover the old behavior, where the FunctionAdvisor was returning a table of information, now you can enter, for instance, FunctionAdvisor(table, sin).

Example

The new behavior is to return the same as FunctionAdvisor(display, sin)

FunctionAdvisor(sin)

  

The old behavior now requires the keyword 'table'

FunctionAdvisor(table, sin)

The system is unable to compute the "asymptotic_expansion" for sin
sin belongs to the subclass "trig" of the class "elementary" and so, in principle, it can be related to various of the 26 functions of those classes - see FunctionAdvisor( "trig" ); and FunctionAdvisor( "elementary" );

 

table( [( "periodicity" ) = [[sin(2*Pi*m+z) = sin(z), And(m::integer)], [sin(Pi*m+z) = (-1)^m*sin(z), And(m::integer)]], ( "branch_points" ) = [sin(z), "No branch points"], ( "singularities" ) = [sin(z), z = infinity+infinity*I], ( "branch_cuts" ) = [sin(z), "No branch cuts"], ( "differentiation_rule" ) = Diff(sin(z), z) = cos(z), Diff(sin(z), `$`(z, n)) = sin(z+(1/2)*n*Pi), ( "describe" ) = sin = `sine function`, ( "classify_function" ) = trig, elementary, ( "series" ) = series(sin(z), z, 4) = series(z-(1/6)*z^3+O(z^5),z,5), ( "special_values" ) = [sin((1/6)*Pi) = 1/2, sin((1/4)*Pi) = (1/2)*2^(1/2), sin((1/3)*Pi) = (1/2)*3^(1/2), sin(infinity) = undefined, sin(infinity*I) = infinity*I, [sin(Pi*MathematicalFunctions:-n) = 0, And(MathematicalFunctions:-n::integer)], [sin((1/2)*(2*MathematicalFunctions:-n+1)*Pi) = -1, And(MathematicalFunctions:-n::odd)], [sin((1/2)*(2*MathematicalFunctions:-n+1)*Pi) = 1, And(MathematicalFunctions:-n::even)]], ( "definition" ) = [sin(z) = -((1/2)*I)*(exp(I*z)-1/exp(I*z)), MathematicalFunctions:-`with no restrictions on `(z)], ( "calling_sequence" ) = sin(z), ( "identities" ) = [sin(arcsin(z)) = z, sin(z) = -sin(-z), sin(z) = 2*sin((1/2)*z)*cos((1/2)*z), sin(z) = 1/csc(z), sin(z) = 2*tan((1/2)*z)/(1+tan((1/2)*z)^2), sin(z) = -((1/2)*I)*(exp(I*z)-exp(-I*z)), sin(z)^2 = 1-cos(z)^2, sin(z)^2 = 1/2-(1/2)*cos(2*z)], ( "sum_form" ) = [sin(z) = Sum((-1)^_k1*z^(2*_k1+1)/factorial(2*_k1+1), _k1 = 0 .. infinity), MathematicalFunctions:-`with no restrictions on `(z)], ( "asymptotic_expansion" ) = , ( "DE" ) = [f(z) = sin(z), [diff(diff(f(z), z), z) = -f(z)]], ( "symmetries" ) = [sin(-z) = -sin(z), sin(conjugate(z)) = conjugate(sin(z))], ( "integral_form" ) = [sin(z) = z*(Int(exp((2*I)*_t1*z), _t1 = 0 .. 1))/exp(I*z), MathematicalFunctions:-`with no restrictions on `(z)] ] )

(1)

``

 

Download FunctionAdvisorChange.mw

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

Updating this post: Today we added 50 more solutions and derived information to the database, so the current total is 843 solutions. The metrics added today are from Chapter 30 and 31.

As usual, in order to have this new development installed right away, you need to update your Physics library from the Maplesoft R&D Physics webpage.

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

@I_Mariusz 
Inadvertently, one file was missing in the list that conformed the mla library uploaded yesterday. It is fixed now; you'd need to download the update again.

By the way, happy new year and the best wishes to everybody for 2016!

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

Updating this post: Today we added 63 more solutions and derived information to the database, so the current total is  793 solutions and corresponding properties derived (Killing vectors, Petrov classification, etc.) (in Maple 18 we had only 225), and we are getting closer and closer to the end of the book. The metrics added today are from Chapters 25, 26, 27, 28 and 29.

As usual, in order to have this new development installed right away, you need to update your Physics library from the Maplesoft R&D Physics webpage.

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

Hi nullinfinity

Yes, the matrix itself (context) is necessary to reproduce the situation, in order to suggest something.

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

@shzan 

Add 'identical(u,v)' to TypeD and you get

 

coeffs_of_D_operators.mw

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

@shzan 


I wonder what is that didn't work for you (?) Perhaps that you are passing unapplied differential operators (as in D(u)) instead of differential polynomials (as in (D(u))(x) = diff(u(x), x)) ? If that is the case, this is how you do it; suppose your ODE is

ODE := expand(a(x)*v*u+(v*D(u)-D(v)*u)^2+(D@@2)(u*v))

a(x)*v*u+v^2*D(u)^2-2*v*D(u)*D(v)*u+D(v)^2*u^2+2*D(v)*D(u)+v*(D@@2)(u)+(D@@2)(v)*u

(1)

Define the appropriate type

TypeD := Or(D(identical(u, v)), typefunc(Or(identical(u, v), posint), identical(D)@@posint))

Or(D(identical(u, v)), typefunc(Or(identical(u, v), posint), identical(D)@@posint))

(2)

Get your derivatives

Derivatives := indets(a(x)*v*u+v^2*D(u)^2-2*v*D(u)*D(v)*u+D(v)^2*u^2+2*D(v)*D(u)+v*(D@@2)(u)+(D@@2)(v)*u, TypeD)

{D(u), D(v), (D@@2)(u), (D@@2)(v)}

(3)

Get the coefficients, and in doing so assign the corresponding derivaties to Duv

coeffs(ODE, Derivatives, 'Duv')

a(x)*v*u, -2*u*v+2, v, u, u^2, v^2

(4)

So these are the coefficients of

Duv

1, D(v)*D(u), (D@@2)(u), (D@@2)(v), D(v)^2, D(u)^2

(5)

``


Download coeffs_of_D_operators.mw

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

Updating this post: Today we added 51 more solutions and derived information to the database, so the current total is  730 solutions, and we are approaching the end .... The metrics added today are from Chapters 24 and 25.

As usual, in order to have this new development installed right away, you need to update your Physics library from the Maplesoft R&D Physics webpage.

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

First 40 41 42 43 44 45 46 Last Page 42 of 65