ecterrab

14540 Reputation

24 Badges

20 years, 22 days

MaplePrimes Activity


These are answers submitted by ecterrab

  • When odeavisor returns a list of types (or classifications) of an ODE. This must mean the ODE can be of any one of these types?

Yes, when odeavisor "returns a list of types (or classifications) of an ODE" it means the ODE is of all of those types.

  • When Maple is given an ODE to solve, and it can be of number of types, how does it select which type to use to solve the ODE?

See the help page ?dsolve,setup. That page is old, by now incomplete, for instance it does not mention the method of integrating factors for ODEs of differential order > 1, a method as powerful as the Lie symmetry method. See also ?dsolve,education and ?dsolve,algorithms.

  • Is there any detailed document that explains more how odeadvisor determines the type of the ODE? This is a very powerful and a useful command but I can't find in help any hints on how it determines the type of ODE.

I wrote the odeavisor to be a sort of interactive e-book for ODEs: you pass an ODE and it not only determines the ODE types but also pops-up help pages explaining the solving methods available for those types. The point is that I wrote dsolve and the odeavisor at the same time, structuring the code so that the latter could take advantage of the subroutines of the former. The odeadvisor is thus a sort of "dsolve half of the way" plus the set of explanatory help pages on the corresponding solving methods for the ODE you passed, and its ability to pop-up these pages automatically. The implementation details are too many, and also this is not public software, even when at Maplesoft we are incredibly open regarding that - you can always read the code.

In general, about possibly more questions on the structure of Maple commands or the help pages mentioned above: I don't intend to make the help pages mentioned more complete/detailed. The competition copied some of our algorithms, for dsolve, pdsolve and also other stuff, e.g. the assuming and FunctionAdvisor commands, albeit they did a poor job at all that in my opinion. 

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

As pointed out by you, Oliveira, this was an issue visible only when the Physics setting assumingusesAssume was equal to true . The problem was actually within assuming, not  Physics:-Assume, and not noticed before because the old assume command redefines assumed variables, something that the more modern Physics:-Assume does not do. The issue is now fixed at its root and so assuming works as expected with the Physics setting assumingusesAssume. The adjustment is distributed for everybody within the Maplesoft Physics Updates v.416 or higher.

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

Hi

First of all: no, there is no leakage with regards to use and any other package  (Physics included). What this is: most packages have initialization files that set a few things here and there. That is not always documented properly. When you invoke use Package that initialization is executed, and whatever got set remains set after end use. That accounts for what Rouben Rostamian mentioned, about the use of the dot to display derivatives with respect to t . Historically, this was a Maple default, which however changed one or two releases ago, and I decided to keep that default in place when you load Physics, for natural reasons.

Second, there is a bug, not a leakage, with regards to the Physics's default setting 'assumingusesAssume'. When you load (or use) Physics, that setting is set to true, also for obvious reasons (Physics:-Assume does not redefine assumed variables, representing a significant advantage all around). This bug was mentioned as such yesterday, in this other Mapleprimes post by you, Oliveira. But this has nothing to do with leakages or use .

It is important to recall here that the implementation of both old and more modern ideas (e.g. assuming using either assume or the more modern Physics:-Assume), as every portion of code, is only as good as the amount of hours tested / debugged. Finding an issue in the interaction of assuming and Physics:-Assume is rare, I'm glad that the problem got uncovered. I noticed, however, that were not for Carl Love extra comments, you (Oliveira) were not going to mention the origin of your problem (that dsolve was returning only one branch instead of three, in connection with loading Physics and its automatic setting assumingusesAsume = true). Having good mathematical software is a collective endeavour. Reports of things not working as expected, with the necessary details for reproducing them, is perhaps the most important thing / contribution to the project. 

Note after post: That problem in assuming when using Physics with the setting assumingusesAssume is fixed and the adjustment distributed for everybody within the Maplesoft Physics Updates v.416 or higher.

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

Hi Rouben

Good catch, tricky problem, this issue is fixed and the fix available to everybody within the Maplesoft Physics Updates version 411 or higher. What follows is your worksheet, your text, with any added text in italic style. and the new result and its verification.

 

We solve Laplace's equation in the domain a < r and r < b, c < t and t < d
in polar coordinates subject to prescribed Dirichlet data.

