Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi,

I would like to do some computations with Maple using elliptic functions. The implementation in Maple wants me to provide the g2 and g3 invariants. However, what I have is the half-periods. Does Maple have a function, that calculates the invariants from the half-periods? I know I can do that myself, but I'd like to write something concise and probably the output of a built-in function will be precisely, what the other functions are looking for.

Thanks in advance

For my differential equations class we have to input the following problem into Maple, I've never used maple before and I was wondering if someone who is experienced with maple could help me out with the code to put into Maple. Thanks I appreciate it!

 

Using the Maple program, Write the procedure RungeKutta(f, a, b, aplpha, n) which use the improved Euler's method to approximate the solution of the initial-value problem y'=f(t,y), a\leqt\leqb, y(a)= alpha at (n+1) equally spaced numbers in the interval [a,b]

The input parameters are as follow:

f is the name of the function f(t,y);

a and b are the end points of the interval of integration;

alpha is the initial condition.

The output: array w is the approximation of y at the (n+1) values of t.

1.

with(Groebner):
K := {r-x^4,u-(x^3)*y,v-x*y^3,w-y^4};
G := Basis(K, 'tord', degrevlex(r,u,v,w));
R1 := eliminate(G, {r,u,v,w}); # eliminate is the reverse of Basis
Ga := Basis({a*G[1],a*G[2],a*G[3],a*G[4],a*G[5],a*G[6],a*G[7],a*G[8],a*G[9],a*G[10],a*G[11],a*G[12],a*G[13],a*G[14], (1-a)*K[1], (1-a)*K[2], (1-a)*K[3], (1-a)*K[4]}, 'tord', deglex(a,r,u,v,w));
Ga := remove(has, Ga, [x,y,a]);
eliminate(Ga, [r,u,v,w]);

how to eliminate Ga to find back K ?

2.

A1A2 and A3A4 parallel
A(0,0), B(u1,0), D(u2,u3), C(x1,x2), E(x3,x4)
#BC = A1A2
xx1 := u1:
xx2 := x1:
yy1 := 0:
yy2 := x2:
#AD = A3A4
xx3 := 0:
xx4 := u2:
yy3 := 0:
yy4 := u3:
eq1 := (xx2 - xx1)*(yy4 - yy3) - (yy2 - yy1)*(xx4 - xx3);
(x1-u1)*u3-x2*u2;
#CD = A1A2
xx1 := x1:
xx2 := u2:
yy1 := x2:
yy2 := u3:
#AB = A3A4
xx3 := 0:
xx4 := u1:
yy3 := 0:
yy4 := 0:
eq2 := (xx2 - xx1)*(yy4 - yy3) - (yy2 - yy1)*(xx4 - xx3);
-(u3-x2)*u1;
with(LinearAlgebra):
#E is on the same line of AC
xx1 := x3:
yy1 := x4:
xx2 := 0:
yy2 := 0:
xx3 := x1:
yy3 := x2:
eq3 := Determinant(Matrix([[xx1,yy1,1],[xx2,yy2,1],[xx3,yy3,1]]));
-x3*x2+x1*x4;
#E is on the same line of BD
xx1 := x3:
yy1 := x4:
xx2 := u1:
yy2 := 0:
xx3 := u2:
yy3 := u3:
eq4 := Determinant(Matrix([[xx1,yy1,1],[xx2,yy2,1],[xx3,yy3,1]]));
-x3*u3+u1*u3-u1*x4+u2*x4;
 

sol := eliminate({eq1,eq2,eq3,eq4},[x1,x2,x3,x4]);

with(Groebner):
K := {(rhs(sol[1][1])-lhs(sol[1][1])),(rhs(sol[1][2])-lhs(sol[1][2])),(rhs(sol[1][3])-lhs(sol[1][3])),(rhs(sol[1][4])-lhs(sol[1][4]))};
G := Basis(K, 'tord', degrevlex(x1,x2,x3,x4));
R1 := eliminate(G, {x1,x2,x3,x4}); # eliminate is the reverse of Basis
Ga := Basis({a*G[1],a*G[2],a*G[3],a*G[4], (1-a)*K[1], (1-a)*K[2], (1-a)*K[3], (1-a)*K[4]}, 'tord', deglex(a,x1,x2,x3,x4));
Ga := remove(has, Ga, [u1,u2,u3,u4,a]);

