## 13316 Reputation

18 years, 77 days

## cannot reproduce...

Hi
When entering z1*z2*z1*z1; I receive z1 z2 z1^2 which is correct. What version of Maple are you using?

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Total number of particles...

Hi Andriy,

 >

Note first the use of the up-to-date Physics library (dowloadable from the Maple Physics: Research & Development updates page):

 >
 (1)

Now, Psi is a mathematical function (check ?Psi) so, although possible, it's better to not use that name to avoid potential ambiguous meaning. I all what follows below I use psi instead.

 >
 (2)

Your annihilation operators: as mentioned by Carl, you can delay evaluation of these procedures am, ap, nn until i, j and  are all nonnegative integers. For that purpose, add the line you see below after "local k"

 >
 (3)

Insert the same line for ap that generats your creation operators, and also for nn, the occupation number at state

 >
 (4)
 >
 (5)

IMPORTANT: the internal routines know that if A is a quantum operator (and all annihilation and creation operators generated by Annihilation and Creation are automatically quantum operators), a sum of A objects is also a quantum operator. However, because these am, ap and nn defined above are returning unevaluated when any of  are not numbers, the internal routines have no way to know these am, ap, nn programs are quantum operators, restricting the use of these three procedures when  are not numbers. You resolve this by directly passing this piece of information, as in

 >
 (6)

And now you can operate with am, ap and nn as quantum operators even when  are not numbers. For instance, you can do sum, or Sum - but then you cannot us add for the summation where  f is a summation limit and is not defined. So for instance use sum for the addition from 1 to f, and use add for the rest

 >
 (7)

As said, because you indicated that nn is a quantum operator, the system now knows that this sum 'N ' is also a quantum operator:

 >
 (8)

You can now apply N to a Ket even not saying the value of f, although of course the operation cannot be performed to the end until you tell that value (note also that `.` automatically distributes over the sum)

 >
 (9)
 >
 (10)

Evaluate for instance at  f = 2

 >
 (11)

This result is correct and I understand the answer to your question on how to do this, which is pretty close to what you have done in fact.

For curiosity, let's anyway verify this result. You need to check that

a) N is an operator that indeed returns the total number of particles.

b) This total number of particles of the state represented by the ket K is indeed 5.

Start with b) just because it is a 1 step thing: the total number of particles of a Ket is equal to the sum of its occupation numbers.  So, discarding the label of K (first operand), the occupation numbers are

 >
 (12)

and you can add them via

 >
 (13)

So b) checks OK.

For a) you need to show that the summation NK indeed adds all these occupation numbers of K. For that, get the summand

 >
 (14)

Get the nn operands in this summand

 >
 (15)

Check now the quantum number over which each of these Inn operators act. For that purpose note Library:-GetFingerprint (a section describing it is found within the help page for the Physics, Library )

 >
 (16)
 >
 (17)

The quantum number returned by  is then the third element returned by GetFingerprint above. So get all the products  being added and get the occupation number each of them is returning

 >
 (18)
 >
 (19)

In summary: the sum NK is returning a sum of each of the 12 occupation numbers and, indeed, twelve is the number of "occupation numbers" of K, so this sum is adding all the twelve occupation numbers:

 >
 (20)

and because the sum of these occupation numbers is also the total number of particles of the state represented by the Ket then NK is indeed returning the total number of particles.

 >

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Physics:-SumOverRepeatedIndices and Phys...

Hi Peter,

 >
 (1)

Note the use of the up-to-date Physics library (dowloadable from the Maple Physics: Research & Development updates page):

 >
 (2)

Now regarding your post: to work in 3D, you can set the dimension to 3 as you did, yes, or perhaps simpler just set the metric of a the default 4D spacetime to have  and set the letters to use for spaceindices (not spacetimeindices), for instance as in

 >
 (3)

This is the metric (you do not need to use print as in print(g_[]))

 >
 (4)

You can now work with the 3D part by referring to it using spaceindices (not spacetimeindices).

Regarding your use of `.` instead of `*` in the Lagrangian below (I assume you did that to produce tensor contractions), note that the identity , valid in Euclidean or Minkowski spaces, is not valid in this case where diff and  do not commute because the Christoffel symbols have nonzero components

 >
 (5)

In short, in this system of coordinates  is not a tensor

 >
 (6)
 >
 (7)