Maple produces a solution in the form of an infinite sum,
but that solution fails to satisfy the boundary condition
on the domain's outer arc.  Is this a bug or am I missing
something?

The issue is resolved, the solution, shown below, is correct.

restart;

# kernelopts(version);

Physics:-Version()[2]

`2019, August 7, 17:56 hours, version in the MapleCloud: 411, version installed in this computer: 411.`

(1)

with(plots):

pde := diff(u(r,t),r,r) + diff(u(r,t),r)/r + diff(u(r,t),t,t)/r^2 = 0;

diff(diff(u(r, t), r), r)+(diff(u(r, t), r))/r+(diff(diff(u(r, t), t), t))/r^2 = 0

(2)

a, b, c, d := 1, 2, Pi/6, Pi/2;

1, 2, (1/6)*Pi, (1/2)*Pi

(3)

bc := u(r,c)=c, u(r,d)=0, u(a,t)=0, u(b,t)=t;

u(r, (1/6)*Pi) = (1/6)*Pi, u(r, (1/2)*Pi) = 0, u(1, t) = 0, u(2, t) = t

(4)

We plot the boundary data on the domain's outer arc:

p1 := plots:-spacecurve([b*cos(t), b*sin(t), t], t=c..d, color=red, thickness=5);

 

Solve the PDE:

pdsol := pdsolve({pde, bc});

u(r, t) = Sum((1/3)*sin((3/2)*n1*(-2*t+Pi))*8^n1*(-r^(3*n1)+r^(-3*n1))*(-3+(-1)^n1)/((64^n1-1)*n1), n1 = 1 .. infinity)+Sum(-(1/3)*((-1)^n-1)*sin(n*Pi*ln(r)/ln(2))*(exp((1/6)*Pi*n*(7*Pi-6*t)/ln(2))-exp((1/6)*Pi*n*(Pi+6*t)/ln(2)))/(n*(exp(n*Pi^2/ln(2))-exp((1/3)*n*Pi^2/ln(2)))), n = 1 .. infinity)

(5)

Try pdetest, and verify that what remains is actually 0 in the region of interests (see boundary conditions passed in (4))

remains := pdetest(pdsol, [pde, bc])

[0, Sum(-((1/6)*I)*((-1)^n-1)*(r^(-I*n*Pi/ln(2))-r^(I*Pi*n/ln(2)))/n, n = 1 .. infinity)-(1/6)*Pi, 0, 0, Sum(-(1/3)*sin((3/2)*n*(-2*t+Pi))*(-3+(-1)^n)/n, n = 1 .. infinity)-t]

(6)

zero__r := remains[2]

Sum(-((1/6)*I)*((-1)^n-1)*(r^(-I*n*Pi/ln(2))-r^(I*Pi*n/ln(2)))/n, n = 1 .. infinity)-(1/6)*Pi

(7)

Digits := 20

20

(8)

The following verifies OK, the plot is sufficiently close to 0 in the region of interest, r = a .. b

plot(eval(zero__r, [infinity = 100, Sum = add]), r = a .. b)

 

Next 'remains' to be verified

zero__t := remains[-1]

Sum(-(1/3)*sin((3/2)*n*(-2*t+Pi))*(-3+(-1)^n)/n, n = 1 .. infinity)-t

(9)

The following also verifies OK, the plot is again sufficiently close to 0 in the region of interest, t = c .. d

plot(eval(zero__t, [infinity = 100, Sum = add]), t = c .. d)

 

Try your verification approach just changing 'value' by eval at Sum = add  and using 100 terms instead of just 20; also change the orientation a bit to make the comparison more evident

Truncate the infinite sum at [20] 200 terms, and plot the result:

eval(rhs(pdsol), [infinity = 100, Sum = add])

p2 := plot3d([r*cos(t), r*sin(t), %], r=a..b, t=c..d, orientation=[32, 40, 20]);

 

Here is the combined plot of the solution and the boundary condition.
We see that the proposed solution [after installing the Maplesoft Physics Updates v.411 or higher] does satisfy the boundary condition.

plots:-display([p1, p2], orientation=[32, 40, 20]);

 

``


 

Download mw-6_(reviewed).mw

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

