## How to Create Help for a WorkSheet...

https://www.mapleprimes.com/questions/219048-Help-File-Edit-After-Storing-In-A-Database

I found a previous post which contained a worksheet script for creating help, but this example is likely out-of-date. Can anyone provide a similar example for post-2018 help files to save me considerable trial and error.

## Maple: Put an external *.XML file information in r...

I want to open an external *.XML file and put this information in a list (every part is a row). Later, i will change a specific row with other text. Finally, I want to copy all this changes in the same file (rewrite the file).
Someone to help me?

## How to common a factor appears in many terms in th...

> den := -(-(conjugate(chi)-conjugate(phi))*(chi+phi)*conjugate(lambda)+lambda*(conjugate(chi)+conjugate(phi))*(chi-phi))*(-(conjugate(chi)+conjugate(phi))*(chi-phi)*conjugate(lambda)+lambda*(conjugate(chi)-conjugate(phi))*(chi+phi));

> phi:=exp(I*lambda*(x-t/(4*lambda^2)-w^2)):chi:=exp(-I*lambda*(x-t/(4*lambda^2)-w^2)):

> den1:=simplify(dsubs({phi,chi},den));

> dsubs({exp((1/4*I)*(4*lambda^2*w^2-4*lambda^2*x+t)/lambda), exp(-(1/4*I)*(4*lambda^2*w^2-4*lambda^2*x+t)/lambda)}, 4*conjugate(lambda)^2*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2-4*conjugate(lambda)^2*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2+8*abs(lambda)^2*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2+8*abs(lambda)^2*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2+4*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*lambda^2-4*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*lambda^2-16*abs(lambda)^2)

Since "cos(...)" appears in every term in last equation (except a last one), how to common it?

## Transforming "6T1" into 6T1...

The  galois routine returns the group of  polynomials within quotation marks, e.g.  "6T1".

How to convert  things like  "6T1"  into just   6T1, i.e. how to get rid of the quotation symbols?

## Partitioning a cube into pyramids: An animation

Maple

Here is a little cute demo that shows how a cube may paritioned into three congruent pyramids.  This was inspired by a Mathematica demo that I found in the web but I think this one's better :-)

A Cube as a union of three right pyramids

Here is an animated demo of the well-known fact that a cube may be partitioned

into three congruent right pyramids.

2020-05-21

 > restart;
 > with(plots):
 > with(plottools):

A proc to plot a general polyhedron.
list of vertices
list of faces

An entry  in describes a face made of the vertices  etc.

 > polyhedron := proc(V::list, F::list)   seq(plottools:-polygon([seq( V[F[i][j]], j=1..nops(F[i]))]), i=1..nops(F));   plots:-display(%); end proc:

Define the vertices and faces of a pyramid:

 > v := [[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1]]; f := [ [1,2,3,4], [5,2,3], [5,3,4], [1,5,4], [1,2,5] ];

Build three such pyramids:

 > P1 := polyhedron(v, f): P2 := reflect(P1, [[1,0,0],[1,1,0],[1,0,1]]): P3 := reflect(P1, [[0,1,0],[1,1,0],[0,1,1]]):

This is what we have so far:

 > display(P1,P2,P3, scaling=constrained);

Define an animation frame.  The parameter  goes from 0 to 1.

Any extra options are assumed to be plot3d options and are

passed to plots:-display.

 > frame := proc(t)   plots:-display(     P1,     rotate(P2, Pi/2*t, [[1,1,0],[1,0,0]]),     rotate(P3, Pi/2*t, [[0,1,0],[1,1,0]]),     color=["Red", "Green", "Blue"], _rest); end proc:

Animate:

 > display(frame(0) \$40, seq(frame(t), t=0..1, 0.01), frame(1) \$40,   insequence, scaling=constrained, axes=none,   orientation=[45,0,120], viewpoint=circleleft);

