ecterrab

14540 Reputation

24 Badges

20 years, 22 days

MaplePrimes Activity


These are replies submitted by ecterrab

@Stev Eland 

The help pages were not revised, that is not what I said. What I said is that the problem - that generated the `*` display issues in the help pages - got resolved. That same problem would appear if you run a computation using DifferentialGeometry without updating your library (the one distributed in the Maplesoft R&D Physics webpage). It is fixed. If then you want to read a DifferentialGeomtry help page that you currently see with this display issue (unexpected `*` around), what you can do is to first install the update distributed, then open the page as a worksheet and execute the examples - that automatically reproduces the output with the new library and so without that display issue.

Next question: the instructions you read are about installing the mla file, that updates the library. So, no they do not help you in installing an update for help pages that is not distributed nor mentioned in the instructions. So according to the instructions the file you need to install is Physics2015.mla. 

The "PhysicsUpdate.mw" was so large at some point that got just discarded. Still, you can read about what is found in the update distributed by reading what is new in Physics in Maple 2016. All that is in the update of Physics for Maple 2015.

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

@sjaryal 

This time, I see the metric. Great. To conclude the computation you just posted in the file Weyl.mw, add, at the end of your worksheet, the following input lines:

Set the tetrad metric to null form

> Setup(tetrad = null);

Turn off automatic simplification to speed up matters (probably not necessary, but the result is large, so in this case it is faster)

> Setup(auto = false)

Compute now the Weyl and Ricci scalars

> Weyl[scalars]

> Ricci[scalars]

The last two input lines return the results you asked in your comments to this post (see worksheet linked at the end). Whether they match or not the paper is a different issue - I didn't check that - but attached is the continuation worksheet with the output of the lines described above, so that you could do that check yourself.

Now, note from the definition (Weyl[scalarsdefinition] and Ricci[scalarsdefinition]) that the result depends on the tetrad you are using, and that, as mentioned in my first reply, the tetrad is defined up to a transformation (i.e. there is freedom in the way you can choose it), so you may want to play around with that, or simply enter the tetrad you want to use - then compute the Weyl and Ricci scalars as indicated in this reply. To enter the tetrad or transform it, please proceed as shown in my first reply in the other thread (above).

 

Weyl_and_Ricci_scalars_(completing_your_computation).mw

 

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

@sjaryal 

You need to post a worksheet with the spacetime metric itself. In the worksheet "nulltetrad.mw" you posted above, you are not showing the metric, nor a computating with Physics, but a sequence of computations using GRTensor only (note that GRTensor is not an official Maple package, I don't have it installed for instance).

Also, you have been saying in at least 3 posts that you were unable to enter a metric using Physics, but you didn't show  the metric you are trying to enter nor your attempt to do so in a worksheet - as said you have shown only GRTensor computations instead, and without showing the metric.

Please after you post the metric itself, all of it visible, I can help you. Otherwise, I'm sorry but there is no way to help you beyond what is shown with worksheet in the reply above (how you manipulate tetrads) and what is shown with worksheet in a reply to you in the other post (how to enter any metric you want, that is not in the database) where you asked about this too.

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

@sjaryal 

Weyl scalars and tetrads (both null and orthonormal), are automatically computed on background, on the fly, when you set the metric. For the tetrad, that is shown in the previous reply above, and enter Setup(tetrad = null) and you automatically see a corresponding null tetrad. You can work symbolically with the tetrad e_[a,mu] or with its components as shown in the previous reply above. For the Weyl Scalars, an example is given in the other reply to your question.

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

@sjaryal 

Yes, besides the predefined metrics (Minkowski, Euclidean, or any of the 971 metrics in the database of solutions to Einstein’s equations) you can set the metric, manually, to whatever (symmetric) you want, you can also set the tetrad metric (eta_[a,b]) to be orthonormal or null, combining that choice with any of the four different standard signatures, —+, +—, +++-, -+++, and, you can use the default tetrad set on the fly by the package, or you can set the tetrad to whatever you want as well. 

The Physics:-Tetrads package has a number of useful commands as TransformTetrad to perform any of the standard transformations (nullrotation of two different kinds, spatial rotations on the m and m_bar plane, boosts, etc.) as well as user-defined general transformations. The IsTetrad command can check whether a 4x4 matrix is or not a tetrad for the spacetime you have set, OrthonormalTetrad and NullTetrad compute what their names indicate with some options, etc. You may want to give a look at Physics:-Tetrads and related help pages linked there to get the whole picture.

Below is a random example of the kinds of manipulations described above, running in Maple 2016 with the latest Physics library update, setting a metric of no particular interest, just for the purpose of showing what I mean in the 1st paragraph.

Check the version: and load Physics and the Tetrads subpackage,

Physics:-Version()[2]

`2016, April 6, 16:35 hours`

(1)

with(Physics); with(Tetrads)

`Setting lowercaselatin letters to represent tetrad indices `

 

0, "%1 is not a command in the %2 package", Tetrads, Physics

 

0, "%1 is not a command in the %2 package", Tetrads, Physics

 

[IsTetrad, NullTetrad, OrthonormalTetrad, SimplifyTetrad, TransformTetrad, e_, eta_, gamma_, l_, lambda_, m_, mb_, n_]

(2)

By default Physics loads with this Minkowski metric and signature

g_[]

g[mu, nu] = (Matrix(4, 4, {(1, 1) = -1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 2) = -1, (2, 3) = 0, (2, 4) = 0, (3, 3) = -1, (3, 4) = 0, (4, 4) = 1}, storage = triangular[upper], shape = [symmetric]))

