## Physics in Maple 2017: Special, General and towards...

by: Maple 2017

 Physics

Maple provides a state-of-the-art environment for algebraic and tensorial computations in Physics, with emphasis on ensuring that the computational experience is as natural as possible.

The theme of the Physics project for Maple 2017 has been the consolidation of the functionality introduced in previous releases, together with significant enhancements and new functionality in General Relativity, in connection with classification of solutions to Einstein's equations and tensor representations to work in an embedded 3D curved space - a new ThreePlusOne  package. This package is relevant in numerical relativity and a Hamiltonian formulation of gravity. The developments also include first steps in connection with computational representations for all the objects entering the Standard Model in particle physics.

Classification of solutions to Einstein's equations and the Tetrads package

In Maple 2016, the digitizing of the database of solutions to Einstein's equations  was finished, added to the standard Maple library, with all the metrics from "Stephani, H.; Kramer, D.; MacCallum, M.; Hoenselaers, C.; and Herlt, E., Exact Solutions to Einstein's Field Equations". These metrics can be loaded to work with them, or change them, or searched using g_  (the Physics command representing the spacetime metric that also sets the metric to your choice in one go) or using the command DifferentialGeometry:-Library:-MetricSearch .

In Maple 2017, the Physics:-Tetrads  package has been vastly improved and extended, now including new commands like PetrovType  and SegreType  to classify these metrics, and the TransformTetrad  now has an option canonicalform to automatically derive a transformation and put the tetrad in canonical form (reorientation of the axis of the local system of references), a relevant step in resolving the equivalence between two metrics.

Examples

 Petrov and Segre types, tetrads in canonical form

Equivalence for Schwarzschild metric (spherical and Kruskal coordinates)

 Formulation of the problem (remove mixed coordinates)
 Solving the Equivalence

The ThreePlusOne (3 + 1) new Maple 2017 Physics package

ThreePlusOne , is a package to cast Einstein's equations in a 3+1 form, that is, representing spacetime as a stack of nonintersecting 3-hypersurfaces Σ. This  description is key in the Hamiltonian formulation of gravity as well as in the study of gravitational waves, black holes, neutron stars, and in general to study the evolution of physical system in general relativity by running numerical simulations as traditional initial value (Cauchy) problems. ThreePlusOne includes computational representations for the spatial metric  that is induced by  on the 3-dimensional hypersurfaces, and the related covariant derivative, Christoffel symbols and Ricci and Riemann tensors, the Lapse, Shift, Unit normal and Time vectors and Extrinsic curvature related to the ADM equations.

The following is a list of the available commands:

 ADMEquations Christoffel3 D3_ ExtrinsicCurvature gamma3_ Lapse Ricci3 Riemann3 Shift TimeVector UnitNormalVector