## How to verify the solution of PDEs?...

 > restart:
 > with(PDEtools):
 > with(LinearAlgebra):
 >
 > alias(f=f(x,t),g=g(x,t));
 (1)
 >
 >
 > eq1:=diff(f,x)=-I*eta*f +I*exp(-I*t)*g;
 (2)
 > eq2:=diff(g,x)=-I*eta*g +I*exp(I*t)*f;
 (3)
 > eq3:=diff(f,t)=(I*eta^2-I/2)*f +I*eta*exp(-I*t)*g;
 (4)
 > eq4:=diff(g,t)=(-I*eta^2+I/2)*g +I*eta*exp(I*t)*f;
 (5)
 > #### The solution of (2)-(5) is
 > eq5:=f=I*(c1*exp(A)-c2*exp(-A))*exp(-i*t/2);
 (6)
 > eq6:=g=(c2*exp(A)-c1*exp(-A))*exp(i*t/2);
 (7)
 > #### where
 > c1=sqrt(h-sqrt(h^2-1))/sqrt(h^2-1);c2=sqrt(h+sqrt(h^2-1))/sqrt(h^2-1);A=sqrt(h^2-1)*(x+I*h*t);
 (8)
 > #### How to verify (6) and (7) is the solution of (2)-(5)?

## The equations of motion in curvilinear coordinates,...

by: Maple

The equations of motion in curvilinear coordinates, tensor notation and Coriolis force

The formulation of the equations of motion of a particle is simple in Cartesian coordinates using vector notation. However, depending on the problem, for example when describing the motion of a particle as seen from a non-inertial system of references (e.g. a rotating planet, like earth), there is advantage in using curvilinear coordinates and also tensor notation. When the particle's movement is observed from such a rotating referential, we also see "acceleration" that is not due to any force but to the fact that the referential itself is accelerated. The material below discusses and formulates these topics, and derives the expression for the Coriolis and centripetal force in cylindrical coordinates as seen from a rotating system of references.

The computation below is reproducible in Maple 2020 using the Maplesoft Physics Updates v.681 or newer.

Vector notation

Generally speaking the equations of motion of a particle are easy to formulate: the position vector is a function of time, the velocity is its first derivative and the acceleration is its second derivative. For instance, in Cartesian coordinates

 >
 >
 (1)
 >
 (2)
 >
 (3)

Newton's 2nd law, that in an inertial system of references when there is force there is acceleration and viceversa, is then given by

 >
 (4)

where  represents the total force acting on the particle. This vectorial equation represents three second order differential equations which, for given initial conditions, can be integrated to arrive at a closed form expression for  as a function of .

Tensor notation

In Cartesian coordinates, the tensorial form of the equations (4) is also straightforward. In a flat spacetime - Galilean system of references - the three space coordinates  form a 3D tensor, and so does its first derivate and the second one. Set the spacetime to be 3-dimensional and Euclidean and use lowercaselatin indices for the corresponding tensors

 >
 (5)

The position, velocity and acceleration vectors are expressed in tensor notation as done in (1), (2) and (3)

 >
 (6)
 >
 (7)
 >
 (8)

Setting a tensor  to represent the three Cartesian components of the force

 >
 (9)

Newton's 2nd law (4), now expressed in tensorial notation, is given by

 >
 (10)

The three differential equations behind this tensorial form of (4) are as expected

 >
 (11)

Things are straightforward in Cartesian coordinates because the components of the line element  are exactly the components of the tensor

 >
 (12)

and so, the form factors (see related Mapleprimes post) are all equal to 1.

In the case of no external forces,  and the equations of motion, whose solution are the trajectory, can be formulated as the path of minimal length between two points, a geodesic. In the case under consideration, because the spacetime is flat (Galilean) those two points lie on a plane, we are talking about Euclidean geometry, that information is encoded in the metric (the 3x3 identity matrix (5)), and the geodesic is a straight line. The differential equations of this geodesic are thus the equations of motion (11) with  , and can be computed using Geodesics

 >
 (13)

Curvilinear coordinates

