MaplePrimes Questions

I have the following code. I want to do the modify it so that:

1. The outputs of each for loop are merged in such a way that the outputs from the first loop (Es) that are also outputs of the second loop (Fs) are removed from the outputs of (Es).

2. The resulting outputs G= .... are saved to a text file, one to each line.

3. In between each output, I want to add 5 lines of text and a blank line, say

text1 text2 text3

text2 text2 text3

text3 text3 text3

text4 text4 text4

text5 text5 text5

(blank line)

so that in the text file, the format is (e.g.)

G={{1,2}};

text1 text2 text3

text2 text2 text3

text3 text3 text3

text4 text4 text4

text5 text5 text5

(blank line)

G={{1,2},{1,3}};

text1 text2 text3

text2 text2 text3

text3 text3 text3

text4 text4 text4

text5 text5 text5

(blank line)

etc.

What is the easiest way to accomplish this?

restart;
 
with(GraphTheory):
 n:= 4:
  L:= NonIsomorphicGraphs
      ( n,
        output=iterator,
        outputform=graph):
  Es:= Array
       ( [ seq
           (  Edges( L() ),
              j=1..NonIsomorphicGraphs
                   ( n,
                     output=count
                   )
           )
         ]
       ):


  M:= NonIsomorphicGraphs
      ( n-1,
        output=iterator,
        outputform=graph):
  Fs:= Array
       ( [ seq
           (  Edges( M() ),
              j=1..NonIsomorphicGraphs
                   ( n-1,
                     output=count
                   )
           )
         ]
       ):
;

numelems(Es): 
for i from 1 to numelems(Es) do G:=Es[i]:  od;
                           
numelems(Fs):
for i to numelems(Fs) do G := Fs[i]; od;
                        

Hey everyone ! 

I want to get the analytical function from a piecewise differential equation defined on 6 intervals but Maple returns me a numerical result... I think it hides a Runge Kutta method.. However, it returned me an analytical function for a similar piecewise differential equation defined on 3 intervals.

Do you know how I could get the analytical function defined on the 6 intervals ?

Thank you very much for your time ! 

Alex

eq := diff(Uy(x), x, x)-piecewise(x < d1, 12*F*x/(E*b*h^3), d1 < x and x < d2, 12*((F+F1)*x-F1*d1)/(E*b*h^3), d2 < x and x < d3, 12*((F+F1+F2)*x-F1*d1-F2*d2)/(E*b*h^3), d3 < x and x < d4, 12*((F5+F4-F)*x+F*L-F5*d5-F4*d4)/(E*b*h^3), d4 < x and x < d5, 12*((F5-F)*x+F*L-F5*d5)/(E*b*h^3), 12*F*(L-x)/(E*b*h^3))

diff(diff(Uy(x), x), x)-piecewise(x < d1, 12*F*x/(E*b*h^3), d1 < x and x < d2, 12*((F+F1)*x-F1*d1)/(E*b*h^3), d2 < x and x < d3, 12*((F+F1+F2)*x-F1*d1-F2*d2)/(E*b*h^3), d3 < x and x < d4, 12*((F5+F4-F)*x+F*L-F5*d5-F4*d4)/(E*b*h^3), d4 < x and x < d5, 12*((F5-F)*x+F*L-F5*d5)/(E*b*h^3), 12*F*(L-x)/(E*b*h^3))

(1)

dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x))

assign(dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x)))

Uy_sol := unapply(Uy(x), x)

proc (x) options operator, arrow; Uy(x) end proc

(2)

E := 210*10^9; L := 4; d1 := (1/6)*L; d2 := 2*L*(1/6); d3 := 3*L*(1/6); d4 := 4*L*(1/6); d5 := 5*L*(1/6); b := 0.1e-1; h := 0.5e-2

210000000000

 

4

 

2/3

 

4/3

 

2

 

8/3

 

10/3

 

0.1e-1

 

0.5e-2

(3)

eq

diff(diff(Uy(x), x), x)-piecewise(x < 2/3, 0.4571428572e-1*F*x, 2/3 < x and x < 4/3, 0.4571428572e-1*(F+F1)*x-0.3047619048e-1*F1, 4/3 < x and x < 2, 0.4571428572e-1*(F+F1+F2)*x-0.3047619048e-1*F1-0.6095238096e-1*F2, 2 < x and x < 8/3, 0.4571428572e-1*(F5+F4-F)*x+.1828571429*F-.1523809524*F5-.1219047619*F4, 8/3 < x and x < 10/3, 0.4571428572e-1*(F5-F)*x+.1828571429*F-.1523809524*F5, 0.4571428572e-1*F*(4-x))