The solution returned by pdsolve is correct, the starting term with n = 0 should be computed taking limits (see vv's reply). On the other hand, I can also see the issue you are pointing at: it is standard to compute the sum by just evaluating the summation index, and if you do so you receive division by 0.

A change in the code that resolves that issue, presenting the special cases computed as branches in a piecewise, is distributed within the Maplesoft Physics updates v.410 and higher, so that after installing that Update you get

f := piecewise(0 <= x and x <= 1, (1/10)*x, 1 < x and x <= 3, 1/10)

pde := diff(u(x, t), t, t)+(4*Pi*(1/3))*(diff(u(x, t), t)) = 16*(diff(u(x, t), x, x))
ic := (D[2](u))(x, 0) = 0, u(x, 0) = f

bc := u(0, t) = 0, (D[1](u))(3, t) = 0

 

pdsolve([pde, ic, bc])

u(x, t) = Sum(piecewise(n = 0, (4/5)*sin((1/6)*Pi*x)*(Pi*t+3/2)*exp(-(2/3)*Pi*t)/Pi^2, (3/10)*sin((1/6)*(1+2*n)*Pi*x)*((2*n^(1/2)*(n+1)^(1/2)+I)*exp(((2/3)*I)*Pi*(-2*n^(1/2)*(n+1)^(1/2)+I)*t)-(-2*n^(1/2)*(n+1)^(1/2)+I)*exp(((2/3)*I)*Pi*(2*n^(1/2)*(n+1)^(1/2)+I)*t))*(3^(1/2)*sin((1/3)*Pi*n)+cos((1/3)*Pi*n))/(n^(1/2)*(n+1)^(1/2)*(1+2*n)^2*Pi^2)), n = 0 .. infinity)

(1)

Another example

f := 'f'

pde := diff(u(x, t), t, t)+2*(diff(u(x, t), t)) = diff(u(x, t), x, x)
ic := (D[2](u))(x, 0) = 0, u(0, t) = 0, u(x, 0) = f(x)

bc := u(0, t) = 0, u(Pi, t) = 0

sol := `assuming`([pdsolve([pde, ic, bc])], [t > 0])

u(x, t) = Sum(piecewise(n = 1, 2*(int(sin(x)*f(x), x = 0 .. Pi))*exp(-t)*(t+1)*sin(x)/Pi, (Int(sin(x*n)*f(x), x = 0 .. Pi))*((-1+(-n^2+1)^(1/2))*exp(-((-n^2+1)^(1/2)+1)*t)+exp((-1+(-n^2+1)^(1/2))*t)*((-n^2+1)^(1/2)+1))*sin(x*n)/((-n^2+1)^(1/2)*Pi)), n = 1 .. infinity)

(2)

``


 

Download piecewise_solution_with_special_cases.mw

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

Hi
I see no bug here. In
> ee := (((Q(a)^3)^(5/4))^(15/7))^(6/8);

you have a four times nested anything^rational type object. So, for the call on the left-hand side of what you posted, for any P, the call

> subsindets(ee, anything^rational, P)

will be applied, from the inside to the outside, 4 times, resulting in

    P(P(P(P(Q(a)^3)^(5/4))^(15/7))^(3/4))

But then on the right-hand side of what you posted, I see subsindets applied to objects of type specfunc(Q)^rational, that is a different thing, and within ee I see only one object of that type, so the call 

> subsindets(ee, specfunc(Q)^rational, P);

results, again as expected, in

    ((P(Q(a)^3)^(5/4))^(15/7))^(3/4)

Make now P be

> P := proc(x) if type(x, specfunc(Q)^rational) then 'Q(x)' else 'x' fi end

and you see the two results you got, all this is as expected.

Note as well that if you don't want subsindets to be applied recursively, you can use its option 'flat'. Also, to see subsindets at work (after you have assigned the procedure P) it suffices to trace P, entering trace(P); then call subsindets again

> subsindets(ee, anything^rational, P);
{--> enter P, args = Q(a)^3
<-- exit P (now at top level) = Q(Q(a)^3)}
{--> enter P, args = Q(Q(a)^3)^(5/4)
<-- exit P (now at top level) = Q(Q(Q(a)^3)^(5/4))}
{--> enter P, args = Q(Q(Q(a)^3)^(5/4))^(15/7)
<-- exit P (now at top level) = Q(Q(Q(Q(a)^3)^(5/4))^(15/7))}
{--> enter P, args = Q(Q(Q(Q(a)^3)^(5/4))^(15/7))^(3/4)
<-- exit P (now at top level) = Q(Q(Q(Q(Q(a)^3)^(5/4))^(15/7))^(3/4))}

while for the other type you used you have

> subsindets(ee, specfunc(Q)^rational, P);
{--> enter P, args = Q(a)^3
<-- exit P (now at top level) = Q(Q(a)^3)}

In summary that I see no bug here.

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

 

 

Have in mind that pFq, more than most functions actually, satisfy a myriad of identities (try FunctionAdvisor(identities, hypergeom([a, b], [c], z)), each of which has an apparently different integral representation. This is the same simplification problem mentioned in your previous post, two things that are the same but look different, making zero recognition difficult, not algorithmically possible in all cases.

Besides, the solution returned by dsolve uses Intat, not Int. There is no conversion to Intat, a more intelligent comand (think of it as an integral evaluated at a point - the equivalent to a derivative evaluated at a point represented in Maple by the D command).

As for your comment about odetest "does not give zero", its help page explains that a solution could be correct but, because of zero recognition, odetest will not find zero. I thought it was clear in the replies you received for the previous post you made today. I also showed, in one of those replies, what you could do in those cases: test the solution with a plot (equivalent to saying "numerically"). You could copy the input lines I posted in reply to your previous post and try to apply them for this your hand_solution.

 

 

Note the solution by dsolve is correct, and testable via odetest, even when it is an implicit solution (use the useInt option of dsolve)

PDEtools:-declare(y(x), prime = x)

` y`(x)*`will now be displayed as`*y

 

`derivatives with respect to`*x*`of functions of one variable will now be displayed with '`

(1)

ode := (diff(y(x), x))*(x^3+1)^(2/3)+(1+y(x)^3)^(2/3) = 0; sol := dsolve(ode, useInt)

(diff(y(x), x))*(x^3+1)^(2/3)+(1+y(x)^3)^(2/3) = 0

 

Int(1/(x^3+1)^(2/3), x)+Intat(1/(_a^3+1)^(2/3), _a = y(x))+_C1 = 0

(2)

odetest(sol, ode)

0

(3)

NOTE: odetest verifies implicit solutions. The main idea behind that is simple: isolate _C1, and differentiate with respect to x, then simplify, you must get 0.

So dsolve's solution is correct, testing is not a problem in this case, and the issue you are eperiencing is about testing the computation of an integral, as vv noted:

f := 1/(x^3+1)^(2/3)

(%int = int)(f, x)

%int(1/(x^3+1)^(2/3), x) = x*hypergeom([1/3, 2/3], [4/3], -x^3)

(4)

If the integral is correctly computed, here I expect 0 (excluding the origin and where f is singular):

zero := simplify(diff(rhs(%int(1/(x^3+1)^(2/3), x) = x*hypergeom([1/3, 2/3], [4/3], -x^3)), x)-f)

-(1/2)*(-(4/9)*Pi*3^(1/2)*LegendreP(-1/3, -1/3, (-x^3+1)/(x^3+1))*(x^3+1)^(1/3)+(-x^3)^(1/6)*GAMMA(2/3)*(hypergeom([4/3, 5/3], [7/3], -x^3)*(x^3+1)^(2/3)*x^3+2))/((x^3+1)^(2/3)*(-x^3)^(1/6)*GAMMA(2/3))

(5)

But then, as Carl Love pointed out, zero recognition is not possible in general, and this is not a Maple issue: try the same in Mathematica, simplify(diff(int(f, x), x)-f), and you also don't receive 0. For these reasons is that I coded the useInt and implicit options in dsolve - so that one can test a solution beyond these integration & solve & simplification problems.

 

For the situation where you want to test the solution after computing the integrals (and/or isolating the dependent variable in dsolve's solution), here is my preferred numerical choice: plot the expression in three dimensions, two boxes, for the real and imaginary parts of it, the number 5 requests 5 x the number of points, and scale the range from the unit square an amount that can give you some certainty, and you see the result is equal to zero up to Digits (you can increase Digits if you want to increase the certainty)

 

plots:-plotcompare(zero, expression_plot, 5, scale_range = 15)

NULL



dsolve_and_odetest_verify_OK.mw

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

The form f[a](b) is useful if you want to manipulate the index within the procedure assigned to f. For example:
> f := proc(x) [procname, [args]] end;

and now execute it you see that procname appears indexed. So for instance

> f := proc(x) if procname::indexed then idx := op(procname) else idx := NULL fi; "idx" = idx end;

upon execute will show you the value of idx, and of course, you can then do whatever you want with idx, within a procedure. In summary, t is a useful feature that allows you to work with indexed functions using the indexation as a variable.

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

Besides PDEtools:-difforder, typically, you find other tools in ?PDEtools,Library. In this particular case (degree) what you are looking for is in DifferentialAlgebra[Tools][LeadingDerivative]

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

Understanding that you do have a copy of Maple (otherwise, let me know), all you need to do is to input ?PDEtools to open the help page and, on that page, take a look under "Symmetry solution related". The infinitesimals you show are computed with the command PDEtools:-Infinitesimals. For the infinitesimal generators in operator form use InfinitesimalGenerator. The rest is pretty straightforward, I'd say more like an exercise to familiarize with the package, and can be performed with the commands listed and linked under "Symmetry solution related", plus possibly some of the ones in the PDEtools:-Library (see ?PDEtools:-Library).

If you find this suggestion too dense, I suggest you to try to put on a Maple worksheet your attempt to formulate and resolve the problem, and we take that as the departure point. Or let me know here in case you do not have a copy of Maple.

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

Write your equations on a Maple worksheet, then you can use PDEtools:-casesplit to uncouple the system.

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

Check the corresponding help page (?Physics:-Fundiff). That command computes functional derivatives of a given functional.

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

With small touches to your worksheet you see there is no formal_series solution for this problem:
 

restart

NULL

eq1 := diff(A(r), r, r)+(diff(A(r), r))/r+A(r)/r^2-a*r*A(r)+b*r^2*f*B(r)

diff(diff(A(r), r), r)+(diff(A(r), r))/r+A(r)/r^2-a*r*A(r)+b*r^2*f*B(r)

(1)

eq2 := diff(B(r), r, r)+(diff(B(r), r))/r+B(r)/r^2-c*r*A(r)+d*r^2*B(r)

diff(diff(B(r), r), r)+(diff(B(r), r))/r+B(r)/r^2-c*r*A(r)+d*r^2*B(r)

(2)

NULL

NULL

dsolve({eq1, eq2}, {A(r), B(r)})

{A(r) = DESol({-(-b*c*f*r^7+a*d*r^7-d*r^4+2*a*r^3-17)*_Y(r)/r^4-(-d*r^5-a*r^4-3*r)*(diff(_Y(r), r))/r^4-(-d*r^6+a*r^5-r^2)*(diff(diff(_Y(r), r), r))/r^4-2*(diff(diff(diff(_Y(r), r), r), r))/r+diff(diff(diff(diff(_Y(r), r), r), r), r)}, {_Y(r)}), B(r) = (a*r^3*A(r)-(diff(diff(A(r), r), r))*r^2-(diff(A(r), r))*r-A(r))/(b*f*r^4)}

(3)

Instead of tackling the whole system at once, decouple it first

{eq1, eq2}

{diff(diff(A(r), r), r)+(diff(A(r), r))/r+A(r)/r^2-a*r*A(r)+b*r^2*f*B(r), diff(diff(B(r), r), r)+(diff(B(r), r))/r+B(r)/r^2-c*r*A(r)+d*r^2*B(r)}

(4)

PDEtools:-casesplit({diff(diff(A(r), r), r)+(diff(A(r), r))/r+A(r)/r^2-a*r*A(r)+b*r^2*f*B(r), diff(diff(B(r), r), r)+(diff(B(r), r))/r+B(r)/r^2-c*r*A(r)+d*r^2*B(r)})

`casesplit/ans`([B(r) = (a*r^3*A(r)-(diff(diff(A(r), r), r))*r^2-(diff(A(r), r))*r-A(r))/(b*f*r^4), diff(diff(diff(diff(A(r), r), r), r), r) = (-c*A(r)*b*f*r^7+d*A(r)*a*r^7-d*(diff(diff(A(r), r), r))*r^6-d*(diff(A(r), r))*r^5+(diff(diff(A(r), r), r))*a*r^5-d*A(r)*r^4-(diff(A(r), r))*a*r^4+2*a*r^3*A(r)+2*(diff(diff(diff(A(r), r), r), r))*r^3-(diff(diff(A(r), r), r))*r^2-3*(diff(A(r), r))*r-17*A(r))/r^4], [])

(5)

You see: solve for A(r) a 4th order equation, then plug the solution in the 1st equation above to get B(r)

op([1, -1], `casesplit/ans`([B(r) = (a*r^3*A(r)-(diff(diff(A(r), r), r))*r^2-(diff(A(r), r))*r-A(r))/(b*f*r^4), diff(diff(diff(diff(A(r), r), r), r), r) = (-c*A(r)*b*f*r^7+d*A(r)*a*r^7-d*(diff(diff(A(r), r), r))*r^6-d*(diff(A(r), r))*r^5+(diff(diff(A(r), r), r))*a*r^5-d*A(r)*r^4-(diff(A(r), r))*a*r^4+2*a*r^3*A(r)+2*(diff(diff(diff(A(r), r), r), r))*r^3-(diff(diff(A(r), r), r))*r^2-3*(diff(A(r), r))*r-17*A(r))/r^4], []))

diff(diff(diff(diff(A(r), r), r), r), r) = (-c*A(r)*b*f*r^7+d*A(r)*a*r^7-d*(diff(diff(A(r), r), r))*r^6-d*(diff(A(r), r))*r^5+(diff(diff(A(r), r), r))*a*r^5-d*A(r)*r^4-(diff(A(r), r))*a*r^4+2*a*r^3*A(r)+2*(diff(diff(diff(A(r), r), r), r))*r^3-(diff(diff(A(r), r), r))*r^2-3*(diff(A(r), r))*r-17*A(r))/r^4

(6)

Now you see there is no formal_series solution with polynomial coeffs as you want

dsolve(diff(diff(diff(diff(A(r), r), r), r), r) = (-c*A(r)*b*f*r^7+d*A(r)*a*r^7-d*(diff(diff(A(r), r), r))*r^6-d*(diff(A(r), r))*r^5+(diff(diff(A(r), r), r))*a*r^5-d*A(r)*r^4-(diff(A(r), r))*a*r^4+2*a*r^3*A(r)+2*(diff(diff(diff(A(r), r), r), r))*r^3-(diff(diff(A(r), r), r))*r^2-3*(diff(A(r), r))*r-17*A(r))/r^4, A(r), 'formal_series', 'coeffs' = 'polynomial')


There is actually no formal series solution available even without restricting coeffs

NULL

NULL


 

Download dsolve_(reviewed).mw

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

Hi

I can't read well your expected output in LaTeX as you posted, but, in general, this type of computation is concretely simpler using the Physics package.

with(Physics)

 

Your line element (just type * instead of &t in what you posted)

ds2 := -(1-2*M*mu/r)^(1/mu)*dt^2+(1-2*M*mu/r)^(-1/mu)*dr^2+r^2*(1-2*M*mu/r)^(1-1/mu)*(dtheta^2+sin(theta)^2*dphi^2)

 

Set the coordinates, and the metric using your line element

Setup(metric = ds2, coordinates = {X = [t, r, theta, phi]}, quiet)

 

The Ricci trace is

Ricci[trace]

2*M^2*(mu^2-1)*(-(2*M*mu-r)/r)^(1/mu)/(r^2*(2*M*mu-r)^2)

(1)

 

The Kretchmann scalar is the full contraction of the Riemann tensor, so

Riemann[alpha, beta, mu, nu]^2

Physics:-Riemann[alpha, beta, mu, nu]*Physics:-Riemann[`~alpha`, `~beta`, `~mu`, `~nu`]

(2)

SumOverRepeatedIndices(Physics[Riemann][alpha, beta, mu, nu]*Physics[Riemann][`~alpha`, `~beta`, `~mu`, `~nu`], simplifier = simplify)

3*((M*mu-(1/2)*r)^2*((mu+1)^2*(mu^2+(2/3)*mu+1)*M^2-(8/3)*r*(mu+1)^2*M+(8/3)*r^2)*((-2*M*mu+r)/r)^((-2*mu+2)/mu)+(1/3)*r^2*((-2*M*mu+r)/r)^(2/mu)*((mu+1)*M-r)^2)*M^2/((M*mu-(1/2)*r)^4*r^6)

(3)

 

But all the symbols entering here are positive, so

`assuming`([simplify(3*((M*mu-(1/2)*r)^2*((mu+1)^2*(mu^2+(2/3)*mu+1)*M^2-(8/3)*r*(mu+1)^2*M+(8/3)*r^2)*((-2*M*mu+r)/r)^((-2*mu+2)/mu)+(1/3)*r^2*((-2*M*mu+r)/r)^(2/mu)*((mu+1)*M-r)^2)*M^2/((M*mu-(1/2)*r)^4*r^6))], [positive])

12*r^((-4*mu-2)/mu)*((mu+1)^2*(mu^2+(2/3)*mu+7/3)*M^2-(8/3)*r*(mu+2)*(mu+1)*M+4*r^2)*(-2*M*mu+r)^((-4*mu+2)/mu)*M^2

(4)

 

I leave below the input lines you presented using DifferentialGeometry, so that you can compare how much simpler are the Physics input lines above.

 

restart

M > 

# Obtaining Ricci and Kretchmann;
with(DifferentialGeometry):with(Tensor):

DGsetup([t, r, theta, phi], M);
g := evalDG(-(1-2*M*mu/r)^(1/mu)*dt &t dt+(1-2*M*mu/r)^(-1/mu)*`&t`(dr, dr)+r^2*(1-2*M*mu/r)^(1-1/mu)*(`&t`(dtheta, dtheta)+sin(theta)^2*`&t`(dphi, dphi)));
C := Christoffel(g):

`frame name: M`

 

_DG([["tensor", M, [["cov_bas", "cov_bas"], []]], [[[1, 1], -(-(2*M*mu-r)/r)^(1/mu)], [[2, 2], (-(2*M*mu-r)/r)^(-1/mu)], [[3, 3], r^2*(-(2*M*mu-r)/r)^((mu-1)/mu)], [[4, 4], r^2*(-(2*M*mu-r)/r)^((mu-1)/mu)*sin(theta)^2]]])

(5)

Rie := CurvatureTensor(C):
R := RicciScalar(g,Rie);
h := InverseMetric(g):
kretchmann := ContractIndices(RaiseLowerIndices(g, Rie, [1]), RaiseLowerIndices(h, Rie, [2, 3, 4]), [[1, 1], [2, 2], [3, 3], [4, 4]]);

2*(-(2*M*mu-r)/r)^(1/mu)*M^2*(mu^2-1)/(r^2*(2*M*mu-r)^2)

 

4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+2*M*mu+M-2*r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(2/mu)*M^2*(M*mu^2+M*mu-r)^2/((2*M*mu-r)^4*r^4)+20*(-(2*M*mu-r)/r)^(2/mu)*(M*mu+M-r)^2*M^2/((2*M*mu-r)^4*r^4)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+M*mu-r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu+M-r)^2/(r^6*(2*M*mu-r)^2)

(6)
M > 

# simplification

M > 

simplify(normal(R),symbolic)

2*(-1)^(1/mu)*(2*M*mu-r)^((1-2*mu)/mu)*r^((-1-2*mu)/mu)*M^2*(mu^2-1)

(7)
M > 

simplify(kretchmann,size,symbolic)

4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+2*M*mu+M-2*r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(2/mu)*M^2*(M*mu^2+M*mu-r)^2/((2*M*mu-r)^4*r^4)+20*(-(2*M*mu-r)/r)^(2/mu)*(M*mu+M-r)^2*M^2/((2*M*mu-r)^4*r^4)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+M*mu-r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu+M-r)^2/(r^6*(2*M*mu-r)^2)

(8)
M > 

 


 

Download RicciScalarKretchmann.mw

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

First 24 25 26 27 28 29 30 Last Page 26 of 59