From Question1, is it possible to find from sol to eq1, eq2, eq3 and eq4 ?

restart;
with(PDEtools);
assume(k::real, x::real, omega::real, t::real, theta::real, c::real);
u := phi(c*(t*upsilon+x))*exp(I*(k*x+omega*t+theta));
PDE := proc (u) options operator, arrow; I*(diff(u, t))+diff(u, x, x)-I*sigma*u*(conjugate(u)*(diff(u, x))-u*conjugate(diff(u, x))) end proc;
Eq1 := PDE(u)

I have resolved the roots of a series both numerically & analytically.  Let me qualify numerical  versus analytical.  Analytically I evaluate the series without substituting values for the various parameters of the series.  I then differentiate the series, then substitute in the appropriate parametric values, & then solve.  By this method I obtained 5 complex roots.

The numerical approach has values already assigned to the parameters of the series.  I then differentiate & solve.  I obtain only REAL roots in this instance.  I then restricted these results to obtain the solution I believe to be correct given by result (7).

I cannot seem to steer the solver in the analytic case to obtain the correct REAL result that I am expecting.  Can anyone help on this?

Before any website moderator thinks this is the same question as Error-in-Isinternal-Too-Many-Levels, it is not.  I have resolved that question.  This is a different question, but on the same problem!

reconcile_solns.mw

This guy thinks the Cayley-Dickson Construction cycles back at 1024D? I don't actually use Maple, is he just encountering a precision error?

https://www.mapleprimes.com/posts/124913-Visualization-Of-The-CayleyDickson

quote in question

"

I found no new mathematics after 1024 because higher hypercomplex numbers greater than 1024 are cyclic (they repeat all over again).  I do not offer dimensions higher than 256D to the publc Maple Application Center because the mathematics is very slow and time cosuming past 64D.  However, I did keep the code up to 256D in the public Maple Application Center.

"

I received a program for constructing Cayley-Dickson tables for my own use, but it's actually written in bc (arbitrary precision). I'm assuming Maple supports this to some extent but maybe he's encountering a precision error that looks like it's repeating? I can't verify yet because he's right about the one thing, even a 256 table took DAYS to compute. The snapshots are intriguing too but I'm assuming even a second-long video at low resolution would take forever as well.

But I still have the bc code and constructing Cayley-Dickson tables is only a few lines of codes/conditions, it's one of those 'easy for a computer, impossible for a human' kind of deals. I don't see enough complexity in the code where it would suddenly start cycling. It's kind of important to me because the implications of the Cayley-Dickson Construction going on forever are more exciting in my opinion.

By the way I'm actually personally using the bc generated tables for making music sequences/MIDI. It's not the usual multiplication and such though because that even when normalized would "stick" so to speak? It's a bit of a secret, sorry

I know how to use numapprox to fit polynomial and rational polynomial approximations to trig functions.  I would like to fit a rational expression using numerators and denominators like this:

a*x^(1/3) + b*x^(1/2) + c*x^(2/3) + d*x + e*x^(3/2) + f*x^(2) + g*x^(3)

 

 

Hi everyone.

I am trying to build a package in Maple out of a bunch of procedures that I have. To create the procedures, I write them on a Vim editor, than copy and paste into the Maple worksheet to test. In this way, it works (I end the procedure with ; and then I see all the text in blue and I afterwords test it).

I then gathered these procedures to a module, option package, and I do the same: edit on Vim, copy paste it to Maple worksheet and press enter to see a blue message "module() ... end module" in blue, and then I start playing.

However, I decided to add some more procedures to the module that was working. I have a new procedure that works (meaning when I copy to the worksheet it gives the blue text and I can call normally), but when I copy the contents of this new procedure inside the package, with all the others, and I copy everything to the worksheet, the package now fails to work. It gives a message "Error," in pink, no more text, and that is it. Does this sort of error sound familiar to anyone? Thanks in Advance,

