Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I am encountering problems solving a system of differential equations.

In the attached file, on the first try the boundary conditions are defined in H: = He, resulting in "Error, (in DEtools / convertsys) unable to compute coeff". On the second try, the boundary conditions are defined in H: = He + 0.00000000000000001 and this works.

What is the possible cause of the problem?

Thank you

problem.mw

Hello,

I am attempting to check solutions to a system of ODEs using odetest. However, odetest only appears to partially substitute the provided solution. Furthermore, it appears to be related to the alphabetical order of the functions.

For instance, here I have two functions, phiL and phiM, that satisfy Laplace's equation and are coupled through the boundary conditions, BCs.

laplace := {-phiL(z) + diff(phiL(z),z$2)=0, -phiM(z) + diff(phiM(z),z$2)=0}:
BCs := {phiL(d1)=0,phiM(-d1)=0,phiL(0)=phiM(0), D(phiL)(0)-D(phiM)(0)=-n}:
sol := {
phiM(z) = n/2/coth(d1)*(cosh(z)+coth(d1)*sinh(z)),
phiL(z) = n/2/coth(d1)*(cosh(z)-coth(d1)*sinh(z))
}:

odetest(sol, laplace union BCs,{phiL(z),phiM(z)});

This returns

{0, 1/2*(2*phiL(0)*coth(d1)-n)/coth(d1), D(phiM)(0)-1/2*n}

Here, phiL(0) and phiM(0) are unevaluated even though the provided solutions are valid there.

Furthermore, while renaming phiL to an alphabetically earlier name (eg, phiJ) causes the corresponding change in the output. However, renaming it to something alphabetically after phiM (eg, phiN) causes the terms in the output to switch. That is, changing phiL to phiN in the above code results in

{0, 1/2*(2*phiM(0)*coth(d1)-n)/coth(d1), D(phiN)(0)+1/2*n}

Therefore, it seems to be related to the way Maple internally stores the list of variables.

Is this a bug? Or is there something I'm missing?

Thanks!

My code below works but I an looking to speed it up to apply to large arrays. I have large integers and I want to store the exponent and first and last few digits.

nelems := 10;  ~ takes about 50mins when n=100,000,000
n := 374894756873546859847556;
op(n);
A := Array(1 .. 4, 1 .. nelems);
length(n);
st := time();
for i to nelems do
    A[1, i] := i^10*n;
    A[2, i] := length(A[1, i]) - 1;
    b := convert(A[1, i], string);
    A[3, i] := parse(b[1 .. 3]);
    A[4, i] := parse(b[-3 .. -1]);
end do;
time() - st;
A;
A[1, -2];
A[2, -2];
A[3, -2];
A[4, -2];

 

Hello,
I am trying to implement a Squarefree Factorization Algo in Maple. 
For several algorithms (like the one in Victor Shoup- A computational Introduction to Number Theory and Algebra) one is in need of computing the pth root (F_q is the finite field with q=p^k) of a polynomial. I tried stuff like pol^(1/p), root[p](pol), proot(pol,p), but either I get NOROOT as output or just the polynomial with the exponent 1/p, like e.g.

(x^6+(2*tau+1)*x^3+2)^(1/3)

(tau my RootOf for the field extension, F_q with q=3^2)
But that doesnt help me, because I will need a polynomial without any exponent so that i can get the derivate pol'=dpol/dx, and that doenst work if there is any exponent...
cTest := `mod`(root[p](c), p);
cStrich := `mod`(diff(cTest, x), p);
          (x^6+(2*tau+1)*x^3+2)^(1/3)                    
          Error, the modular inverse does not exist

Does anybody know how I can calculate the pth root of a polynomial? (At the moment I am following the Algo that is mentioned on wiki for Squarefree Factorization...)

Or, does anybody know a better Algo for a squarefree Factorization? 

Thanks for any help and any answers!

In dark matter cosmology the following integral in x  does not yet have an analytical solution. I report the integral in

Maple 2018 notation

int(1/sqrt((1+x)^3*a+(1-a)*(1+x)^(3+3*b)), x)

If someone has some smart idea is welcome


 

with(Physics)

Setup(mathematicalnotation = true)

Setup(Coordinatesystem = (X = [x1, x2, x3, x4]), metric = -dx3^2*u22+2*dx3*dx4*u12-dx4^2*u11+dx1*dx3+dx2*dx4)

`* Partial match of  'Coordinatesystem' against keyword 'coordinatesystems'`

 

`Default differentiation variables for d_, D_ and dAlembertian are: `*{X = (x1, x2, x3, x4)}

 

`Systems of spacetime Coordinates are: `*{X = (x1, x2, x3, x4)}

 

