MaplePrimes Questions

Hi, given the function f(t)=t^2. Determine the Fourier coefficients a_0, a_1 and b_1 for f(t). Plot the graphs for f(t) and also plot the graphs for the Fourier sum F(t) with N=1 in the same coordinate system. Let the t-axis go from 0 to 2*Pi.

Can someone help with this?


I have a system of linear equations with a fixed number of equations, but the stracture of the system varies in T. I have solved the system for a fixed T and have to run for each value of T, which is quite boaring. I want to solve the system by a single run for multiple T values using a for loop. When I tried with the code, I got the following error.

Error, (in LinearAlgebra:-GenerateMatrix) invalid subscript selector

s := sum(1/L[i], i=1..nops(L));

Error, (in limit/mrv/limsimpl) too many levels of recursion

So, this error cannot be caught by try

try    # bug
  s := sum(1/L[i], i=1..nops(L));
  catch:  s:=infinity
end try;

Error, (in limit/mrv/limsimpl) too many levels of recursion

Strangely, for L:=[1, 2, 0.0, 4]  it's OK.

Everything works with add instead of sum, but this is another thing.


  I want list all  diameter-2  Nonisomorphismgraphs  of order n . I use the following code, but its running speed  is slow with  order of graph gradually increasing . (for example,n=10)
 Are there other ways to Improve it? 
Graphs_data:=[NonIsomorphicGraphs(4,restrictto =[connected], output = graphs, outputform =graph)]:

  By the way,  Why doesn't size=[50,50] work ?



How can find the range of  the parameter k, such that f(x)=b ( for a given b in the set of real number R) we have a unique solution of the equation f(x)=b 


Many thanks for your help


I'm trying to solve a system of ODE in a model of infectious disease. But, unfortunately, when I try to plot the curves, I get the following error message: Error, (in fproc) unable to store '-1.*HFloat(0.0)[1]' when datatype=float[8]. The code is here