(3)

Setup(signature)

[signature = `- - - +`]

(4)

You can change the signature, and the metric changes accordingly, for example

Setup(signature = `+---`)

[signature = `+ - - -`]

(5)

g_[]

g[mu, nu] = (Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 2) = -1, (2, 3) = 0, (2, 4) = 0, (3, 3) = -1, (3, 4) = 0, (4, 4) = -1}, storage = triangular[upper], shape = [symmetric]))

(6)

You can always set the metric to whatever you want, and you can indicate this change in different ways (pass it as a matrix, for instance). The simplest way is perhaps to indicate the line element, for example:

`#msup(mi("ds"),mn("2"))` := r^2*dtheta^2+r^2*sin(theta)^2*dphi^2-2*dt*dr-2*k(r, t)^2*dt^2

r^2*dtheta^2+r^2*sin(theta)^2*dphi^2-2*dt*dr-2*k(r, t)^2*dt^2

(7)

Set now the coordinates to be spherical ([r, theta, phi, t], as you see indicated in the ouptut below) and the metric to have this line element

Setup(coordinates = spherical, metric = `#msup(mi("ds"),mn("2"))`)

`* Partial match of  'coordinates' against keyword 'coordinatesystems'`

 

`Default differentiation variables for d_, D_ and dAlembertian are: `*{X = (t, r, theta, phi)}

 

`Systems of spacetime Coordinates are: `*{X = (t, r, theta, phi)}

 

[coordinatesystems = {X}, metric = {(1, 1) = -2*k(r, t)^2, (1, 2) = -1, (3, 3) = r^2, (4, 4) = r^2*sin(theta)^2}]

(8)

Check it out

g_[]

g[mu, nu] = (Matrix(4, 4, {(1, 1) = -2*k(r, t)^2, (1, 2) = -1, (1, 3) = 0, (1, 4) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 3) = r^2, (3, 4) = 0, (4, 4) = r^2*sin(theta)^2}, storage = triangular[upper], shape = [symmetric]))

(9)

The default tetrad used by the package for this or any other metric is computed automatically, on the fly, you don't need to enter it

e_[]

Physics:-Tetrads:-e_[a, mu] = Matrix(%id = 18446744078867424310)

(10)

Check whether this is or not a tetrad:

"IsTetrad(?)"

`Type of tetrad: orthonormal `

 

true

(11)

You see that the type is also indicated in the output: orthonormal, so that the metric in the tetrad system of references is of Minkowsky type, as (6)

eta_[]

eta[a, b] = (Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 2) = -1, (2, 3) = 0, (2, 4) = 0, (3, 3) = -1, (3, 4) = 0, (4, 4) = -1}, storage = triangular[upper], shape = [symmetric]))

(12)

You can also check these things "manually", in steps; for instance this is the defining equation for a tetrad

e_[definition]

Physics:-Tetrads:-e_[a, mu]*Physics:-Tetrads:-e_[b, `~mu`] = Physics:-Tetrads:-eta_[a, b]

(13)

Check that each of the components of the 2-tensor on the left-hand side of this equation, taking it from (10), is equal to the corresponding tensor on the right-hand side taking it from (12)

TensorArray(Physics:-Tetrads:-e_[a, mu]*Physics:-Tetrads:-e_[b, `~mu`] = Physics:-Tetrads:-eta_[a, b], simplifier = simplify)

Matrix(%id = 18446744078231915446)

(14)

Set now the tetrad metric to be of null type (e.g. to work using the Newman-Penrose formalism)

Setup(tetradmetric = null)

[tetradmetric = {(1, 2) = 1, (3, 4) = -1}]

(15)

Check the tetrad metric and note that also the tetrad changes automatically following the change in the tetrad (compare with (12) and (10))

eta_[]

eta[a, b] = (Matrix(4, 4, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 0, (1, 4) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 3) = 0, (3, 4) = -1, (4, 4) = 0}, storage = triangular[upper], shape = [symmetric]))

(16)

e_[]

Physics:-Tetrads:-e_[a, mu] = Matrix(%id = 18446744078845691534)

(17)