The use of `.` to contract the indices then produces no contraction (it would be wrong, equivalent to commuting diff and ) and here is then the Lagrangian - the 3D part using spaceindices

 >
 (8)

Regarding your question: the command to perform a summation over the repeated indices is:

 >
 (9)

Below you have a section showing the same but setting the dimention of 'spacetime' to 3 as you did originally.

Regarding your other question, on how to expand the vector expression

 >
 (10)

recalling I am working with the updated Physics library, you can use expand, Expand, or - in the case of Vectors expandable commands as this one - also with Simplify

 >
 (11)
 >
 (12)
 >
 (13)
 Alternative way, setting the dimension of "spacetime" to 3

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## dsolve = many methods...

In brief: dsolve is a general solver, able to solve different kinds of equations, and with a strategy of taking advantage of different methods when more than one can solve a given equation - nothing of that is present in DEtools[bernoullisols] that can only solve Bernoulli equations and always using the same method.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Exact general symbolic solution matching...

Hi,

In what follows you have the symbolic exact solution to the ODE system you posted, matching the ics you posted, and without specializing any of the symbolic parameters a1, a2, a3, b1, b2 or b3.

 >
 (1)

Strategy:

1) rewrite this system as an ODE system for three unknowns C1, C2, C3, plus an expression giving O1 in terms of them

2) compute the exact solution for C1, C2, C3 in terms of three arbitrary constants

3) adjust the three arbitrary constants to match your initial conditions ics for C1, C2 and C3

4) substitute this solution for C1, C2, C3 matching your initial conditions into the expression giving O1 in terms of them.

While performing these steps, do not display expressions that are too large.

Step 1), one of the equations you present as ics is actually a constraint between the functions:

 >
 (2)

The actual system to be solved then involves 4 DEs and one constraint

 >
 >
 (3)
 >
 (4)

Rewrite now this as "one constraint and three DEs involving only C1, C2 and C3" (see casesplit )

 >
 (5)

In the above you see a system entirely equivalent to yours, but now involving 3 DEs instead of four. Remove then the constraint (that has O1 for lhs) to work just with the ODE system, and assign it to

 >
 (6)
 >
 (7)

Step 2) Compute now the exact solution to this system; note that dsolve will solve and simplify the solution - most of the time is spent in simplifying

 >
 (8)
 >
 (9)

As mentioned by others, these solutions involve large algebraic expressions

 >
 (10)

You can transform these into slightly shorter expressions using simplify/size

 >
 >
 (12)

Before proceeding further, let's verify this solution

 >
 (13)

Step 3) Now you need to adjust the integration constants to match your ics for C1, C2 and C3

 >
 (14)

are:

 >
 (15)

So: evaluate  at  and substitute in  in order to have a system for the Cn

 >

Check lengths

 >
 (16)

The symbols in these ics are

 >
 (17)

Solve now for the Cn and simplify the size; check lengths and left-hand sides

 >
 >
 (18)
 >
 (19)

At this point we have solved the problem:  is the general solution in terms of three arbitrary constants Cn and  gives the value of these three arbitrary constants that match your  for C1, C2 and C3. So evaluate  at  to get the answer you are looking for; check lengths

 >
 >
 (20)
 >
 (21)

Step 4) To get the answer to O1, substitute these solutions for C1, C2 and C3 in the

 >
 (22)
 >
 >
 (23)

In addition, the following three would help in compacting the expressions, but they are rather large and simplifying takes time - I am keeping the lines here in comments in case you want to try them

 >
 >

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Take vector products...

Hi,

Suppose a set of N vectors where there may be one of them parallel to one another: their cross product is zero. So, in Maple, for j to N-1, for k from j+1 to N, if V[j] &x V[k] = 0 then V[j] is parallel to V[k]. You can perform this loop operation either using VectorCalculus or Physics:-Vectors.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Yes...

Hi,
Yes, in Maple 17 you can do substitutions of tensors of the form you mention, taking into account free and dummy indices the same way we do when computing with paper and pencil. You need to update your Physics library with the latest one, available for download at the Maplesoft Physics: Research & Development webpage. The command you use to do these substitutions, SubstituteTensor, is currently a Physics:-Library command, part of an upcomming more general Physics:-Substitute command, to handle also tensorial subexpressions within noncommutative products similar to what algsubs and simplify/siderels do with commutative nontensorial products.

 >
 >
 (1)
 >
 (2)

The repeated and free indices of the lhs and rhs of (2)

 >
 (3)