Vector notation

The form of these equations in the case of curvilinear coordinates, for example in cylindrical or spherical variables, is obtained performing a change of coordinates.

 >
 (14)

This change keeps the z axis unchanged, so the corresponding unit vector  remains unchanged.

Changing the basis and coordinates used to represent the position vector , it becomes

 >
 (15)

where since in (1) the coordinates () depend on t, in (15), not just  and  but also the unit vector depends on t. The velocity is computed as usual, differentiating

 >
 (16)

The second term is due to the dependency of  on the coordinate  together with the chain rule . The dependency of curvilinear unit vectors on the coordinates is automatically taken into account when differentiating due to the Setup setting geometricdifferentiation = true.

For the acceleration,

 >
 (17)

where the term involving  comes from differentiating  in (16) taking into account the dependency of  on the coordinate  This result can also be obtained by directly changing variables in the acceleration , in equation (3)

 >
 (18)

Newton's 2nd law becomes

 >
 (19)

In the absence of external forces, equating to 0 the vector components (coefficients of the unit vectors) of the acceleration we get the system of differential equations in cylindrical coordinates whose solution is the trajectory of the particle expressed in the (

 >
 (20)
 >
 (21)

In this formulation (21) with , although , no acceleration in the  direction, is naturally expected, the same cannot be said about the other two equations for  and . Those two equations are discussed below under Coriolis and Centripetal forces. The key observation at this point, however, is that the right-hand sides of both unexpected equations involve , rotation around the z axis.

Tensor notation

The same equations (19) and (21) result when using tensor notation. For that purpose, one can transform the position, velocity and acceleration tensors (6), (7), (8), but since they are expressed as functions of a parameter (the time), it is simpler to transform only the underlying metric using TransformCoordinates. That has the advantage that all the geometrical subtleties of curvilinear coordinates, like scale factors and dependency of unit vectors on curvilinear coordinates, get automatically, very succinctly, encoded in the metric:

 >
 (22)

The computation of geodesics assumes that the coordinates () depend on a parameter. That parameter is passed as the first argument to Geodesics

 >
 (23)

These equations of motion (23) are the same as the equations (21) computed using standard vector notation, differentiating and taking into account the dependency of curvilinear unit vectors on the curvilinear coordinates in (16) and (17).  One of the interesting features of computing with tensors is, as said, that all those geometrical algebraic subtleties of curvilinear coordinates are automatically encoded in the metric (22).

To understand how are the geodesic equations computed in one go in (23), one can perform the calculation in steps:

 1 Make  be a function of  directly in the metric
 2 Compute - not the final form of the equations (23) - but the intermediate form expressing the geodesic equation using tensor notation, in terms of Christoffel symbols
 3 Compute the components of that tensorial equation for the geodesic (using TensorArray)

For step 1, we have

 >
 (24)

Set this metric where

 >
 (25)

Step 2, the geodesic equations in tensor notation with the coordinates depending on the time t are computed passing the optional argument tensornotation

 >
 (26)

Step 3: compute the components of this tensorial equation

 >
 (27)

These are the same equations (23).

Having the tensorial equation (26) is also useful to formulate the equations of motion in tensorial form in the presence of force. For that purpose, redefine the contravariant tensor  to represent the force in the cylindrical basis

 >
 (28)

Newton's 2nd law (19)

 >
 (29)

now using tensorial notation, becomes

 >
 (30)
 >
 (31)

where we recall (see related Mapleprimes post) that to obtain the vector components entering  from these tensor components we need to multiply the latter by the scale factors (), the component of  in the direction of  is given by .

Coriolis force and centripetal force

After changing variables the position vector of the particle got expressed in (15) as

A distinction needs to be made here, according to whether the unit vector  depends or not on the time , the former being the general case. When  is a constant, the value of the coordinate  - the angle between  and the x axis - does not change, there is no rotation around the z axis. On the other hand, when , the orientation of  and so the coordinate  changes with time, so either the force acting on the particle has a component in the  direction that produces rotation around the z axis, or the system of references - itself - is rotating around the z axis.

Likewise, the expression (15)  can represent the position vector measured in the original Galilean (inertial) system of references, where a force is producing rotation around the z axis, or it can represent the position of the particle measured in a rotating, non-inertial system references. Hence the transformation (14) can also be interpreted in two different ways, as representing a choice of different functions (generalized coordinates) to represent the position of the particle in the original inertial system of references, or it can represent a transformation from an inertial to another rotating, non-inertial, system of references.

This equivalence between the trajectory of a particle subject to an external force, as observed in an inertial system of references, and the same trajectory observed from a non-inertial accelerated system of references where there is no external force, actually at the root of the formulation of general relativity, is also well known in classical mechanics. The (apparent) forces observed in the rotating non-inertial system of references, due only to its acceleration, are called Coriolis and centripetal forces.

To see that the equations

that appeared in (27) when in the inertial system of references , are related to the Coriolis and centripetal forces in the non-inertial referencial, following [1] introduce a vector representing the rotation of that referencial around the z axis (when, in the inertial system of references, the non-inertial system rotates clockwise, in the non-inertial system  increases in value in the anti-clockwise direction)

 >
 (32)

According to [1], (39.7), the acceleration in the inertial system is expressed in terms of the quantities in the non-inertial rotating system by the sum of the following three vectorial terms.

First, the components of the acceleration measured in the non-inertial system are given by the second derivatives of the coordinates () multiplied by the scale factors, which in this case are given by () (see this post in Mapleprimes)

 >
 (33)

Second, the Coriolis force divided by the mass, by definition given by

 >
 (34)

Third the centripetal force divided by the mass, defined by

 >
 (35)

 >
 (36)

So that

 >
 (37)

and where the right-hand side of (36) is, actually, the result computed lines above in (18)

 >
 (38)
 >
 (39)

From (37), in the absence of external forces  and so the acceleration  measured in the rotating system is given by the sum of the Coriolis and centripetal accelerations

 >
 (40)

In other words: in the absence of external forces, the acceleration of a particle observed in a rotating (non-inertial) system of references is not zero.

Expressing this equation (40) in terms of () we get

 >
 (41)

resulting in the three equations

 >
 (42)
 >
 (43)
 >
 (44)

which are the equations returned by Geodesics in (23)

 >
 (45)
 >

References

[1] L.D. Landau, E.M. Lifchitz, Mechanics, Course of Theoretical Physics, Volume 1, third edition, Elsevier.

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

## Atomic Variables ...

I'm trying to document some generator calculations that use terms line Xd'. In Maple that turns into a derivative. I converted several 'ed variables into atomic variables. They have made my work sheet unusable. They appear to randomly loose connecin to their assigned values and prevent numeric solutions by showing  up in symbolic form. Once this happens, I have to check each instance where the variable isuse to find where the loss/lossses occured. (copy and past each instance of the variable and check its value).

Once found I can't find a consistant way to re-associate them with the assigned value.

Any suggestions. See botton of attaced work sheet.

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/WS_Gen_I_and_E_for_fauls_on_HS_of_GSU_-_Time_Response_&_51V_Trip_Times_-R5a.mw .

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/WS_Gen_I_and_E_for_fauls_on_HS_of_GSU_-_Time_Response_&_51V_Trip_Times_-R5a.mw .

## How to define 4 functions from the dsolve solution...

How to define 4 functions from the dsolve solution of a system of 4 differential equations?

restart: with(plots): with(DEtools):with(LinearAlgebra):with(Statistics):with(CurveFitting):with(Optimization):
ddesys := {diff(S(t),t) = -beta*S(t)*Ix(t)/N,
diff(Ex(t),t) = beta*S(t)*Ix(t)/N - sigma*Ex(t-tau__1),
diff(Ix(t), t) = sigma*Ex(t - tau__1)- gamma*Ix(t-tau__2),
diff(R(t),t) = gamma*Ix(t-tau__2),
diff(Dx(t),t) = delta*Ix(t),
S(0) = 80900, Ex(0) = 1, Ix(0) = 1, R(0) = 0, Dx(0) = 0 }:
dsn := dsolve(eval(ddesys, {beta = 4, gamma = 0.0478, sigma = 0.10, delta = 0.0005, N=80900, tau__1 = 1.1,tau__2 = 8.7,tau__3 = 0}), numeric):

## How to solve a stochastic partial differential equ...

Hi,

Please can you give me a hand with numerical solving and visualising the partial differential wave equation with stochastic term eta(t), using methods of stochastic calculus?

diff(u(x, t), t \$ 2) - (1+eta(t))*diff(u(x, t), x \$ 2) = 0

I had a look at the "stochastic" package by Sasha Cyganowski, but couldn't find an example for stochastic pde.

Thanks,

Dmitrii

## A probability riddle...

Here is a known probability riddle:

A and B are two lists of 100 binary numbers:

```A:=[0,1,0,1,0,1,1,0,1,1,1,0,0,1,1,1,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,0,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,1,1,0,1,0,1,0,1,0,1,0,0,0,1,1,0,1,0]:
B:=[0,1,1,0,1,1,0,1,1,1,0,1,0,0,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,0,1,0,1,1,0,1,1,0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,0,1,0]:
```

One was obtained by tossing a coin (1 for a head, 0 for a tail), and the other by a human, who was asked to simulate tossing a coin.

Question: which one comes from a human brain?
The standard answer: B was produced using a coin, because (among other things) the probabilty of obtaining a "000000" or "111111" is about 80%, but a humain brain tends to avoid such "simulations".

My Question: what (if any) statistical test can be used in Maple for an answer?
(I have tried ChiSquareSuitableModelTest but both lists were accepted).

## I have a set of boundary conditions that i want t...

`# I solved the differential equation using a fourier series decomposting method. I found with the help of "Dsolve" the different expressions of the fourier constants and now I will apply the boundary conditions to find the expressions of its constants.`

#this my boundary conditions

#this my system of equations

## Why does Maple freeze?...

Recently Maple started freezing on me for a few minutes; after that it continues to work and then freezes again and so on (it does not so much freezes as it pauses).  I do not know what changed on my system (which is Windows 10) for this to happen.  I had been using Maple 2019 when this started and then upgraded to Maple 2020 but that did not solve my problem.

It does not seem to have to do with the type of computations I am doing.

## The solution of the system of symbolic equations...

I have problem with usage of solve for the solution of the system of six and eight symbolic equations. I need to get expressions for variables: R__xl, R__xs, R__xsi, R__zl, R__zs, R__zsi, dbeta__l(t), dbeta__s(t). I tried to find solution for 8 equations, but I got the message: Warning, solutions may have been lost. I thought that the system is non-linear and tried to solve it for six variables (R__xl, R__xs, R__zl, R__zs, R__zsi, R__xsi), in this case equations are linear, but Maple ignored the solve command and did not give a solution or error. Could someone help me with this problem?

Quasi-static.mw

## Difference between Threads:-Seq and Grid:-Seq - Wh...

Hello

I am not sure how to choose between Threads:-Seq and Grid:-Seq.

The problem:  a procedure, proc1, that calls two other procedures, proc2 and proc3, verifies if a set of parameters fulfills a certain condition. Proc1, proc2 and proc3 are not part of Maple available functions.

Right now I am using Grid:-Seq to return the result of applying proc1 to chunks of a thousand parameters.  I wonder whether I could use Thread:-Seq instead.   What are the advantages of using one instead of the other?  And when do I choose one over the other?

I would appreciate if you could provide simple examples to explain the differences.

Many thanks.

Ed

PS.  There is a problem with Grid:-Seq as reported in one of my previous questions.

 3 4 5 6 7 8 9 Last Page 5 of 1677
﻿