[coordinatesystems = {X}, metric = {(1, 3) = 1/2, (2, 4) = 1/2, (3, 3) = -(diff(diff(u(X), x2), x2)), (3, 4) = Physics:-diff(diff(u(X), x1), x2), (4, 4) = -(diff(diff(u(X), x1), x1))}]

(1)

Setup(spacetimeindices = lowercaselatin)

u22 := diff(u(x1, x2, x3, x4), x2, x2)

Physics:-diff(Physics:-diff(u(X), x2), x2)

(2)

u12 := diff(u(x1, x2, x3, x4), x1, x2)

Physics:-diff(Physics:-diff(u(X), x1), x2)

(3)

u11 := diff(u(x1, x2, x3, x4), x1, x1)

Physics:-diff(Physics:-diff(u(X), x1), x1)

(4)

u24 := diff(u(x1, x2, x3, x4), x2, x4)

Physics:-diff(Physics:-diff(u(X), x2), x4)

(5)

u13 := diff(u(x1, x2, x3, x4), x1, x3)

Physics:-diff(Physics:-diff(u(X), x1), x3)

(6)

g_[]

Physics:-g_[a, b] = Matrix(%id = 18446745064427858870)

(7)

Define(W, quiet)

"W[~i,j,k,l]=1/(2)sqrt('g_[determinant]')g_[~i,~a]g_[~b,~c]LeviCivita[a,j,b,d]Weyl[~d,c,k,l]"

W[`~i`, j, k, l] = (1/2)*Physics:-g_[determinant]^(1/2)*Physics:-g_[`~a`, `~i`]*Physics:-g_[`~b`, `~c`]*Physics:-LeviCivita[a, b, d, j]*Physics:-Weyl[`~d`, c, k, l]

(8)

Define(W[`~i`, j, k, l] = (1/2)*Physics[g_][determinant]^(1/2)*Physics[g_][`~a`, `~i`]*Physics[g_][`~b`, `~c`]*Physics[LeviCivita][a, b, d, j]*Physics[Weyl][`~d`, c, k, l])

`Defined objects with tensor properties`

 

{Physics:-D_[a], Physics:-Dgamma[a], Physics:-Psigma[a], Physics:-Ricci[a, b], Physics:-Riemann[a, b, c, d], W[`~i`, j, k, l], Physics:-Weyl[a, b, c, d], Physics:-d_[a], Physics:-g_[a, b], Physics:-Christoffel[a, b, c], Physics:-Einstein[a, b], Physics:-KroneckerDelta[a, b], Physics:-LeviCivita[a, b, c, d], Physics:-SpaceTimeVector[a](X)}

(9)

W[definition]

W[`~e`, f, g, h] = (1/32)*16^(1/2)*Physics:-g_[`~a`, `~e`]*Physics:-g_[`~b`, `~c`]*Physics:-LeviCivita[a, b, d, f]*Physics:-Weyl[`~d`, c, g, h]

(10)

u11*u22-u12^2+u13+u24 = 0

diff(diff(u(X), x1), x3)+diff(diff(u(X), x2), x4)+(diff(diff(u(X), x2), x2))*(diff(diff(u(X), x1), x1))-(diff(diff(u(X), x1), x2))^2 = 0

(11)

u113 := diff(-u11*u22+u12^2-u24, x1)

-(diff(diff(diff(u(X), x1), x2), x4))-(diff(diff(u(X), x1), x1))*(diff(diff(diff(u(X), x1), x2), x2))-(diff(diff(u(X), x2), x2))*(diff(diff(diff(u(X), x1), x1), x1))+2*(diff(diff(u(X), x1), x2))*(diff(diff(diff(u(X), x1), x1), x2))

(12)

u123 := diff(-u11*u22+u12^2-u24, x2)

-(diff(diff(diff(u(X), x2), x2), x4))-(diff(diff(u(X), x1), x1))*(diff(diff(diff(u(X), x2), x2), x2))-(diff(diff(u(X), x2), x2))*(diff(diff(diff(u(X), x1), x1), x2))+2*(diff(diff(u(X), x1), x2))*(diff(diff(diff(u(X), x1), x2), x2))

(13)

u133 := diff(-u11*u22+u12^2-u24, x3)

-(diff(diff(diff(u(X), x2), x3), x4))-(diff(diff(diff(u(X), x2), x2), x3))*(diff(diff(u(X), x1), x1))-(diff(diff(u(X), x2), x2))*(diff(diff(diff(u(X), x1), x1), x3))+2*(diff(diff(u(X), x1), x2))*(diff(diff(diff(u(X), x1), x2), x3))

(14)

u134 := diff(-u11*u22+u12^2-u24, x4)

