ecterrab

13431 Reputation

24 Badges

19 years, 362 days

MaplePrimes Activity


These are replies submitted by ecterrab

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

Hi Preben

Functional differentiation, within the Physics package, rather advanced mathematical functionality, is all implemented exploting this feature, syntax like f(a)(b). Whether there is one example where a = b I think is not the core issue: suppose I come with one and answer you, then you will tell me "interesting", and I will reply "indeed, with time I got convinced that these rare syntaxes could be used with imagination in surprisignly useful ways" and I believe that in this hypothetical conversation you will end up agreeing. Now remove the "one example" and you can see you don't need the example to agree.

All in all, I don't know what torleian meant with f(t)(t), but that is valid syntax, the system should not crash, and that is what I fixed (actually a nice improvement in the design/logic of these Physics types), and now is up to torleian to make sense of his/her own computation.

Best

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

Updating this post: Today we added 52 more solutions and derived information to the database, so the current total is  679 solutions, and moving forward .... The metrics added today are from Chapter 23.

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 Preben

The syntax is in use in the library, e.g. D(f)(t); the evalapply command is related to this syntax, it is handy for a number of purposes, although it is more a sort of computational artifact, mostly useful for performing computational/structure manipulations.

Best

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

There is a problem somewhere though; I am giving a look, but I am kind of overloaded with stuff in this moment. I'ill try to fix this problem and upload the fix between today and tomorrow.

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

@Christopher2222 

Above your last comment: there is a better version of the workaround that works in general posted earlier.

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

First 35 36 37 38 39 40 41 Last Page 37 of 60