(4)

dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x))

Uy(x) = -(1/4)*(Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. 4))*x+Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. x)

(5)

Uy(x)[0]

Uy(x)[0]

(6)

assign(dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x)))

Uy(x)[0]

(-(1/4)*(Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. 4))*x+Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. x))[0]

(7)

Uy(x < d1)

Uy(x < 2/3)

(8)

Uy(x)[x < d1]

(-(1/4)*(Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. 4))*x+Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. x))[x < 2/3]

(9)

NULL

Download cas_5v_F_inconnues.mw

restart; N := 100; dx := evalf(2*Pi/N)

100

 

0.6283185308e-1

(1)

f1 := proc (x) options operator, arrow; sin(x) end proc;

proc (x) options operator, arrow; sin(x) end proc

(2)

DiscX := proc (N, dx) local i, xv; xv := Vector(N); for i to N do xv[i] := evalf((i-(1/2)*N-1)*dx) end do; return xv end proc:

Xfun := proc (f1) local i, xa1, xa2; xa1 := Vector(N); xa2 := Vector(N); for i to N do xa1[i] := evalf(subs(x = a[i], f1(x))) end do; return xa1 end proc:

IntNum := proc (N, a, c) local i, xv1; xv1 := Vector(N); for i from 2 to N-1 do xv1[i] := evalf((1/2)*(a[i]-a[i+1])*(c[i]+c[i+1])) end do; return xv1 end proc:

a := DiscX(N, dx); a[1]; a[100]

a := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

-3.141592654

 

3.078760801

(3)

c := Xfun(f1); c[1]

c := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

0.4102067615e-9

(4)

k := IntNum(N, a, c)

k := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(5)

plot([seq([a[i], k[i]], i = 2 .. N)], style = line, title = typeset("Integ_of_sin(x)"), titlefont = [times, bold, 30]);

 

``

Download test.mw

Hey everyone!

I would like to plot the integral of a discrete function. For simplicity, I choose the function sin(x) between –Pi and Pi, which has as an integral -cos(x). I tried to implement that in Maple using the Trapezoidal rule, but the result is simply wrong. Any help would be much appreciated!

I have the following Maplesoft code:

with(ImageTools);

with(IterativeMaps):
Crystal, xrange, yrange := Attractor([x, y], [[1/2 - y/2, x/2], [y/2 + 1/2, 1/2 - x/2], [x/2 + 1/4, y/2 + 1/2]], height = 400, width = 400, xmin = -1, xmax = 2, ymin = -1, ymax = 1, fixview = true, [0, 0], [0.33, 0.33, 0.33], greenexpression = 1 - 1/(1/(1 - G) + 1), iterations = 2500000);
xrange, yrange;
                        -1 .. 2, -1 .. 1

ColouringProcedures:-HueToRGB(Crystal);
                               0.

Embed(Crystal);

which yields the following image:


However, I should be seeing the following image:

Any help would be appreciated. Thanks!

Justify that 2 vectors (1,1) and (1,2) are an R² base; How to write calculations correctly ?
<x, y> = lambda*<1, 1> + mu*<1, 2>:
 solve({lambda+mu=x,lambda+2*mu=y},{lambda,mu}):
 <x, y> := (2*x - y)*<1, 1> + (-x + y)*<1, 2>:
Thank you.

I get this error when I try to use the ODE numeric solver, can anybody help me figure out what Im doing wrong? 

hi guys,

I have a question about computing reimann tensor in general relativity.

suppose we have schwarzschidl metric: ds^2=-(1-2*m*(r^-1))*dt^2+(1-2*m*(r^-1))^(-1)*dr^2+r^2*dtheta^2+r^2*sin^2(theta)*dphi^2.

I want to caclulate R[alpha,beta,mu,nu]*R[~alpha,~beta,~mu,~nu] where R[alpha,beta,mu,nu] is covariant form of Reimann tensor and also R[~alpha,~beta,~mu,~nu] is the contravariant form of Riemann tensor. I also want to calculate same thing for weyl tensor. please guide me.

with best regards.