-(diff(diff(diff(u(X), x2), x4), x4))-(diff(diff(diff(u(X), x2), x2), x4))*(diff(diff(u(X), x1), x1))-(diff(diff(u(X), x2), x2))*(diff(diff(diff(u(X), x1), x1), x4))+2*(diff(diff(u(X), x1), x2))*(diff(diff(diff(u(X), x1), x2), x4))

(15)

u234 := diff(u(x1, x2, x3, x4), x2, x3, x4)

Physics:-diff(Physics:-diff(Physics:-diff(u(X), x2), x3), x4)

(16)

u223 := diff(u(x1, x2, x3, x4), x2, x2, x3)

Physics:-diff(Physics:-diff(Physics:-diff(u(X), x2), x2), x3)

(17)

u133 = -u11*u223-u113*u22+2*u12*u123-u234

-(diff(diff(diff(u(X), x2), x3), x4))-(diff(diff(diff(u(X), x2), x2), x3))*(diff(diff(u(X), x1), x1))-(diff(diff(u(X), x2), x2))*(diff(diff(diff(u(X), x1), x1), x3))+2*(diff(diff(u(X), x1), x2))*(diff(diff(diff(u(X), x1), x2), x3)) = -(diff(diff(diff(u(X), x2), x3), x4))-(-(diff(diff(diff(u(X), x1), x2), x4))-(diff(diff(u(X), x1), x1))*(diff(diff(diff(u(X), x1), x2), x2))-(diff(diff(u(X), x2), x2))*(diff(diff(diff(u(X), x1), x1), x1))+2*(diff(diff(u(X), x1), x2))*(diff(diff(diff(u(X), x1), x1), x2)))*(diff(diff(u(X), x2), x2))-(diff(diff(diff(u(X), x2), x2), x3))*(diff(diff(u(X), x1), x1))+2*(diff(diff(u(X), x1), x2))*(-(diff(diff(diff(u(X), x2), x2), x4))-(diff(diff(u(X), x1), x1))*(diff(diff(diff(u(X), x2), x2), x2))-(diff(diff(u(X), x2), x2))*(diff(diff(diff(u(X), x1), x1), x2))+2*(diff(diff(u(X), x1), x2))*(diff(diff(diff(u(X), x1), x2), x2)))

(18)

Weyl[`~i`, j, k, l, nonzero]+W[`~i`, j, k, l, nonzero]

Weyl[`~i`, j, k, l, nonzero]-W[`~i`, j, k, l, nonzero]

``

(19)

`in`(half*flat*metrics, 4*D)

``

NULL

NULL

 

I require one of these Weyl + W or Weyl - W (where W is Weyl tensor with hodge star operator, the equation may be found in my code) to be identically equal to zero. The computer will not recognise that it is identally equal unless i input the original p.d.e which I have, and I have also added some partial differentials up to the third order, maybe I need to include up to the fourth order? I am unsure what to add can someone please help me make this identically equal to zero! Thanks in advance for any help!