The other four related new Physics  commands:

 • Decompose , to decompose 4D tensorial expressions (free and/or contracted indices) into the space and time parts.
 • gamma_ , representing the three-dimensional metric tensor, with which the element of spatial distance is defined as  .
 • Redefine , to redefine the coordinates and the spacetime metric according to changes in the signature from any of the four possible signatures(− + + +), (+ − − −), (+ + + −) and ((− + + +) to any of the other ones.
 • EnergyMomentum , is a computational representation for the energy-momentum tensor entering Einstein's equations as well as their 3+1 form, the ADMEquations .

Examples

 >
 (2.1.1)
 >
 (2.1.2)

Note the different color for , now a 4D tensor representing the metric of a generic 3-dimensional hypersurface induced by the 4D spacetime metric . All the ThreePlusOne tensors are displayed in black to distinguish them of the corresponding 4D or 3D tensors. The particular hypersurface  operates is parameterized by the Lapse   and the Shift  .

The induced metric is defined in terms of the UnitNormalVector   and the 4D metric  as

 >
 (2.1.3)

where  is defined in terms of the Lapse   and the derivative of a scalar function t that can be interpreted as a global time function

 >
 (2.1.4)

The TimeVector  is defined in terms of the Lapse   and the Shift   and this vector   as

 >
 (2.1.5)

The ExtrinsicCurvature  is defined in terms of the LieDerivative  of

 >
 (2.1.6)

The metric is also a projection tensor in that it projects 4D tensors into the 3D hypersurface Σ. The definition for any 4D tensor that is also a 3D tensor in Σ, can thus be written directly by contracting their indices with . In the case of Christoffel3 , Ricci3  and Riemann3,  these tensors can be defined by replacing the 4D metric  by  and the 4D Christoffel symbols  by the ThreePlusOne  in the definitions of the corresponding 4D tensors. So, for instance

 >
 (2.1.7)
 >
 (2.1.8)
 >
 (2.1.9)

When working with the ADM formalism, the line element of an arbitrary spacetime metric can be expressed in terms of the differentials of the coordinates , the Lapse , the Shift  and the spatial components of the 3D metric gamma3_ . From this line element one can derive the relation between the Lapse , the spatial part of the Shift , the spatial part of the gamma3_  metric and the  components of the 4D spacetime metric.

For this purpose, define a tensor representing the differentials of the coordinates and an alias

 >
 (2.1.10)
 >

The expression for the line element in terms of the Lapse  and Shift   is (see [2], eq.(2.123))

 >
 (2.1.11)

Compare this expression with the 3+1 decomposition of the line element in an arbitrary system. To avoid the automatic evaluation of the metric components, work with the inert form of the metric %g_

 >
 (2.1.12)
 >
 (2.1.13)

The second and third terms on the right-hand side are equal

 >
 (2.1.14)
 >
 (2.1.15)

Taking the difference between this expression and the one in terms of the Lapse  and Shift  we get

 >
 (2.1.16)

Taking coefficients, we get equations for the Shift , the Lapse  and the spatial components of the metric gamma3_

 >
 (2.1.17)
 >
 (2.1.18)
 >
 (2.1.19)

Using these equations, these quantities can all be expressed in terms of the time and space components of the 4D metric  and

 >
 (2.1.20)
 >
 (2.1.21)
 >
 (2.1.22)

References

 [1] Landau, L.D., and Lifshitz, E.M. The Classical Theory of Fields, Course of Theoretical Physics Volume 2, fourth revised English edition. Elsevier, 1975.
 [2] Alcubierre, M., Introduction to 3+1 Numerical Relativity, International Series of Monographs on Physics 140, Oxford University Press, 2008.
 [3] Baumgarte, T.W., Shapiro, S.L., Numerical Relativity, Solving Einstein's Equations on a Computer, Cambridge University Press, 2010.
 [4] Gourgoulhon, E., 3+1 Formalism and Bases of Numerical Relativity, Lecture notes, 2007, https://arxiv.org/pdf/gr-qc/0703035v1.pdf.
 [5] Arnowitt, R., Dese, S., Misner, C.W., The Dynamics of General Relativity, Chapter 7 in Gravitation: an introduction to current research (Wiley, 1962), https://arxiv.org/pdf/gr-qc/0405109v1.pdf

Examples: Decompose, gamma_

 >
 >
 (2.2.1)

Define  now an arbitrary tensor

 >
 (2.2.2)

So  is a 4D tensor with only one free index, where the position of the time-like component is the position of the different sign in the signature, that you can query about via

 >
 (2.2.3)

To perform a decomposition into space and time, set - for instance - the lowercase latin letters from i to s to represent spaceindices and

 >
 (2.2.4)

Accordingly, the 3+1 decomposition of  is

 >
 (2.2.5)

The 3+1 decomposition of the inert representation %g_[mu,nu] of the 4D spacetime metric; use the inert representation when you do not want the actual components of the metric appearing in the output

 >
 (2.2.6)

Note the position of the component %g_[0, 0], related to the trailing position of the time-like component in the signature .

Compare the decomposition of the 4D inert with the decomposition of the 4D active spacetime metric

 >
 (2.2.7)
 >
 (2.2.8)

Note that in general the 3D space part of  is not equal to the 3D metric  whose definition includes another term (see [1] Landau & Lifshitz, eq.(84.7)).

 >
 (2.2.9)

The 3D space part of  is actually equal to the 3D metric

 >
 (2.2.10)

To derive the formula  for the covariant components of the 3D metric, Decompose into 3+1 the identity

 >
 (2.2.11)

To the side, for illustration purposes, these are the 3 + 1 decompositions, first excluding the repeated indices, then excluding the free indices

 >
 (2.2.12)
 >
 (2.2.13)

Compare with a full decomposition

 >
 (2.2.14)

is a symmetric matrix of equations involving non-contracted occurrences of ,  and . Isolate, in , , that you input as %g_[~j, ~0], and substitute into

 >
 (2.2.15)
 >
 (2.2.16)

Collect , that you input as %g_[~j, ~i]

 >
 (2.2.17)

Since the right-hand side is the identity matrix and, from , , the expression between parenthesis, multiplied by -1, is the reciprocal of the contravariant 3D metric , that is the covariant 3D metric , in accordance to its definition for the signature

 >
 (2.2.18)
 >

References

 [1] Landau, L.D., and Lifshitz, E.M. The Classical Theory of Fields, Course of Theoretical Physics Volume 2, fourth revised English edition. Elsevier, 1975.
 Example: Redefine

Tensors in Special and General Relativity

A number of relevant changes happened in the tensor routines of the Physics package, towards making the routines pack more functionality both for special and general relativity, as well as working more efficiently and naturally, based on Maple's Physics users' feedback collected during 2016.

New functionality

 • Implement conversions to most of the tensors of general relativity (relevant in connection with functional differentiation)
 • New setting in the Physics Setup  allows for specifying the cosmologicalconstant and a default tensorsimplifier

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

## How do I import Maple files into MapleSim?...

I modelled a telecamera and line follower sensors in Maple in order to calculate the "error" for my PID controller. Know i would like to share this information with the PID in MapleSim but I have no idea how to do it. Is there a way to import maple libraries into MapleSim?

Thanks!

## Seasonal fluctuation of model...

Howdy,

I am trying to create a mathmatical model that shows a predator-prey relationship along with seasonal variations (hibernation). I made two piecewise functions where one is "on" during the winter and the other is "off" during the winter and the model worked well for one unit of time.

My problem is that I would like the piecewise functions to apply over an arbitrary amount of time units periods without having to set the range within the function itself for 100 units of time. I was thinking that a for loop would work but i'm not sure how I would impliment that.

Edit:

I have three O.D.E's in an array..

ode := {r'(t),h'(t),c'(t)}

which are dependent on a list of parameters..

constants := {a,b,...,s,w,c0,h0,r0};

where s and w are my piecewise functions.

I am able to solve the three odes using dsolve for one period of s and w.

Again, I'm really not sure where to start to make my model periodic.

## Improved Wave Length to Color

by: Maple 18

The CIELAB perceptual model of human vision can be used to predict the color of a wavelength in sRGB. I found the CIEDE2000 corrections to hue, chroma, and lighness were required to get the right values in the blue to violet region. The CIEDE2000 results seem pretty close to what I see looking through a diffraction grating considering I have no way of knowing how my eyes are adapted.

Use the new, faster  version. It can run in under 1 minute;

You will need the data for the color matching functions in the WtoC Excel File. The data directory can now be controlled in the mw file.

## Picking the right model by min...

loock i have 3 models and a Matrix
>m3:=importmatrix("loslobos.txt");
>model[1]:=a*x;
>model[2]:=a^2*x+b;
>model[3]:=C-x^2+a;

so i apply a command named DataFit and it gives me
>g:=Datafit(matrix,model[1]);

and that throws
g:=[3,[a:=5],33];
so
>g[1];
3
>g[2];
5
>g[3];
33
the variable that i care about is g[1] so every 3 models have differents g[1] so i need to pick the smallest g[1] and then use his model.
Example:=
>g:=Datafit(matrix,model[1]);
g:=[3,[a:=5],33];
>gg:=Datafit(matrix,model[2]);
gg:=[10,[a:=5,b:=10],44];
>G:=Datafit(matrix,model[3]);
G:=[1.1,[C:=5,a:=2],88];

then

>plots:-display(plot(m3, style = point, symbol = diamond, symbolsize = 9), plot(eval("MODEL THAT SHOULD BE PLOT", THE G[2] OF THE MODEL), x = 0 .. 27, color = black));

The right one here would be

>plots:-display(plot(m3, style = point, symbol = diamond, symbolsize = 9), plot(eval(model[3], G[2]), x = 0 .. 27, color = black));

so how do i select the model[3] for my plot? i knnow how the eval works so the problem here is to pick the right model please Help i hope that i isn't that Hard thnx

## How do I solve s systems of pdes in maple...

The model of fixed-bed adsorption column

Fluid phase:

PDE:= diff(U(x, tau),tau)+ psi*Theta*diff(U(x, tau),x)-(1/Pe)*psi*Theta*diff(U(x, tau),\$(x, 2))=-3*psi*xi*(U(x, tau)-Q/K);

IBC:={U(x, 0) = 0,U(0, tau) = 1+(1/Pe)*(D[1](U))(0, tau),(D[1](U))(1, tau)=0};

Particle:

PDE:= diff(Q(r, tau), tau) = diff(Q(r, tau), \$(r, 2))+(2/r)*diff(Q(r, tau),r);

IBC:={Q(r, 0) = 0,(D[1](Q))(0, tau) = 0,(1/K)*(D[1](Q))(1, tau)=xi*(U-Q(1, tau)/K)};

Pe:=0.01:

psi:=6780:

Theta:=3.0:

xi:=10000:

I will really appreciate your help. Thanks in anticipation.

## Error occurred when I simulate a build-in model...

The following error occurred when I simulate a build-in model, anyone could help me to solve this problem? Thanks first

## [MapleSim7] Setting the direction of "prismatic jo...

I want to make the model which moves along the specific direction (translational), So I used the "prismatic joint" to give the direction that I want to enforce. However, "Prismatic joint" only offers the direction along the "X", "Y", and "Z" axes though I want to give other direction.

Is there any way to give the specific direction (vector) to make my model move in that way ?

## Compute and display isoclines (nullclines) for an ...

Hi there,

I would like to compute and display the nullclines of a set of ordinary differential equations.

AFAIK, I can compute the nullclines in Maple by defining the equations and solving the system

e.g.:

# Define the equations
eq1 := u(t)*(1-u(t)/kappa)-u(t)*v(t) = 0;
eq2 := g*(u(t)-1)*v(t) = 0;

# Solve the system (i.e. compute the nullclines)
sol := solve({eq1, eq2}, {u(t), v(t)});

However, I am not quite able to imagine how to display them over a dfieldplot or a phaseportrait.

Attached is an example with some differential equations, and their vector field and trajectories: MaplePrimes_Predator_prey_model_nullclines.mw.

It can be use to illustrate how to (compute and) display the nullclines.

Thank you,

jon

## Photon Exposure

by: Maple 18

This application calculates the number of photons reaching a camera sensor for a given exposure. A blackbody model of the sun is generated. The "Sunny 16" rule for exposure is demonstrated. Calculations are done using units.Photon_Exposure_Array.mw

Photon Exposure

Blackbody Model of the Sun

 Plank Constant Boltzman Constant Light Speed Sun Radius Earth Orbit Sun Color Temperature Transmission Factor

=

 Photopic Relative Response VP vs λ =  =                (ArrayInterpolation for x,y data VPdata returns y' for new x data lambdaP)

Illuminance in Radiometric and Photometric Units:

=

=

Translation from Illuminance to Luminance for Reflected Light;

Object Reflectance

Object Luminance                            =

Illuminance of a Camera Sensor  Eps applied for time texp determines Luminous Exposure Hp;

Ideal Illuminance is determined by the exposure time texp, effective f-number N and to a less extent the angle to the optical axis θ;

 • H       Luminous Exposure
 • Eps     Illuminance to the Camera
 • N                                               Effective F-Number
 • texp             Exposure Time
 • θ        Angle to the Optical Axis

The camera meter determines the exposure time texp to balance the object luminance, reflectance and effective f-number. It does this based on an internal constant k and the camera ISO s.

 • s        ISO Gain (Based on saturation at 3 stops above the average scene luminance)
 • k       Reflected Light Meter Calibration Constant

for Nikon, Canon and Sekonic

 • c        Incident Light Meter Calibration Constant

for Sekonic with flat dome

(Incident Light Meter)

(Reflected Light Meter)

 Solve for H in terms of the Camera Meter Constant k and s

=

Note:  Meters are typically set for a scene reflectance 3 stops below 100% or 12.5%.

=

=

Actual exposure time includes typical lens losses;

 Magnification Lens Transmittance Lens Flare Vignetting

Total Lens Efficiency

=

Replacing Eps with q*Eps we get the "Sunny 16" relation between exposure time and ISO;

=

=

 • The Number of Photons NP Reaching the Sensor Area A;
 • Circle of confusion for 24x36mm "Full Frame" for 1 arcminute view at twice the diagonal:

 • Sensor Bandwidth                                          Photopic Response VP
 • Exposure Time for Zone 5: Rscene=12.5% , Saturation in Zone 8 Rscene=100%
 • Camera ISO differs from Saturation ISO. Typical Saturation ISO is 2300 when the camera is set to 3200. See DxoMark.

The average number of photons for exposure time based on Reflectance of the scene  relative to the metered value:

Zone 5;

=

Zone 8;

=

Approximate Formula

:

=

Average Visible Photon Energy

=

=

## Plotting a parameter function another parameter...

Hello,

I study the model of crankshaft in MapleSim.

For the moment, i manage to plot different parameters function of the time. For exemple, the angle of the crank function of the time or the displacement of the slider function of the time.

But, i like to plot the displacement of the slider funtion of the angle of the crank.

Is it possible and how can i do this?

## Change the unit in a plot made with a probe...

Hello,

It's a very easy question but i don't find for the moment.

I want to measure an angle in a revolute joint. For that purpose, i use a probe to measure the angle. The angle is measured in rad. How can i do to change in deg ?