How to reconstruct commutators like for example in Drinfeld associators (see (4.5) in https://arxiv.org/pdf/1310.3259.pdf)?

We have as computed in Drinfieldstuff_display.mw (note to run this it requires loading HyperInt package https://arxiv.org/pdf/1403.3385.pdf):

H[2] := a^2*(e[0]*e[1] - e[1]*e[0])*zeta[2]

H[3] := zeta[3]*a^3*(((e[0]*e[1]^2 + e[0]^2*e[1] - (2*e[1])*e[0]*e[1]) + e[1]^2*e[0]) - (2*e[0])*e[1]*e[0] + e[1]*e[0]^2)

H[4] := zeta[2]^2*a^4*((((((4*e[0])*e[1]^3 + (12*e[0])*e[1]*e[0]^2 - (5*e[1])*e[0]^2*e[1] - (4*e[1])*e[0]^3) - (4*e[1]^3)*e[0]) + (7*e[1])*e[0]*e[1]*e[0] + (12*e[1]^2)*e[0]*e[1] + (3*e[0])*e[1]*e[0]*e[1] - (12*e[0]^2)*e[1]*e[0] - (5*e[0])*e[1]^2*e[0] + e[0]^2*e[1]^2 - (12*e[1])*e[0]*e[1]^2) - e[1]^2*e[0]^2) + (4*e[0]^3)*e[1])/10

And we want maple rebuild them as  commutators as below ([x,y]=xy-yx). Correspondingly:

H[2] :=zeta[2] [e[0] , e[1] ]

H[3] :=zeta[ 3] ( [e[0] , [e[0], e[1] ]] − [e[1] , [e[0] , e[1] ]] )

H[4] :=zeta[4] [e[0] , [e[0], [e[0] , e[1]]]] −1/4* [e[0] , [e[1] , [e[0] ,e[1] ]]] + [e[1] , [e[1] , [e[0] , e[1] ]]] + 5/4*[e[0], e[1]] ^2

Does anyone know how to do it?

Hi

I got the error like this unable to convert to an explicit first-order system

please anyone can help me to solve this

I am attaching the worksheet

with(plots); restart

eq1 := (2*eta*gamma+1)*(diff(f(eta), `$`(eta, 3)))+2*gamma*(diff(f(eta), `$`(eta, 2)))+f(eta)*(diff(f(eta), `$`(eta, 2)))-(diff(f(eta), eta))^2-(Q+S)*(diff(f(eta), eta))+beta*(diff(F(eta), eta)-(diff(f(eta), eta))) = 0;

(2*eta*gamma+1)*(diff(diff(diff(f(eta), eta), eta), eta))+2*gamma*(diff(diff(f(eta), eta), eta))+f(eta)*(diff(diff(f(eta), eta), eta))-(diff(f(eta), eta))^2-(Q+S)*(diff(f(eta), eta))+beta*(diff(F(eta), eta)-(diff(f(eta), eta))) = 0

(1)

eq2 := (diff(F(eta), `$`(eta, 2)))*F(eta)-(diff(F(eta), eta))^2+beta*(diff(f(eta), eta)-(diff(F(eta), eta))) = 0;

(diff(diff(F(eta), eta), eta))*F(eta)-(diff(F(eta), eta))^2+beta*(diff(f(eta), eta)-(diff(F(eta), eta))) = 0

(2)

eq3 := (2*eta*gamma+1)*(1+Rd)*(diff(theta(eta), `$`(eta, 2)))+Pr*((diff(theta(eta), eta))*f(eta)-2*(diff(f(eta), eta))*theta(eta))+gamma*(diff(theta(eta), eta))+N*Pr*betat*((theta[p](eta), eta)-theta(eta))+N*Pr*Ec*betat*(diff(F(eta), eta)-(diff(f(eta), eta)))+Pr*delta*theta(eta) = 0;

(2*eta*gamma+1)*(1+Rd)*(diff(diff(theta(eta), eta), eta))+Pr*((diff(theta(eta), eta))*f(eta)-2*(diff(f(eta), eta))*theta(eta))+gamma*(diff(theta(eta), eta))+N*Pr*betat*((theta[p](eta), eta)-theta(eta))+N*Pr*Ec*betat*(diff(F(eta), eta)-(diff(f(eta), eta)))+Pr*delta*theta(eta) = 0

(3)

eq4 := 2*(diff(theta[p](eta), eta))*f(eta)-F(eta)*theta[p](eta)+betat*delta*(theta[p](eta)-theta(eta)) = 0;

2*(diff(theta[p](eta), eta))*f(eta)-F(eta)*theta[p](eta)+betat*delta*(theta[p](eta)-theta(eta)) = 0

(4)

bcs := f(0) = 0, (D(f))(0) = 1, (D(f))(5) = 0, (D(F))(5) = 0, F(5) = f(5), theta(0) = 1, theta(5) = 0, theta[p](5) = 0;

f(0) = 0, (D(f))(0) = 1, (D(f))(5) = 0, (D(F))(5) = 0, F(5) = f(5), theta(0) = 1, theta(5) = 0, theta[p](5) = 0

(5)

params := [Rd = .1, beta = .5, Q = .5, S = .5, gamma = .1, Pr = 6.2, N = .5, betat = .5, Ec = .1];

[Rd = .1, beta = .5, Q = .5, S = .5, gamma = .1, Pr = 6.2, N = .5, betat = .5, Ec = .1]

(6)

sol := dsolve(eval([eq1, eq2, eq3, eq4, bcs], params), numeric, output = array([0]), maxmesh = 5000, initmesh = 1000)

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system

 

``

Download MapleOde.mw

Hi,

I try to display a different steps of an mathematical developpement with ShowSteps command, but But the command gives nothing in the new version Maple 2021?

Thanks for your Help

QShowSteps.mw

I do not know why int() on this integrand fails always first time, and works second time it is called. seems like something is not loaded correctly first time?

integrand:=(((-3*x^2-18*x-27)*exp(2)^2+(30*x^3+330*x^2+1170*x+1350)*exp(2)-75*x^4-1200*x^3-7050*x^2-18000*x-16875)*ln(x)+(12*x^2+54*x+81)*exp(2)^2+(-120*x^3-1106*x^2-3510*x-4050)*exp(2)+225*x^4+3560*x^3+20990*x^2+54000*x+50625)/((3*x^4+18*x^3+27*x^2)*exp(2)^2+(-30*x^5-330*x^4-1170*x^3-1350*x^2)*exp(2)+75*x^6+1200*x^5+7050*x^4+18000*x^3+16875*x^2):

print("First time");
int(integrand,x);

print("second time");
int(integrand,x);

Worksheet attached.

Update

Here is a movie. it is few minutes long. This happens by random and not each time. This movie shows the command starting from "restart" are repated 4 times. First two times, no error. Then the error shows up.  So it is random. Maybe it depends if Maple is busy with other things or not. I have each worksheet set to use its own server though. So I have no idea why this happens sometimes and not other times.

 

 

 

issue_int_nov_11_2021.mw

I think there is a problem here

restart;
the_integrand:=(((-2*x^2+2)*exp(exp(exp(3)))^2+(4*x^3-4*x)*exp(exp(exp(3)))-2*x^4-6*x^2+8)*exp(ln(x)-x^2)*ln(exp(exp(exp(3)))^2-2*x*exp(exp(exp(3)))+x^2+4)+((2*x^2-2)*exp(2)*exp(exp(exp(3)))^2+((-4*x^3+4*x)*exp(2)-2*x)*exp(exp(exp(3)))+(2*x^4+6*x^2-8)*exp(2)+2*x^2)*exp(ln(x)-x^2))/(exp(exp(exp(3)))^2-2*x*exp(exp(exp(3)))+x^2+4);

int(the_integrand,x,method=_RETURNVERBOSE)

#try MeijerG
int(the_integrand,x,method=MeijerG);

gives

I do not know if this known or not.

Maple 2021.1 on windows

This is Maple 2021.1 on windows.

===================
restart;
expr:=x^(6+1/3);
res:=series(expr,x=0,6);
==============

gives
        O(x^(19/3))

But type of the above is not series:

===========
type(res,'series');
        false
===========

Yet convert(res,polynom) works

================
convert(res,polynom)
          0
================

Which is correct conversion. But help says that

"convert/polynom
convert a series to polynomial form"

Notice, it says "series" there.

So the input must be type series. But Maple says
O(x^(19/3)) is not type series. I think this is wrong. The
type returned should be series. Now the type returned is 'function'
from the series command.

What Am I overlooking here?

First 367 368 369 370 371 372 373 Last Page 369 of 2428