Marcelo

i have two functions , first naive function has error after used.
 
if run FromMatlab, does it mean that do not need to copy the result and run again because it had already run?
as i do not understand the output code after translated.
 
there is syntax error when translate second function
 
with(Matlab):
FromMatlab("function X = sylv_naive(A,B,Q)
% X=SYLV_NAIVE(A,B,Q) solves the Sylvester equation AX + XB = Q
%    A, B, Q: matrix coefficients
%    X : solution of AX + XB = Q
[m,n] = size(Q);
H = kron(eye(n), A) + kron(B.', eye(m));
Qvec = reshape(Q,m*n,1);
Xvec = H\Qvec;
X = reshape(Xvec,m,n);
");
sylv_naive(Jesus7,Jesus7,Matrix([[0,0],[0,0]]));
sylv_naive(Jesus7,Jesus7,Matrix([[0],[0]]));
Error, (in ArrayTools:-Reshape) the desired output contains a different number of elements than the input
 
 
 
with(Matlab):
FromMatlab("function X = sylvester(A,B,Q)
% X=SYLVESTER(A,B,Q) solves the Sylvester equation AX + XB = Q
% by using the Bartels and Stewart algorithm based on the complex
% Schur decomposition
%    A, B, Q: matrix coefficients
%    X : solution of AX + XB = Q
[m,n] = size(Q);
[U,A1] = schur(A,'complex');
[V,B1] = schur(B.','complex');
Q1 = U'*Q*conj(V);
X = zeros(m,n);
X(:,n) = (A1 + B1(n,n)*eye(m))\Q1(:,n);
for i = n-1:-1:1
    v = Q1(:,i) - X(:,i+1:n)*B1(i,i+1:n).';
    X(:,i) = (A1 + B1(i,i)*eye(m))\v;
end
X = U*X*V.';");

Error, (in Matlab:-FromMatlab) on line 15, syntax error
    X(:,i) = (A1 + B1(i,i)*eye(m))
 
 

Good day. Please can someone kindly help to reduce the result of this code. Thank you and kind regards

restart:
s:=(sum(a[j]*x^j,j=0..3)+sum(a[j]*exp(-(j-3)*x),j=4..7)):
F:=diff(s,x):
p1:=simplify(eval(s,x=q))=y[n]:
p2:=simplify(eval(F,x=q))=f[n]:
p3:=simplify(eval(F,x=q+h/3))=f[n+1/3]:
p4:=simplify(eval(F,x=q+h))=f[n+1]:
p5:=simplify(eval(F,x=q+5*h/3))=f[n+5/3]:
p6:=simplify(eval(F,x=q+2*h))=f[n+2]:
p7:=simplify(eval(F,x=q+7*h/3))=f[n+7/3]:
p8:=simplify(eval(F,x=q+3*h))=f[n+3]:


vars:= seq(a[i],i=0..7):
Cc:=eval(<vars>, solve({p||(1..8)}, {vars})):
for i from 1 to 8 do
	a[i-1]:=Cc[i]:
end do:
Cf:=s:
L:=collect(simplify(simplify(expand(eval(Cf,x=q+3*h)),size)), [y[n],f[n],f[n+1/3],f[n+1],f[n+5/3],f[n+2],f[n+7/3],f[n+3]], factor):
length(L);
H := ee -> collect(numer(ee),[exp],h->simplify(simplify(h),size))/collect(denom(ee),[exp],h->simplify(simplify(h),size)):
M:=y[n+3]=(H@expand)(L);
length(M);

 

Error, (in is/internal) too many levels of recursion

I get the error above when attempting to solve for the roots of partial derivative.  My results are below:


 

S3 := -(1/2*I)*(-(2*I)*exp(I*Pi*k*tau/T)*Pi*k-exp(I*Pi*k*tau/T)*T+I*exp(I*Pi*k*tau/T)*Pi*k*tau+(4*I)*Pi*k-(2*I)*exp(-I*Pi*k*tau/T)*Pi*k+exp(-I*Pi*k*tau/T)*T+I*exp(-I*Pi*k*tau/T)*Pi*k*tau)*sin(2*Pi*k*x/T)/(Pi^2*k^2)

S3 = ((-I)*(1/2))*((I*Pi*k*tau-(2*I)*Pi*k)*(exp(I*Pi*k*tau/T)+exp(-I*Pi*k*tau/T))-T*(exp(I*Pi*k*tau/T)-exp(-I*Pi*k*tau/T))+(4*I)*Pi*k)*sin(2*Pi*k*x/T)/(Pi^2*k^2)
"(->)"true"(->)"true

Despite the the simplifications MAPLE generated above MAPLE does not recognize the expressions as being equivalent.  So set the following for the Fourier coeffs:NULL

Ck := (-I*((2*(I*Pi*k*tau-(2*I)*Pi*k))*cos(Pi*k*tau/T)-(2*I)*T*sin(Pi*k*tau/T)+(4*I)*Pi*k))*(1/(2*Pi^2*k^2))

-((1/2)*I)*(2*(I*Pi*k*tau-(2*I)*Pi*k)*cos(Pi*k*tau/T)-(2*I)*T*sin(Pi*k*tau/T)+(4*I)*Pi*k)/(Pi^2*k^2)

(1)

The Fourier series can now be expressed as a 1 sided series employing both the Sum vs sum vs add commands for comparison:``

T0 := kernelopts(cputime), time(), time[real]();

204175839, 9435456, 8.998352053

(2)

S7 := a[0]+Sum(Ck*sin(2*Pi*k*x/T), k = 1 .. m):

1600991, 0, 0.

(3)

solve([diff(S5, x) = 0, 0 < x, x < 10*T/(2*Pi*m)], x)

Error, (in is/internal) too many levels of recursion

 

solve([diff(S5, x) = 0, 0 < x, x < 1/8], x)

Error, (in is/internal) too many levels of recursion

 

``


 

Download 2_many_levels_of_recursion.mw

Hi, 

I'm currently studying the Rossler Attractor, which is the following system:

diff(x(t), t) = -y(t)-z(t)

 diff(y(t), t) = x(t)+a*y(t)

diff(z(t), t) = b+x(t)*z(t)-c*z(t).

I have found the points of equilibrium of the system.

But now I need to draw bifurcation diagrams: one for varying a, one for varying b, and one for varying c.

 

Can someone please help me with a procedure of how to do this?

Thanks in advance.

 

I have a relatively complicated ODE that i am plotting. One of the variables in particular (B[2211], purple line in the graph) should under go an exponential-like decay to zero, but instead flies off into negative territory  (see graph below) despite having a very simple equation:

problem variable rate of change= -problem variable*constant +linear combination of variables that  are always posotive.

 

My intuition is that this is because i have somehow used the odeplot tool wrong - possibly due to a problem with stepsizes.

Here is a MWE i've made:

aa_problem_MWE.mw

 

Maple 2018.

I am surprised Maple pdsolve can't solve this basic heat PDE. it is heat PDE on bar, with left end boundary condition being time dependent is only difference from basic heat PDE's on a bar.

May be a Maple expert can find a work around? I tried all the HINTS I know about.

restart;
#infolevel[pdsolve] := 3:
pde:=diff(u(x,t),t)=diff(u(x,t),x$2);
bc:=u(0,t)=t,u(Pi,t)=0:
ic:=u(x,0)=0:
sol:=pdsolve([pde,bc,ic],u(x,t)) assuming t>0 and x>0;

 

I also hope this question of mine do not get deleted as well, like the question I posted last night asking why pdsolve ignores assumptions that showed number of examples, was deleted few hrs after I posted it. 

If this question gets deleted, I will get the message that posts showing any problem in Maple software are not welcome here by Maplesoft and I will stop coming here.

 

First 103 104 105 106 107 108 109 Last Page 105 of 2097