The easy case

 >
 (4)

The free index in the target expression is not  but

 >
 (5)

Distinction between covariant and contravariant indices

 >
 (6)

The index  found repeated in the rhs of the substitution equation (2) apears also repeated in the following target expression

 >
 (7)
 >
 (8)
 >
 (9)

Substitute (2) in the rhs of (2) itself

 >
 (10)
 >
 (11)

The example you posted as a question

 >
 (12)
 >
 (13)
 >
 (14)
 >

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## DEtools[remove_RootOf]...

Hi
allvalues is the natural command to use in that - when solve can rewrite the RootOf expression free of RootOf - you will get rid of it.

There are other situations though, where you would like to understand the RootOf expression without RootOfs around, or allvalues is of no help because solve cannot rewrite the expression without them. This is a typical situation when working with differential equations. A command helpful in these cases, not so well known, is DEtools[remove_RootOf].

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Other forms of solution?...

You can try other commands of PDEtools as PolynomialSolutions, FunctionFieldSolutions and mainly InvariantSolutions combined with its optional arguments. It would also help seeing the PDE you want to solve - sometimes one can see a change of variables that helps.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Using Physics, not the old tensor....

Hi. My suggestion was for you to do these computations using the Physics package, not the old 'tensor' package. Here it is how.

 >

Example with the Schwarzschild metric in spherical coordinates: instead of using Setup (you can, but you do not need to), set the spacetime metric directly from the the metric command g_

 >
 (1)

The Kretschmann scalar is given by

 >
 (2)
 >
 (3)

The above concerns your fist post, and to see the Ricci tensor you can always

 >
 (4)

Now in your second post, however, you do not use the Physics package as suggested but the old 'tensor' package. The computations with the old 'tensor' are overly complicated and that package is by now obsolete.

My suggestion in the previous replies were computing this using Physics, it is really simpler.

Copying the metric info from the worksheet attached in your last reply and pasting here:

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

Noticing now that your coordinates  are the same introduced above with the Schwarzschild metric where  = t, you can now re-enter the metric in different ways, see Physics:-Setup  .For instance, to avoid disquisitions about the ordering of the coordinates, enter the metric directly as the square of the line element

 >
 >

That is all.

To compute the Kretschmann scalar for this metric, just Simplify(K) again, and no need to re-enter, re-construct or re-define the Riemann tensor or anything else.

 >

Regarding the Schwarzschild limit when  mentioned in your worksheet, this is the metric with

 >
 (9)

(If you want to see the inversse of the metric, just enter  )

This is the value of  at q = 0 :

 >
 (10)

This is the value of the K scalar when q = 0

 >
 (11)

And this is the KScalar for  (a bit of a wallpaper even after simplifying in size)

 >
 (12)

 >

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Physics package = same functionality...

Hi
Note that in Maple 16 you have the same functionality (and furthermore) within the distributed Physics package.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi
Note also there is now access to the version of Physics under development, available for download at http://www.maplesoft.com/products/maple/features/physicsresearch.aspx, with adjustments and fixes as they are ready, including the one I mentioned in my previous reply for this problem you posted.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi Peter137
A fix to the problem you posted is now in place, and new: now there is access to the version of Physics under development, available for download at http://www.maplesoft.com/products/maple/features/physicsresearch.aspx. This version includes post 17.01 material, adjustments, fixes, and novelties as they are ready. In the page you can also present your suggestions, etc

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## dsolve's solution is correct...

dsolve's solution is correct:

 > ode := [diff(u(t),t)-f(t)=0, diff(f(t),t)+t*f(t)=0, diff(f(t),t\$2)+(t*sin(a)*sin(b))^2*f(t)=0];
 (1)
 > dsolve(ode);
 (2)

This simplification (see ?PDEtools/casesplit) explains dsolve's solution:

 > PDEtools:-casesplit(ode);
 (3)

You can arrive at the same result by hand. Take the first equation, and you have the solution for f(t) as a function of u(t)

 > isolate(ode[1], f(t));
 (4)

Remove now f(t) from the system

 > eval(ode, %);
 (5)

Take the second equation

 > isolate(%[2], diff(u(t),t,t));
 (6)

Substitute into the third equation

 > factor(PDEtools:-dsubs(%, %%[3]));
 (7)

So, the solution for u(t) is

 > dsolve(%);
 (8)

Then from (4) the solution for f(t) is 0.

 >