Verify whether this is indeed a tetrad, as well as its type

"IsTetrad(?)"

`Type of tetrad: null `

 

true

(18)

The advantage of the current signature is that, using null tetrads, the four vectors of the Newman-Penrose formalism are given directly bh the lines of the tetrad (17)

l_[], n_[], m_[], mb_[]

Physics:-Tetrads:-l_[mu] = Vector[row](%id = 18446744078867404310), Physics:-Tetrads:-n_[mu] = Vector[row](%id = 18446744078867405750), Physics:-Tetrads:-m_[mu] = Vector[row](%id = 18446744078867399254), Physics:-Tetrads:-mb_[mu] = Vector[row](%id = 18446744078867400814)

(19)

Perform a null rotation with fixed l[mu] and verify that the result is still a tetrad

TransformTetrad(nullrotationwithfixedl_)

Matrix(%id = 18446744079011348222)

(20)

"IsTetrad(?)"

`Type of tetrad: null `

 

true

(21)

OK. Set now this result to be the tetrad used by the package:

"Setup(tetrad = ?)"

[tetrad = {(1, 1) = I*k(r, t), (2, 1) = I*k(r, t)*(abs(E)^2+1), (2, 2) = I/k(r, t), (2, 3) = -I*abs(r)*2^(1/2)*Re(E), (2, 4) = -I*(1-cos(2*theta))^(1/2)*abs(r)*Im(E), (3, 1) = I*E*k(r, t), (3, 3) = -((1/2)*I)*2^(1/2)*abs(r), (3, 4) = (1/2)*(1-cos(2*theta))^(1/2)*abs(r), (4, 1) = I*conjugate(E)*k(r, t), (4, 3) = -((1/2)*I)*2^(1/2)*abs(r), (4, 4) = -(1/2)*(1-cos(2*theta))^(1/2)*abs(r)}]

(22)

Check it out

e_[]

Physics:-Tetrads:-e_[a, mu] = Matrix(%id = 18446744079002239214)

(23)

You see the first line, that is l[mu] has not changed

l_[]

Physics:-Tetrads:-l_[mu] = Vector[row](%id = 18446744079002231862)

(24)

Do two more transformations

TransformTetrad(spatialrotationsm_mb_plane)

Matrix(%id = 18446744079002225350)

(25)

"IsTetrad(?)"

`Type of tetrad: null `

 

true

(26)

"Setup(tetrad = ?)"

[tetrad = {(1, 1) = I*k(r, t), (2, 1) = I*k(r, t)*(abs(E)^2+1), (2, 2) = I/k(r, t), (2, 3) = -I*abs(r)*2^(1/2)*Re(E), (2, 4) = -I*(1-cos(2*theta))^(1/2)*abs(r)*Im(E), (3, 1) = I*exp(I*Omega)*E*k(r, t), (3, 3) = -((1/2)*I)*exp(I*Omega)*2^(1/2)*abs(r), (3, 4) = (1/2)*exp(I*Omega)*(1-cos(2*theta))^(1/2)*abs(r), (4, 1) = I*exp(-I*Omega)*conjugate(E)*k(r, t), (4, 3) = -((1/2)*I)*exp(-I*Omega)*2^(1/2)*abs(r), (4, 4) = -(1/2)*exp(-I*Omega)*(1-cos(2*theta))^(1/2)*abs(r)}]

(27)

TransformTetrad(boostsn_l_plane)

Matrix(%id = 18446744078992795638)

(28)

"IsTetrad(?)"

`Type of tetrad: null `

 

true

(29)

"Setup(tetrad=?)"

[tetrad = {(1, 1) = I*k(r, t)/A, (2, 1) = I*A*k(r, t)*(abs(E)^2+1), (2, 2) = I*A/k(r, t), (2, 3) = -I*A*abs(r)*2^(1/2)*Re(E), (2, 4) = -I*A*(1-cos(2*theta))^(1/2)*abs(r)*Im(E), (3, 1) = I*exp(I*Omega)*E*k(r, t), (3, 3) = -((1/2)*I)*exp(I*Omega)*2^(1/2)*abs(r), (3, 4) = (1/2)*exp(I*Omega)*(1-cos(2*theta))^(1/2)*abs(r), (4, 1) = I*exp(-I*Omega)*conjugate(E)*k(r, t), (4, 3) = -((1/2)*I)*exp(-I*Omega)*2^(1/2)*abs(r), (4, 4) = -(1/2)*exp(-I*Omega)*(1-cos(2*theta))^(1/2)*abs(r)}]

(30)

e_[]

Physics:-Tetrads:-e_[a, mu] = Matrix(%id = 18446744078977330942)

(31)

"IsTetrad(?)"

`Type of tetrad: null `

 

true

(32)

``


Download SettingMetricAndTetrads.mw

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

@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.

First 39 40 41 42 43 44 45 Last Page 41 of 64