Q := 1000; a := .9; b := 0.8e-3; mu := 0.247e-2; k := .2; y := 0.2e-1; e := .5; g := .5; T := 8; n := 100;
sigma[1] := 0.5e-1; sigma[2] := 0.9e-1; alpha[1] := 0.52e-2; alpha[2] := 0.52e-2; delta[1] := .8; delta[2] := .904; delta[3] := .8; c[1] := 50; c[2] := 250; c[3] := 50; w[1] := 140; w[2] := 130; w[3] := 150; w[4] := 160;
u[1] := min(max(0, z), 1); z := (a*i[p](t)*(i[p](t)+i[pm](t))*(lambda[4](t)-lambda[3](t))+a*s(t)*(i[p](t)+i[pm](t))*(lambda[1](t)-lambda[2](t)))/(n.w[1]); u[2] := min(max(0, c), 1); c := (b*(i[m](t)+i[pm](t))*s(t)*(lambda[3](t)-lambda[1](t))+b*(i[m](t)+i[pm](t))*i[p](t)*(lambda[4](t)-lambda[2](t)))/(n.w[2]); u[3] := min(max(0, j), 1); j := (i[p](t)*lambda[2](t)+i[pm](t)*(lambda[4](t)-lambda[7](t))-(i[p](t)+i[pm](t))*lambda[5](t))/w[3]; u[4] := min(max(0, o), 1); o := (i[m](t)*lambda[3](t)-i[pm](t)*(lambda[4](t)-lambda[7](t))-(i[m](t)+i[pm](t))*lambda[6](t))/w[4]; u[2] := 0; u[3] := 0;
sys := diff(s(t), t) = Q+delta[1]*r[p](t)+delta[2]*r[m](t)+delta[3]*r[pm](t)-(a*(1-u[1])*(i[p](t)+i[pm](t))/n+b*(1-u[2])*(i[m](t)+i[pm](t))/n+mu)*s(t), diff(i[p](t), t) = (1-u[1])*a*(i[p](t)+i[pm](t))*s(t)/n-(1-u[2])*b*(i[m](t)+i[pm](t))*i[p](t)/n-(sigma[1]+u[3])*i[p](t)-(alpha[1]+mu)*i[p](t), diff(i[m](t), t) = (1-u[2])*b*(i[m](t)+i[pm](t))*s(t)/n-(1-u[1])*a*(i[p](t)+i[pm](t))*i[m](t)/n-(sigma[2]+u[4])*i[m](t)-(alpha[2]+mu)*i[m](t), diff(i[pm](t), t) = (1-u[2])*b*(i[m](t)+i[pm](t))*i[p](t)/n+(1-u[1])*a*(i[p](t)+i[pm](t))*i[m](t)/n-(y+u[3]+u[4])*i[pm](t)-(alpha[1]+alpha[2]+mu)*i[pm](t), diff(r[p](t), t) = (sigma[1]+u[3])*i[p](t)+(e*y+u[3])*i[pm](t)-(delta[1]+mu)*r[p](t), diff(r[m](t), t) = (sigma[2]+u[4])*i[m](t)+(y*g*(1-e)+u[4])*i[pm](t)-(delta[2]+mu)*r[m](t), diff(r[pm](t), t) = (y*(1-g)*(1-e)+u[3]+u[4])*i[pm](t)-(delta[3]+mu)*r[pm](t), diff(lambda[1](t), t) = lambda[1](t)*(a*(1-u[1])*(i[p](t)+i[pm](t))/n+b*(1-u[2])*(i[m](t)+i[pm](t))/n+mu)-lambda[2](t)*(1-u[1])*a*(i[p](t)+i[pm](t))/n-lambda[3](t)*(1-u[2])*b*(i[m](t)+i[pm](t))/n, diff(lambda[2](t), t) = -c[1]+lambda[1](t)*(1-u[1])*a*s(t)/n-lambda[2](t)*((1-u[1])*a*s(t)/n+b*(1-u[2])*(i[m](t)+i[pm](t))/n+sigma[1]+u[3]+alpha[1]+mu)-lambda[4](t)*(b*(1-u[2])*(i[m](t)+i[pm](t))/n+(1-u[1])*a*i[m](t)/n)-lambda[5](t)*(sigma[1]+u[3]), diff(lambda[3](t), t) = -c[2]+lambda[1](t)*(1-u[2])*b*s(t)/n+lambda[2](t)*(1-u[2])*b*i[p](t)/n-lambda[3](t)*(u[4]+alpha[2]+sigma[2]+a*(1-u[1])*(i[p](t)+i[pm](t))/n-(1-u[2])*b*s(t)/n)-lambda[4](t)*((1-u[2])*b*i[p](t)/n+a*(1-u[1])*(i[p](t)+i[pm](t))/n)-lambda[6](t)*(sigma[2]+u[4]), diff(lambda[4](t), t) = -c[3]+lambda[1](t)*((1-u[1])*a*s(t)/n+(1-u[2])*b*s(t)/n)-lambda[2](t)*((1-u[2])*b*i[p](t)/n+(1-u[1])*a*s(t)/n)-lambda[2](t)*((1-u[2])*a*i[m](t)/n+b*(1-u[1])*s(t)/n)-lambda[4](t)*(y+u[3]+u[4]+alpha[1]+alpha[2]+mu-(1-u[2])*b*i[p](t)/n-b*(1-u[1])*i[m](t)/n)-lambda[5](t)*(e*y+u[3])-lambda[6](t)*(y*g*(1-e)+u[4])-lambda[7](t)*(y*(1-g)*(1-e)+u[3]+u[4]), diff(lambda[5](t), t) = -lambda[1](t)*delta[1]+lambda[5](t)*(delta[1]+mu), diff(lambda[6](t), t) = -lambda[1](t)*delta[2]+lambda[6](t)*(delta[2]+mu), diff(lambda[7](t), t) = -lambda[1](t)*delta[3]+lambda[7](t)*(delta[3]+mu), i[p](0) = 300, i[m](0) = 200, i[pm](0) = 150, r[p](0) = 200, r[m](0) = 150, r[pm](0) = 150, s(0) = 1000, lambda[1](T) = 0, lambda[2](T) = 0, lambda[3](T) = 0, lambda[4](T) = 0, lambda[5](T) = 0, lambda[6](T) = 0, lambda[7](T) = 0;
p1 := dsolve({sys}, type = numeric, method = bvp[midrich], abserr = 0.1e-5, maxmesh = 2400);
Error, (in fproc) unable to store '-1.*HFloat(0.0)[1]' when datatype=float[8]
p2o := odeplot(p1, [t, i[p](t)], 0 .. 3, numpoints = 100, labels = ["Time (Months)", " Population"], labeldirections = [horizontal, vertical], style = line, color = green, axes = boxed);

Can anyone help me please? I read some related problems here, but couldnt find a solution yet.

Thanks for your time

Best regards

hye, can someone help me to solve nonlinear schrodinger equation using maple? i attach with document


     We know The FindMaximalElement(L) function returns the largest element of the list L .
   My questions is  How do I find the second largest element in a list and its index?  
     Since there are so many lists to consider , Algorithmic Complexity may be as low as possible.
     More generally, we want to find the third-largest  element and so on.
     For instance, Given a list [3,2,3,6,8], we want to get 6 and 4 , since 6 is the  second largest element and 4 is its index. 
    Thank you in advance for your help.


Did someone already made a Pointplot3d for a Principal Components Analysis with projections for some data points on the eigenvectors?

I like this example very much:

but I want to add projections on the three eigenvectors for some data points. I think it has to do something with the dot product, but I do not know how to do it in Maple. 

Hopefully someone already did this and is willing to share it.

kind regards,



I'm new to Maple, and want to know what is the simpliest way to create additional electrical units like MVA and MVAr?


On the segment x ∈ [0,10] plot the numerical solution of the equation y '+ y = 2xsiny, satisfying the initial condition y (0) = 1.
What is wrong here? My solution:

I want to write a procedure called Resistance which calculates and displays the equivalent resistance to three resistors R1, R2 and R3

If the resistances are connected in series then Rser = R1 + R2 + R3

If the resistances are connected in parallel then (R1 * R2 * R3) / (R1 * R2 + R1 * R3 + R2 * R3) and after that, I must write an algorithm which I will test this resistance but it does not work please help me

"Resistance:=proc(R1,R2,R3) local Rser,Rpar,R; if(R=Rser)then Rser:=R1+R2+R3;   elif(R=Rpar)jthen Rpar:=(R1*R2*R3)/((R1*R2+R1*R3++R2*R3));  end if;  end proc;"

Error, unable to parse

"Resistance:=proc(R1,R2,R3) local Rser,Rpar,R; if(R=Rser)then Rser:=R1+R2+R3;   elif(R=Rpar) jthen Rpar:=(R1*R2*R3)/(R1*R2+R1*R3++R2*R3);  end if;  end proc;"


R1 := readstat(entrer*la*valeur*de*R1); R2 := readstat(entret*la*valeur*de*R2); R3 := readstat(entrer*la*valeur*de*R3); Resistance(R1, R2, R3); printf("la valeur en serie est:%f", Rser); printf("la valeur parallele est:%f", Rpar)





I'm using the package DifferentialGeometry with Maple 2019. I have 2 questions whose answer I've not found in the Help section:

a) If I have a 2-form omega with d(omega)=0, how can I obtain the 1-form alpha such that d(alpha) = omega?

b) if alpha is a 1-form and X a vector field, how can I calculate alpha(X)?

Thanks Nicola

    As a first step to my question, let  G be  a graph and  I'd like to know  whether it contains a C4 (cycle of 4) as its subgraph.
     For example: .   It contains C4. So  program may be return true.  
    I'm most concerned about the following thing ( it is important problem for me, since in graph theory, we usually consider some class graphs contain no sepecific graph ) :
   1 Further , I want to  get all connected graphs of order less than 6  which  contains no C4 .
   2 More generally, I want  to konw  a graph  whether contains some graph as its subgraph.For example : does it contain K4CompleteGraph(4)K32  CompleteGraph(3, 2)  and so on ?
    I read the  function subgaph.  But  It didn't solve my problem. Many thanks for your help or advise.
   # I  just know there is a function  IsTriangleFree which test if graph is triangle-free ( graph comtains no C3 in Maple 2019. I think my question and how to program may be  meaningful.


I found that using the packages heometry and simplex in the same worksheet (only one restart at the top of it) causes a conflict in the command simplex:-convexhull(`some set of points`, option = area).

It seems that Maple doesn't confounds  that area in the option=area  with geometry:-area
Is it possible to fix this?



L := { [0,0], [1/2,1/2], [1,1], [2,0], [1,0], [1,1/2] };
simplex:-convexhull(L, 'output'='area');

{[0, 0], [1, 0], [1, 1], [1, 1/2], [2, 0], [1/2, 1/2]}




Use of package geometry



triangle(T, [point(A,0,0), point(B,2,0), point(C,1,3)]):  # just an example

L := { [0,0], [1/2,1/2], [1,1], [2,0], [1,0], [1,1/2] };
simplex:-convexhull(L, 'output'='area');

{[0, 0], [1, 0], [1, 1], [1, 1/2], [2, 0], [1/2, 1/2]}


[[0, 0], [2, 0], [1, 1]]


Error, invalid input: simplex:-convexhull expects its 2nd argument, opts, to be of type identical(output) = {list({identical(area, hull, plot)}), identical(area, hull, plot)}, but received output = geometry:-area


To avoid this conflict between 'output'='area' and geometry:-area I did this


geometry:-triangle(T, [point(A,0,0), point(B,2,0), point(C,1,3)]):

triangle: 0 < -point(A 0 0)+point(B 2 0)+point(C 1 3)

Error, (in geometry:-triangle) not enough information: the triangle is not defined


L := { [0,0], [1/2,1/2], [1,1], [2,0], [1,0], [1,1/2] };
simplex:-convexhull(L, 'output'='area');

{[0, 0], [1, 0], [1, 1], [1, 1/2], [2, 0], [1/2, 1/2]}


[[0, 0], [2, 0], [1, 1]]







First 387 388 389 390 391 392 393 Last Page 389 of 2120