ecterrab

14630 Reputation

24 Badges

20 years, 147 days

MaplePrimes Activity


These are answers submitted by ecterrab

Michael

Recalling, generally speaking, a tetrad is defined up to a (6-parameter) Lorentz transformation. Therefore, there are infinitely many possible choices. So it is not the case that e_[1,mu] d_[mu](F) should have any only one particular form. That value depends on the choice of the tetrad.

Recall as well that even specifying that the thetrad is orhonormal (this is Physics's default value), or null, still does not define the tetrad univocally. Formulas 3.14 and 3.15 of Stephani's book "Exact Solutions to Einstein's equations" show how to transform the tetrad in different ways. Those formulas can be used rigth away within Physics. The same formulas are displayed in the help page for DifferentialGeometry:-Tensor:-NullTetradTransformation.

Having said that, about the directional (tetrad) derivative: just write the d_ operator with a tetrad index. By default, lowercase latin is used for tetrad when you load Tetrads, so enter d_[a](F) and that will suffice; it is the same as e_[a,mu]*d_[mu](F). Yes you can then use SumOverRepeatedIndices, or to get the four values (one for each value of the index a) you can use TensorArray, which automatically uses SumOverRepeatedIndices (unless you ask not to do that with optional arguments; this is explained in ?TensorArray).

So all boils down to your choice of tetrad ... I wrote about this when replying to your previous post related to the same problem. Perhaps if you tell (worksheet) what is the tetrad that you have in mind to work with? As said in that previous reply, you can always indicate the tetrad directly to Physics, and all in the package will take that indication into account. You set the tetrad to be what you prefer via Setup(tetrad = ....) or Setup(e_ = ...) both work. Or, you can take the tetrad computed by the package by default (orthonormal or null), then use formulas 3.14 and 3.15 of Stephani's book to produce another tetrad, fix the parameters so that it is the more convenient one for you (e.g. it could be principal axis), then set it as said using Setup.

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

Hi Michael

As Carl pointed out, this is a GUI setting. In any case, large expressions happen frequently. Recently, a new mode of computation got added to Physicsautomaticsimplification. You could use it to resolve the issue, for that you need to update your Physics from the Maplesoft R&D Physics webpage. Alternatively, you could prefer to specify the simplifier yourself, explicitly, directly to TensorArray, for instance by passing to it and optional argument 'simplifier = (u -> simplify(u, size))'. The result wlil be the same as the one you get with automaticsimplification. This is an excerpt of your worksheet showing your input/output lines after turning ON automaticsimplification.The reviewed worksheet is linked at the end.

By the way, key in the computation you show is the form of the tetrad. Physics automatically computes an orthonormal tetrad (you could ask for a null tetrad) but if you have another one, of any kind that is more convenient, you can set it, so that all Physics work with it, via Setup(e_ = your_choice_of_tetrad).

Download Derive_Eq_4.4_(reviewed).mw

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

PoslavskySV

I am a bit surprised with the level of innacuracy of the title of your post, "Physics:-Simplify does not work with tensors". The help page of Physics:-Simplify, with varied simplification of tensorials expressions at the beginning of the Examples section, as well as many Mapleprimes posts, confirm the opposite of your title. Anyone can see that. In any case I am not in for debates.

Regarding the examples you posted explicitly:

Besides actually simplifying the 8 examples you posted, although there is - and will always be - room for improvements, recall that Physics is a Computer Algebra environment for Theoretical Physics not restricted to just algebraically simplifying tensorial expressions, as the other packages you mentioned. And having in mind that Physics already has good simplification of tensorial expressions covering the basics and more (e.g. handling of noncommutative tensor operators, or repeated spacetimetetrad and/or space indices in the same expression), I preferred to focus on other physics areas that appear to me as more important. To mention but two, the introduction of the tetrad formalism in general relativity and of parameterized algebra rules in quantum mechanices are new developments recently finished.

Anyway thanks for the examples, it is also true that improvements in the simplification of tensorial expressions happened for every one of the last 5 Maple releases, also in connection with user feedback like yours now.

Download SimplifyingTensorialExpressions.mw

Edit: just tried version 41.1 Dec/15 of the Physics updates from the Maplesoft webpage and, actually, Simplify with the tryhard option simplifies correctly: 

  1. all the 250+ examples of your file Maple18_failSimple.txt, as well as
  2. all of the 1000 examples of your other file Maple18_allSimple.txt, and
  3. all of the 100 examples of your other file Maple18_allMedium.txt

as seen in the three attached worksheets below. In summary, Simplify fails in simplifying none of these 1,350 examples of these three files you posted nor it fails in simplifying any of the 8 ones you posted explicitly. So much for your "Physics:-Simpify does not work with tensors".... At some point next year I will give a look at your other file with larger examples. Anyway things are not as your post title says and also were not before this single day of exchanges (or otherwise this is a very easy problem and I am very fast in coding the whole simplification of tensorial expressions in a couple of hours :).

I am moving the focus to other things. At some point during the week I will still see to have Simplify performing these simplifications without having to indicate tryhard.

Download Simplified250Examples.mw

Download Simplified1000Examples.mw

Download Simplified100MediumExamples.mw

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

Hi
Attached is your worsheet after a fix, such that it opens fine in Maple 18, 17 and 16. Could you please give it a look and confirm that everything is there?

By the way I noticed that it is all about general relativity using GRTensor. It is a fantastic package. And the first one of its kind. But what in current Maple you have Physics and DifferentialGeometry with more functionality, and for the tensor computations I see in the worksheet I'd say Physics would permit almost a direct translation with various advantages (simplicity more than anything else, and you do not need to do so many steps for what you want to accomplish). I'd suggest you give it a try.

FenixHPbien (fixed).mw

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

Hi

I suggest you to give a look at "this other answer in Mapleprimes", that discuss the issue and presents links to answers to the same question. Now, Maple 16 is a bit old with regards to Physics; so many things have changed in the package.

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

Hi

I like Andriy's answer, not because of perfection, I really do not find value in perfection, but because it has the perspective of a spontaneous and skilled user. Independent of that, though I'm currently pretty busy with new material, I will see if next week I find time to suggest some shortcuts to what Andriy presented.

Here I would only like to add two comments.

  1. Within the Physics package, special care has been taken with not repeating code already existing in the Maple library. For example, there is already code for computing eigenvalues and eigenvectors outside the Physics package, and this code is fully compatible with Physics.
  2. There is a large number of examples about QM using Maple Physics, already posted here in Mapleprimes, as well as in the Physics[examples] help page (section on Quantum Mechanics, close to the end of the page) of the distributed Maple software. Either you didn't notice this Examples help page and Mapleprimes posts, or they are insufficient in some way that you didn't tell (if so, please post here and the page will probably get improved taking your feedback into account).

So please give a look at the section on Quantum Mechanics of the help page ?Physics,examples, as well as to these other Mapleprimes posts:

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

Hi nm

Give a look at the LibraryTools package. With those commands you can list the libraries and analize their content; it is then possible to select by type `module` and table, and for all of them list the exports and indices, and that is - I'd say - 95% of what you want; then refine the approach a little bit and you get what you mentioned in your post.

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

@Andriy 

No, Physics:-`.` and Physics:-`*` are not equivalent. You use `.` when you apply an operator to a Ket or extended Ket structure (see related types in the Physics:-Library:-PhysicsType package). You can represent the `.` product using `*` if you wish, but the operator doesn't get applied. Example: Setup(op=A) then try A . Ket(A, n) and compare with A * Ket(A, n). So, no, it is not related com backwards compatibility either.

Now: when you multiply two operators, as in A . B or A*B, for us physicists this distinction `.` versus `*` is, frankly, only a notation issue related exclusively to 'computers'. We expect both to represent the same thing. What happened for Maple 18 is that I normalized both products into one single form in order to avoid having A . B - A * B not recognized as 0. Naturally, the change includes that (A . B) . Ket works the same way as (A * B) . Ket. In fact this change was done in connection with a Mapleprimes exchange with you about sorting products etc.

Regarding your other question in this same thread: type(f(a, b, c), 'f(anything, anything)') is false because f(a, b, c) has three operands not two; use f(anything, anything, anything) as second argument to type to see it matching, or you can also check this other answer to get some more details on how it works.

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

Hi Andriy

Below is the answer, I believe easy to understand after you understand how the types `*`, `^` and `.` work -- what is said below applies to all of them - after loading Physics. As usual, I recommend updating to the latest version of Physics downloading it from the Maplesoft R&D Physics webpage.

TypeProduct.mw

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



download VariablesThatAntiCommute.mw


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

Hi Hamada
For all of a, b, c, d, g, and F arbitrary, Maple cannot find a solution, which basically means that there is no known algorithm for solving that problem. If you however specialize one or more of these six parameters entering the equation, by means of giving a value to one or more of them, there are infinitely many cases which are fully solvable.

For instance, set a=0 and you receive a solution in terms of Kummer functions, the case a=0, b=0 is solvable in terms of Airy functions, etc. Attached is a worksheet you could run specializing to 0 or 1 either a single parameter, or a couple, triplet, etc. up to the six of them. You could use the worksheet also as a template to try different specializations - the two shown are only to illustrate the idea.

diff(y(x), x) = a*y(x)^3+(b*x+c)*y(x)^2+d*y(x)+g*x+f

diff(y(x), x) = a*y(x)^3+(b*x+c)*y(x)^2+d*y(x)+g*x+f

(1)

lprint(%)

diff(y(x), x) = a*y(x)^3+(b*x+c)*y(x)^2+d*y(x)+g*x+f

 

zero := map(proc (u) options operator, arrow; map(`=`, u, 0) end proc, [seq(op(`ODEtools/permute`([a, b, c, d, g, f], j)), j = 1 .. 6)])

[[a = 0], [b = 0], [c = 0], [d = 0], [g = 0], [f = 0], [a = 0, b = 0], [a = 0, c = 0], [a = 0, d = 0], [a = 0, g = 0], [a = 0, f = 0], [b = 0, c = 0], [b = 0, d = 0], [b = 0, g = 0], [b = 0, f = 0], [c = 0, d = 0], [c = 0, g = 0], [c = 0, f = 0], [d = 0, g = 0], [d = 0, f = 0], [g = 0, f = 0], [a = 0, b = 0, c = 0], [a = 0, b = 0, d = 0], [a = 0, b = 0, g = 0], [a = 0, b = 0, f = 0], [a = 0, c = 0, d = 0], [a = 0, c = 0, g = 0], [a = 0, c = 0, f = 0], [a = 0, d = 0, g = 0], [a = 0, d = 0, f = 0], [a = 0, g = 0, f = 0], [b = 0, c = 0, d = 0], [b = 0, c = 0, g = 0], [b = 0, c = 0, f = 0], [b = 0, d = 0, g = 0], [b = 0, d = 0, f = 0], [b = 0, g = 0, f = 0], [c = 0, d = 0, g = 0], [c = 0, d = 0, f = 0], [c = 0, g = 0, f = 0], [d = 0, g = 0, f = 0], [a = 0, b = 0, c = 0, d = 0], [a = 0, b = 0, c = 0, g = 0], [a = 0, b = 0, c = 0, f = 0], [a = 0, b = 0, d = 0, g = 0], [a = 0, b = 0, d = 0, f = 0], [a = 0, b = 0, g = 0, f = 0], [a = 0, c = 0, d = 0, g = 0], [a = 0, c = 0, d = 0, f = 0], [a = 0, c = 0, g = 0, f = 0], [a = 0, d = 0, g = 0, f = 0], [b = 0, c = 0, d = 0, g = 0], [b = 0, c = 0, d = 0, f = 0], [b = 0, c = 0, g = 0, f = 0], [b = 0, d = 0, g = 0, f = 0], [c = 0, d = 0, g = 0, f = 0], [a = 0, b = 0, c = 0, d = 0, g = 0], [a = 0, b = 0, c = 0, d = 0, f = 0], [a = 0, b = 0, c = 0, g = 0, f = 0], [a = 0, b = 0, d = 0, g = 0, f = 0], [a = 0, c = 0, d = 0, g = 0, f = 0], [b = 0, c = 0, d = 0, g = 0, f = 0], [a = 0, b = 0, c = 0, d = 0, g = 0, f = 0]]

(2)

one := map(proc (u) options operator, arrow; map(`=`, u, 1) end proc, [seq(op(`ODEtools/permute`([a, b, c, d, g, f], j)), j = 1 .. 6)])

[[a = 1], [b = 1], [c = 1], [d = 1], [g = 1], [f = 1], [a = 1, b = 1], [a = 1, c = 1], [a = 1, d = 1], [a = 1, g = 1], [a = 1, f = 1], [b = 1, c = 1], [b = 1, d = 1], [b = 1, g = 1], [b = 1, f = 1], [c = 1, d = 1], [c = 1, g = 1], [c = 1, f = 1], [d = 1, g = 1], [d = 1, f = 1], [g = 1, f = 1], [a = 1, b = 1, c = 1], [a = 1, b = 1, d = 1], [a = 1, b = 1, g = 1], [a = 1, b = 1, f = 1], [a = 1, c = 1, d = 1], [a = 1, c = 1, g = 1], [a = 1, c = 1, f = 1], [a = 1, d = 1, g = 1], [a = 1, d = 1, f = 1], [a = 1, g = 1, f = 1], [b = 1, c = 1, d = 1], [b = 1, c = 1, g = 1], [b = 1, c = 1, f = 1], [b = 1, d = 1, g = 1], [b = 1, d = 1, f = 1], [b = 1, g = 1, f = 1], [c = 1, d = 1, g = 1], [c = 1, d = 1, f = 1], [c = 1, g = 1, f = 1], [d = 1, g = 1, f = 1], [a = 1, b = 1, c = 1, d = 1], [a = 1, b = 1, c = 1, g = 1], [a = 1, b = 1, c = 1, f = 1], [a = 1, b = 1, d = 1, g = 1], [a = 1, b = 1, d = 1, f = 1], [a = 1, b = 1, g = 1, f = 1], [a = 1, c = 1, d = 1, g = 1], [a = 1, c = 1, d = 1, f = 1], [a = 1, c = 1, g = 1, f = 1], [a = 1, d = 1, g = 1, f = 1], [b = 1, c = 1, d = 1, g = 1], [b = 1, c = 1, d = 1, f = 1], [b = 1, c = 1, g = 1, f = 1], [b = 1, d = 1, g = 1, f = 1], [c = 1, d = 1, g = 1, f = 1], [a = 1, b = 1, c = 1, d = 1, g = 1], [a = 1, b = 1, c = 1, d = 1, f = 1], [a = 1, b = 1, c = 1, g = 1, f = 1], [a = 1, b = 1, d = 1, g = 1, f = 1], [a = 1, c = 1, d = 1, g = 1, f = 1], [b = 1, c = 1, d = 1, g = 1, f = 1], [a = 1, b = 1, c = 1, d = 1, g = 1, f = 1]]

(3)

for val in zero do print(val, "============================================"); traperror(timelimit(120, dsolve(subs(val, diff(y(x), x) = a*y(x)^3+(b*x+c)*y(x)^2+d*y(x)+g*x+f), useInt, implicit))) end do;

[a = 0], "============================================"

 

y(x) = -b*((b^2*f^2+(-2*c*f+d^2)*g*b+c^2*g^2)*_C1*(8*(-b*g)^(3/2)+b^2*f^2+(-2*c*f+d^2)*g*b+c^2*g^2)*KummerU((1/16)*((b^2*f^2+(-2*c*f+d^2)*g*b+c^2*g^2)*(-b*g)^(1/2)+24*b^2*g^2)/(b^2*g^2), 3/2, -(1/4)*(d*(-b*g)^(1/2)-c*g+b*f)^2*(-b*g)^(1/2)*((2*g*x+f)*b+c*g)^2/(b^2*(2*d*(b*f-c*g)*(-b*g)^(1/2)+b^2*f^2+(-2*c*f-d^2)*g*b+c^2*g^2)*g^2))+((-16*b^2*f^2+(32*c*f-16*d^2)*g*b-16*c^2*g^2)*(-b*g)^(3/2)-32*b*((-b*f+c*g)*(-b*g)^(1/2)+d*b*g)*g*((2*g*x+f)*b+c*g))*KummerM((1/16)*((b^2*f^2+(-2*c*f+d^2)*g*b+c^2*g^2)*(-b*g)^(1/2)+8*b^2*g^2)/(b^2*g^2), 3/2, -(1/4)*(d*(-b*g)^(1/2)-c*g+b*f)^2*(-b*g)^(1/2)*((2*g*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*(-b*g)^(1/2)+b^2*f^2+(-2*c*f-d^2)*g*b+c^2*g^2)*g^2))+16*b^3*((2*d*((2*g*x+f)*b+c*g)*(-b*g)^(1/2)+f*(4*g*x+f)*b^2+2*(-2*c*g*x+c*f-(1/2)*d^2)*g*b-3*c^2*g^2)*KummerM((1/16)*((b^2*f^2+(-2*c*f+d^2)*g*b+c^2*g^2)*(-b*g)^(1/2)+8*b^2*g^2)/(b^2*g^2), 3/2, -(1/4)*(d*(-b*g)^(1/2)-c*g+b*f)^2*(-b*g)^(1/2)*((2*g*x+f)*b+c*g)^2/(b^2*(2*d*(b*f-c*g)*(-b*g)^(1/2)+b^2*f^2+(-2*c*f-d^2)*g*b+c^2*g^2)*g^2))+_C1*(2*d*((2*g*x+f)*b+c*g)*(-b*g)^(1/2)+f*(4*g*x+f)*b^2+2*(-2*c*g*x+c*f-(1/2)*d^2)*g*b-3*c^2*g^2)*KummerU((1/16)*((b^2*f^2+(-2*c*f+d^2)*g*b+c^2*g^2)*(-b*g)^(1/2)+8*b^2*g^2)/(b^2*g^2), 3/2, -(1/4)*(d*(-b*g)^(1/2)-c*g+b*f)^2*(-b*g)^(1/2)*((2*g*x+f)*b+c*g)^2/(b^2*(2*d*(b*f-c*g)*(-b*g)^(1/2)+b^2*f^2+(-2*c*f-d^2)*g*b+c^2*g^2)*g^2))+(-8*b*g*(-b*g)^(1/2)+b^2*f^2+(-2*c*f+d^2)*g*b+c^2*g^2)*KummerM((1/16)*((b^2*f^2+(-2*c*f+d^2)*g*b+c^2*g^2)*(-b*g)^(1/2)+24*b^2*g^2)/(b^2*g^2), 3/2, -(1/4)*(d*(-b*g)^(1/2)-c*g+b*f)^2*(-b*g)^(1/2)*((2*g*x+f)*b+c*g)^2/(b^2*(2*d*(b*f-c*g)*(-b*g)^(1/2)+b^2*f^2+(-2*c*f-d^2)*g*b+c^2*g^2)*g^2)))*g^3)

 

[b = 0], "============================================"

 

[c = 0], "============================================"

 

"time expired"

 

[d = 0], "============================================"

 

[g = 0], "============================================"

 

[f = 0], "============================================"

 

[a = 0, b = 0], "============================================"

 

y(x) = (1/2)*(2*(g/c^(1/2))^(1/3)*c^(1/2)*(AiryAi(1, -(c*(g*x+f)-(1/4)*d^2)/((g/c^(1/2))^(2/3)*c))*_C1+AiryBi(1, -(c*(g*x+f)-(1/4)*d^2)/((g/c^(1/2))^(2/3)*c)))-d*(_C1*AiryAi(-(c*(g*x+f)-(1/4)*d^2)/((g/c^(1/2))^(2/3)*c))+AiryBi(-(c*(g*x+f)-(1/4)*d^2)/((g/c^(1/2))^(2/3)*c))))/(c*(_C1*AiryAi(-(c*(g*x+f)-(1/4)*d^2)/((g/c^(1/2))^(2/3)*c))+AiryBi(-(c*(g*x+f)-(1/4)*d^2)/((g/c^(1/2))^(2/3)*c))))

 

[a = 0, c = 0], "============================================"

 

y(x) = -g^2*(((-16*b*f^2-16*d^2*g)*(-b*g)^(3/2)-32*b^2*g*(2*g*x+f)*(d*g-(-b*g)^(1/2)*f))*KummerM((1/16)*((-b*g)^(1/2)*b*f^2+(-b*g)^(1/2)*d^2*g+8*b*g^2)/(b*g^2), 3/2, -(1/4)*(d*(-b*g)^(1/2)+b*f)^2*(2*g*x+f)^2*(-b*g)^(1/2)/(b*g^2*(2*(-b*g)^(1/2)*d*f+b*f^2-d^2*g)))-32*(((1/2)*b*f^2+(1/2)*d^2*g)*(-b*g)^(3/2)+b^2*g*(2*g*x+f)*(d*g-(-b*g)^(1/2)*f))*_C1*KummerU((1/16)*((-b*g)^(1/2)*b*f^2+(-b*g)^(1/2)*d^2*g+8*b*g^2)/(b*g^2), 3/2, -(1/4)*(d*(-b*g)^(1/2)+b*f)^2*(2*g*x+f)^2*(-b*g)^(1/2)/(b*g^2*(2*(-b*g)^(1/2)*d*f+b*f^2-d^2*g)))+_C1*(b*f^2+d^2*g)*(b^2*f^2+b*g*d^2+8*(-b*g)^(3/2))*KummerU((1/16)*((-b*g)^(1/2)*b*f^2+(-b*g)^(1/2)*d^2*g+24*b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1/16)*((-b*g)^(1/2)*b*f^2+(-b*g)^(1/2)*d^2*g+24*b*g^2)/(b*g^2), 3/2, -(1/4)*(d*(-b*g)^(1/2)+b*f)^2*(2*g*x+f)^2*(-b*g)^(1/2)/(b*g^2*(2*(-b*g)^(1/2)*d*f+b*f^2-d^2*g)))*b^2*g^3*(b*f^2+d^2*g-8*g*(-b*g)^(1/2)))

 

[a = 0, d = 0], "============================================"

 

y(x) = ((b*f-c*g)*((b*f-c*g)^2*(-b*g)^(1/2)+8*b^2*g^2)*_C1*KummerU(-(1/16)*(-24*b*g*(-b*g)^(1/2)+(b*f-c*g)^2)/((-b*g)^(1/2)*b*g), 3/2, -(1/4)*((2*g*x+f)*b+c*g)^2*(-b*g)^(1/2)/(b^2*g^2))-3*(-b*g)^(1/2)*(((4/3)*g*x+f)*b+(1/3)*c*g)*(b*f-c*g)*KummerM(-(1/16)*(-8*b*g*(-b*g)^(1/2)+(b*f-c*g)^2)/((-b*g)^(1/2)*b*g), 3/2, -(1/4)*((2*g*x+f)*b+c*g)^2*(-b*g)^(1/2)/(b^2*g^2))+((b*f-c*g)^2*(-b*g)^(1/2)+8*b^2*g^2)*KummerM(-(1/16)*(-24*b*g*(-b*g)^(1/2)+(b*f-c*g)^2)/((-b*g)^(1/2)*b*g), 3/2, -(1/4)*((2*g*x+f)*b+c*g)^2*(-b*g)^(1/2)/(b^2*g^2))-48*b^2*(((4/3)*g*x+f)*b+(1/3)*c*g)*g^2*_C1*KummerU(-(1/16)*(-8*b*g*(-b*g)^(1/2)+(b*f-c*g)^2)/((-b*g)^(1/2)*b*g), 3/2, -(1/4)*((2*g*x+f)*b+c*g)^2*(-b*g)^(1/2)/(b^2*g^2)))/(b*((b*f-c*g)*(-8*b*g*(-b*g)^(1/2)+(b*f-c*g)^2)*_C1*KummerU(-(1/16)*(-24*b*g*(-b*g)^(1/2)+(b*f-c*g)^2)/((-b*g)^(1/2)*b*g), 3/2, -(1/4)*((2*g*x+f)*b+c*g)^2*(-b*g)^(1/2)/(b^2*g^2))+((4*g*x+f)*b+3*c*g)*(b*f-c*g)*KummerM(-(1/16)*(-8*b*g*(-b*g)^(1/2)+(b*f-c*g)^2)/((-b*g)^(1/2)*b*g), 3/2, -(1/4)*((2*g*x+f)*b+c*g)^2*(-b*g)^(1/2)/(b^2*g^2))+(-8*b*g*(-b*g)^(1/2)+(b*f-c*g)^2)*KummerM(-(1/16)*(-24*b*g*(-b*g)^(1/2)+(b*f-c*g)^2)/((-b*g)^(1/2)*b*g), 3/2, -(1/4)*((2*g*x+f)*b+c*g)^2*(-b*g)^(1/2)/(b^2*g^2))-16*(-b*g)^(1/2)*b*((4*g*x+f)*b+3*c*g)*g*_C1*KummerU(-(1/16)*(-8*b*g*(-b*g)^(1/2)+(b*f-c*g)^2)/((-b*g)^(1/2)*b*g), 3/2, -(1/4)*((2*g*x+f)*b+c*g)^2*(-b*g)^(1/2)/(b^2*g^2))))

 

[a = 0, g = 0], "============================================"

 

y(x) = 2*f*(AiryAi(-((b*x+c)*f-(1/4)*d^2)/((-b/f^(1/2))^(2/3)*f))*_C1+AiryBi(-((b*x+c)*f-(1/4)*d^2)/((-b/f^(1/2))^(2/3)*f)))/(2*(-b/f^(1/2))^(1/3)*(AiryAi(1, -((b*x+c)*f-(1/4)*d^2)/((-b/f^(1/2))^(2/3)*f))*_C1+AiryBi(1, -((b*x+c)*f-(1/4)*d^2)/((-b/f^(1/2))^(2/3)*f)))*f^(1/2)-d*(AiryAi(-((b*x+c)*f-(1/4)*d^2)/((-b/f^(1/2))^(2/3)*f))*_C1+AiryBi(-((b*x+c)*f-(1/4)*d^2)/((-b/f^(1/2))^(2/3)*f))))

 

[a = 0, f = 0], "============================================"

 

y(x) = -64*b*g*((((1/4)*b*d^2+(1/4)*c^2*g)*(-b*g)^(3/2)+b*g^2*(d*b+c*(-b*g)^(1/2))*(b*x+(1/2)*c))*KummerM((1/16)*((-b*g)^(1/2)*b*d^2+(-b*g)^(1/2)*c^2*g+8*b^2*g)/(b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64*b^3*(-d*(b*x+(1/2)*c)*(-b*g)^(1/2)+c*(b*x+(3/4)*c)*g+(1/4)*b*d^2)*g^2*_C1*KummerU((1/16)*((-b*g)^(1/2)*b*d^2+(-b*g)^(1/2)*c^2*g+8*b^2*g)/(b^2*g), 3/2, (1/4)*(d*(-b*g)^(1/2)-c*g)^2*(2*b*x+c)^2*(-b*g)^(1/2)/(b^2*g*(2*(-b*g)^(1/2)*c*d+b*d^2-c^2*g)))-8*((-(1/8)*b*d^2-(1/8)*c^2*g)*(-b*g)^(3/2)+b^3*g^2)*(b*d^2+c^2*g)*_C1*KummerU((1/16)*((-b*g)^(1/2)*b*d^2+(-b*g)^(1/2)*c^2*g+24*b^2*g)/(b^2*g), 3/2, (1/4)*(d*(-b*g)^(1/2)-c*g)^2*(2*b*x+c)^2*(-b*g)^(1/2)/(b^2*g*(2*(-b*g)^(1/2)*c*d+b*d^2-c^2*g)))-16*KummerM((1/16)*((-b*g)^(1/2)*b*d^2+(-b*g)^(1/2)*c^2*g+24*b^2*g)/(b^2*g), 3/2, (1/4)*(d*(-b*g)^(1/2)-c*g)^2*(2*b*x+c)^2*(-b*g)^(1/2)/(b^2*g*(2*(-b*g)^(1/2)*c*d+b*d^2-c^2*g)))*b^3*g^2*(b*d^2+c^2*g-8*b*(-b*g)^(1/2)))

 

[b = 0, c = 0], "============================================"

 

[b = 0, d = 0], "============================================"

 

[b = 0, g = 0], "============================================"

 

x-Intat(1/(_a^3*a+_a^2*c+_a*d+f), _a = y(x))+_C1 = 0

 

[b = 0, f = 0], "============================================"

 

[c = 0, d = 0], "============================================"

 

"time expired"

 

[c = 0, g = 0], "============================================"

 

[c = 0, f = 0], "============================================"

 

Warning,  computation interrupted

 

Interrupting after two solvable cases here in order to post in Mapleprimes.

for val in one do print(val, "============================================"); traperror(timelimit(120, dsolve(subs(val, diff(y(x), x) = a*y(x)^3+(b*x+c)*y(x)^2+d*y(x)+g*x+f), useInt, implicit))) end do;

[a = 1], "============================================"

 

[b = 1], "============================================"

 

[c = 1], "============================================"

 

[d = 1], "============================================"

 

Warning,  computation interrupted

 

Interrupting in order to post in Mapleprimes.

``


Download TacklingAbelEquation.mw

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

 

Yes. Acer's answer is the simplest if you want symmetric with respect to permutation of all the indices.

Now if what you need is more control (e.g. symmetries and antisymmetries at the same time, regarding permutations of some, not all of the indices) there are two more standard ways of doing that.

First, if what you intend to do is tensor computations then the simplest approach I think is to use the Physics package, define C as a tensor with the symmetries you prefer (see the help page for Physics,Define) and that is all.

 Second, if all what you need is an indexable C[i, j, k, l] that doesn't change in value when you permute only i with j, create a procedure with the desired symmetry under permutation of i and j (note I name it `index/...`, that naming convention is mandatory), and use it as an indexing function, as follows

`index/C` := proc (idx) local i, j, k, l; i, j, k, l := op(idx); evaln(C[op(sort([i, j])), k, l]) end proc:

Now assign a table(C) to C itself

C := table(C)

table( [ ] )

(1)

That is all.

C[i, j, k, l]

C[i, j, k, l]

(2)

Swap the first two indices: they get reordered

C[j, i, k, l]

C[i, j, k, l]

(3)

It works regardless of the name of the indices

C[b, a, c, d]

C[a, b, c, d]

(4)

C[1, 2, 3, 4]-C[2, 1, 3, 4]

0

(5)

``

 

Download Cijkl_symmetric.mw

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


Hi guyp,

This is an unfortunate old issue: there is a premature evaluation of the summation dummy indices. There are a number of ways of tackling this issue, but I know only one solution that is general and covers all the situations at once: use the Physics:-Setup command, to redefine sum so that it keeps all of its computational power and at the same time becomes free of all these evaluation problems in one go.

Here is that at work with your example:

T := proc (x, m) options operator, arrow; sum((sum(binomial(m, k+p), k = 1 .. m-p))*x^p, p = 0 .. m-1) end proc;

proc (x, m) options operator, arrow; sum((sum(binomial(m, k+p), k = 1 .. m-p))*x^p, p = 0 .. m-1) end proc

(1)

This is the evaluation problem mentioned, leading to a wrong result

T(x, 3)

0

(2)

This is the redefinition mentioned

Physics:-Setup(redefinesum = true)

[redefinesum = true]

(3)

Now the result is correct

T(x, 3)

x^2+4*x+7

(4)

Regarding what is this redefinition of sum about, it only wraps around these different forms of premature evaluation problems. The actual summation is still performed by sum. For details on what problems I am referring to, please give a look at the help page updates,Maple18,Physics, the section on "New Enhanced Modes in Physics Setup", item 4.

As mentioned there, this redefinition also extends the ability of sum to perform multi-index summation, similar to the example you posted. For instance (note the summation indices satisfying a relationship)

(a+b+c)^n = sum(factorial(n)*a^p*b^q*c^r/(factorial(p)*factorial(q)*factorial(r)), p+q+r = n)

(a+b+c)^n = sum(factorial(n)*a^p*b^q*c^r/(factorial(p)*factorial(q)*factorial(r)), p+q+r = n)

(5)

eval((a+b+c)^n = sum(factorial(n)*a^p*b^q*c^r/(factorial(p)*factorial(q)*factorial(r)), p+q+r = n), n = 2)

(a+b+c)^2 = a^2+2*a*b+2*a*c+b^2+2*b*c+c^2

(6)

``


Download RedefineSum.mw

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


restart; with(Physics):
Setup(mathematicalnotation=true, noncommutativeprefix={M,H,S});

[mathematicalnotation = true, noncommutativeprefix = {H, M, S}]

(1)

GetAdvCommutator0:=proc(power::integer,order::integer,M)
option cache;
    if power <= 0 then
        M
    elif power = 1 then
        mtaylor(Commutator(M, add(lambda^l * S[l], l=1..order)), lambda, order+1)
    else
        mtaylor(Commutator(procname(power-1, order, M), add((lambda^l) * S[l], l=1..order)), lambda, order+1)
    fi:
end proc:

 

Your procedure without that eval enclosing the addition

HOffDiag := n ->
add(1/((2*j + 1)!)*GetAdvCommutator0(2*j + 1, n, H[0]), j=0..iquo(n-1, 2) + 1)
+ add(1/((2*j + 1)!)*GetAdvCommutator0(2*j + 1, n, lambda*H[1]), j=0..iquo(n-2, 2) + 1)
+ add(1/((2*j)!)*GetAdvCommutator0(2*j, n, lambda*H[2]), j=0..iquo(n-1,2) + 1):


Timings using the latest Physics update available for download at the Maplesoft R&D Physics webpage

time(HOffDiag(1))

0.33e-1

(2)

time(HOffDiag(2))

.216

(3)

time(HOffDiag(3))

.701

(4)

time(HOffDiag(4))

2.786

(5)

time(HOffDiag(5))

11.625

(6)

time(HOffDiag(6))

64.756

(7)

The amount of calls to Commutator gives an idea of why takes 1 minute to compute. Within Commutator, there is a an attempt to expand the commutator and in doing so a normalization of products is performed, and there is where most of the time is spent.

 

If all what you need is for this result to be computed, you can turn OFF that normalization of noncommutative products within the Physic package in the following way

kernelopts(opaquemodules = false); Physics:-iNormal := proc (f) options operator, arrow; f end proc


And then the time consumed is ~1/4 (here I am copying from another - fresh - session and pasting

time(HOffDiag(6))

15.043

(8)

NOTE however that after you turned OFF the internal normalizer of the package, various things that depend on this normalization of noncommutative products will not work properly, so I STRONGLY RECOMMEND TO RESTART AFTER YOU GOT THE RESULT YOU WANTED. Do nothing else.

 

IMPORTANT: You can always profile your computations using the various tools for that purpose. Here is the Profile home-made cocktail that I use, that also allows to indicate a timelimit for the computation as well (so that I don't wait forever, and still get partial profiling information if necessary). If you don't understand it please write here again and I will explain furthermore.

print(Profile)

proc (command, x, { sort::(identical(alpha, ralpha, time, rtime, words, rwords, calls, rcalls, load, rload)) := rtime }) kernelopts(profile = true); writeto('output'); if command::'posint' then try timelimit(command, x(args[3 .. -1])) catch "time expired":  end try else try command(args[2 .. -1]) catch:  end try end if; kernelopts(profile = false); writeto(terminal); readlib(exprofile); excallgraph('output', sort) end proc

(9)

Example of use in the case of '3' (note you can sort by different things, check the help page for excallgraph )

Profile(HOffDiag, 3, sort = rcalls)


In the case '6', the whole profiling activity gets out of the road in my machine after producing and output file bigger than 1/2 gigabyte, so I end up interrupting the computation, and analyzed the partial information, that already had the amount of times Commutator got called (7575, search for Commutator below) . After interrupting, the following lines in comments show you how to recover from such an interruption; they are followed by the partial profiling information for HOffDiag(6).

 

Profiling output

   


Download SumOfCommutators_(reviewed).mw

 

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

These are the components of the gamma_[a,b,c] tensor shown in Landau's 'The classical theory of fields', (98.9), page 314; they are now implemented, as well as their linear combinations lambda_[a,b,c] shown in Landau's book as (98.10), that simplify the computation of the gamma_[a,b,c].

A worksheet showing the novelty is included in the zip with the Physics update, available for download in the Maplesoft R&D Physics webpage as usual. This worksheet illustrates how to work with the new predefined tensors, as well as how to define everything from scratch using the ability within the Physics package to define tensors in terms of tensorial expressions (where each tensor is in turn defined in terms of other tensorial expressions, and so on, with no restrictions to the levels of nesting).

The computational power and flexible style of the Physics package are combining in very nice ways. Next step is the implementation of the NP Weyl scalars.

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

First 44 45 46 47 48 49 50 Last Page 46 of 60