(I have put colon's after the equations Weyl+W and Weyl-W as the output was too long, but rest assured its not looking identically equal to zero!)
 

Download NEED_11.mw

restart;
ddesys := {diff(pred(t), t) = pred(t)*[prey(t)/(prey(t)+10)-2/3], diff(prey(t), t) = prey(t)*[2-(1/20)*prey(t-tau)]-prey(t)*[pred(t)/(prey(t)+10)]-10, pred(0) = 1, prey(0) = 1};
 

dsn := dsolve[eval(ddesys, tau = 0)];
plots[odeplot](dsn, [[t, prey(t), color = red], [t, pred(t), color = blue]], 0 .. 300, legend = [prey, pred], labels = [t, ""]);
Error, (in plots/odeplot) input is not a valid dsolve/numeric solution 

I do not understand what i mistake, please help me regarding this issue, thanks in advance

This is a question out of curiosity only ...

I can easily import a matrix from an Excel spreadsheet / source. Maple then displays matrix dimensions, data type, storage and order ... which is fine. Now - suppose I wished to import the standard matrix in question, with all entries displayed - can this be done?

 

I am working on a problem in geometry where I have ended up with a system of nonlinear ODEs in F and G where F and G are functions of a coordinate y, and A and B are both real constants.  I have included the worksheet where I am working on the equations.


Ric_Equations.mw
 

dsolve((2*d^2*F(Y)*F(y)*G(y)/dy^2-(d*F(y)/dy*(d*G(y)/dy))*F(y)+(n-3)*(d*F(y)/dy)^2*G(y))/(4*F(y)*G(y)^2) = A, -(3*(2*d^2*F(y)/dy^2-(d*F(y)/dy)^2*G(y)-(d*F(y)/dy*(d*G(y)/dy))*F(y)))/(F(y)^2*G(y)) = B)

Error, (in dsolve) expecting an ODE or a set or list of ODEs. Received (1/4)*(2*d^2*F(Y)*F(y)*G(y)/dy^2-d^2*F(y)^2*G(y)/dy^2+(n-3)*d^2*F(y)^2*G(y)/dy^2)/(F(y)*G(y)^2) = A

 

NULL

 

 I would like to solve these in as explicit a way as possible by obtaining expressions for F and G and was wondering how best to do this with Maple (it doesn't really matter if the explicit solutions are messy, as I just need to know that they exist and can be written down in some form).  I have tried using the dsolve command directly but I receive the error message which you can see above.

 

 

 

 

 

Sam := Sample(('Uniform')(10, 20), 30)

My question has two steps:

STEP 1:  The multiplication  of is defined as follows

 

if n<>l, then

.

if n=l and m<=s,

Question 1: I wrote a code for calculating the multiplication  of. Is it right?

The code for Step 1  

restart;

multiply:=proc(n,m,l,s) local g,a: 
a:=unapply(doublefactorial(2*j-1)/factorial(j),j):
g:=unapply((a(m-j)*a(j)*a(s-j)/a(m+s-j))*(2*m+2*s-4*j+1)/(2*m+2*s-2*j+1),j):

if n<>l then 0 else
sqrt((2*m+1)*(2*s+1))*2^(K/2-1).add((g(j)/sqrt(m+s-2*j+1/2))*phi[n, m+s-2*j],j=0..m) 
end if
end proc:
 
n:=2:
l:=2:
m:=1:
s:=1:
multiply(n,m,l,s);

when I compared the results which I got and the results which is given in the book as follows, I think it is right.

Step 2:

We know that the outer product matrix is calculated as follows 

  

We found the elements of the outer product matrix in Step 1. 

Question 2 : I want to write the elements which are derived in step 1 to the outer product matrix in step 2. In here, the outer product matrix is NxN matrix. N=(M+1).2^(K-1) where K, M are any integers.

Hello,

How I can take variation from left-hand side of  5, and reach to right-hand side of  5. After by using integral by part obtained  7?

Thank you

I use Maple 2015, is it possible to animate a standing wave as shown below?

 

 A working animation can be found on https://oceanservice.noaa.gov/facts/seiche.html

inequal({F__i*(1-e__0/k__b)/A__c+M__min__B/Z__t >= sigma__ti, .8*F__i*(1-e__0/k__t)/A__c-M__max__B/Z__b >= sigma__ts, .8*F__i*(1-e__0/k__b)/A__c+M__max__B/Z__t <= sigma__cs, F__i*(1-e__0/k__t)/A__c-M__min__B/Z__b <= sigma__ci, abs(e__0) <= `(e__0)__mp`}, 1/F__i = 0 .. 10, e__0 = -5 .. 5, color = "Niagara 2")
Error, (in plots:-inequal) invalid input: Plot:-Inequality expects its 2nd argument, r1, to be of type name = range(And(realcons, Not(infinity))), but received `1__`/F__i = 0 .. 10
 


 

restart

Loading Statistics

Sam := Sample(('Uniform')(10, 20), 10)

Sam := Vector[row](10, {(1) = 18.147236863931788, (2) = 19.057919370756192, (3) = 11.26986816293506, (4) = 19.133758561390195, (5) = 16.323592462254094, (6) = 10.975404049994095, (7) = 12.784982188670483, (8) = 15.468815192049838, (9) = 19.575068354342974, (10) = 19.648885351992767}, datatype = float[8])

(1)

``

a := min(Sam)

10.9754040499940952

(2)

b := max(Sam)

19.6488853519927673

(3)

M := int((Q-x)*f(x), x = 0 .. Q)

int((Q-x)*f(x), x = 0 .. Q)

(4)

N := int((x-Q)*f(x), x = Q .. b)

int((x-Q)*f(x), x = Q .. 19.6488853519927673)

(5)

Ecost := M*co+N*cs

(int((Q-x)*f(x), x = 0 .. Q))*co+(int((x-Q)*f(x), x = Q .. 19.6488853519927673))*cs

(6)

DCost := diff(Ecost, Q)

(int(f(x), x = 0 .. Q))*co+(int(-f(x), x = Q .. 19.6488853519927673))*cs

(7)

``

Df := max(Sam)-min(Sam)

8.67348130

(8)

NULL

Val := eval(DCost, [f(x) = 1/Df, co = 20, cs = 25])

5.188228168*Q-56.63494470

(9)

QStar := fsolve(Val, Q)

10.91604742

(10)

NULL

``

NULL

``


 

Download dummy_1.mw

First 577 578 579 580 581 582 583 Last Page 579 of 2097