Maple Questions and Posts Maple Questions and Posts Feed

These are Posts and Questions associated with the product, Maple

I keep getting an error about the while. It is calling it an invalid if statement.  It may relate to semi colons, but I cannot find any errors myself. Please help.


local ix,iy,i,j,i0,i1,j0,j1,k;      

local count,wgt,top,bot,hp;      



for iy from 1 to n do      

for ix from 1 to n do           

if (IR(ix,iy)=0) then                

i0:=max(1,ix-rwin);  i1:=min(n,ix+rwin);                

j0:=max(1,iy-rwin);  j1:=min(n,iy+rwin);                 


while (k<mink )do                              

if(i0>1) then                                       

i0:= i0-1;                                       

k:= k+ add(IR(i0,j),j=j0..j1)                              

end if;                              

if(i0<1) then                                        


k:= k+ add(IR(i0,j),j=j0..j1)                              

end if;                              

if(j0>1) then                                        


  k:= k+ add(IR(i,j0),i=i0..i1)                         

  end if;                           

 if(j0<1) then                                

 j0:= j0+1;                                         

k:= k+ add(IR(i,j0),i=i0..i1)                             

end if;                         

end do;                  

top:=0;  bot:=0;                

for j from j0 to j1 do                

for i from i0 to i1 do                      

if (IR(i,j)<>0) then                           




end if;                

end do;                

end do;                


end if;      

end do;      

end do;  

end proc:

I'm trying to solve a series of equations and then graph them. I'm trying to solve for the variables involved:

values := solve({eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9,

eq10, eq11, eq12, eq13, eq14, eq15, eq16}, {a, b, b, c, d, e, f,

g, h, i, j, k, l, m, n, o, p});


. . . but it gives me this:

Warning, solving for expressions other than names or functions is not recommended. 

values := 

int(int(y, 0 <= y, x^2+y^2+z^2 <= 1));

Error, (in int) integration range or variable must be specified in the second argument, got 0 <= y

int(int(y, y = 0, x^2+y^2+z^2 = 1));

Error, (in int) integration range or variable must be specified in the second argument, got y = 0

Am trying to create a gif file of  a cantilevered door opening with the aid of a coil spring.  The program is given below in text format.  At the end is a for/do loop which gives a series of pictures of the side view of the door opening.  I'd like to animate these and be able to create a gif file. The use of animate seems to require a function F(x,t) of two variables - one being time. My calculations do not involve time.  Any help gratefully received.


> with(plots): with(plottools):
> #Problems:
> #gif file???  Use of animate
> # - - - - - - -
> printlevel:=0:
> #h=doorheight;  h1=dist from floor to pivot point; base=dist of cantilever #connection to end of garage door
> h:=206:h1:=115:
> doorheight:=h:
> base:=24:
> #Spring data
> sbase:=0.4*base:  #sbase is height of base of spring connection point
> #Lower & upper proportions of spring length as ratio of spring length
> propn1:=0.2: propn2:=0.95:  #propn2 > propn1
> #alpha is inclination angle of coils in the spring
> alpha:=Pi/6:
> #nc is Number of Coils in Spring
> nc:=24:   #92 in my actual spring
> #Garage door (closed position lightly shown)
> gdupright:=line([0,0],[0,h], linestyle=2, color=grey):
> #cr is Cantilever Radius
> cr:=h1-base:
> #Counter-balance extension length is cr_ext
> cr_ext:=12:  # 62
> doorwidth:=0.05*h:
> guidewidth:=doorwidth*1.015:
> #macro(skyblue = COLOR(RGB, 0.1960, 0.6000, 0.8000));
> macro(palegreen=COLOR(RGB, .5607, .7372, .5607)):
> #g1 (top) & g2 are guides for door support
> #g_ext is guide extension proportion of guides above the door
> g_ext:=0:  
> g1:=line([-doorwidth/2,doorheight*(1+g_ext)+guidewidth],[doorheight*(1+g_ext),doorheight*(1+g_ext)+guidewidth], color=palegreen):
> g2:=line([-doorwidth/2,doorheight*(1+g_ext)],[doorheight*(1+g_ext),doorheight*(1+g_ext)], color=palegreen):
> garagefloor:=line([-h*.65,0],[doorheight,0], color=black):
> rooflevel:=line([-h*.65,(1.05+g_ext)*h+guidewidth],[doorheight,(1.05+g_ext)*h+guidewidth], linestyle=2,color=grey):
> #Pivot point - pivpoint
> pivp_x:=0.019*h:   #doorwidth:
> #printf("pivp_x= %8.2f doorwidth= %7.1f\n",pivp_x,doorwidth):
> pivpoint:=circle([pivp_x,h1],doorwidth/2, color=red): #doorwidth/2 for radius - #use cr to check
> #mpp is mid point of rotation
> mpp := point([pivp_x,h1], color=black):
> #connect_point[j]:=circle([pivp_x+cr_ext*sin(theta),h1+cr_ext*sin(theta)],doorwidth/2, color=red):
> lastj:=4:    #Number of angle diplays -1 (for 0)
> #printf("Rotation Angle of cantilever (degrees) & distance along the guide arm (cm)  hc   kc"):
> # - - - - - - - - - - - - - -
> for j from 0 to lastj do
> theta:=j*Pi/lastj:
> # hc was changed from cr*sin(theta)
> hc:=pivp_x-cr*sin(theta):kc:=h1-cr*cos(theta):
> x:=pivp_x-cr*sin(theta)+sqrt((h-base)^2-(h-kc)^2):
> #printf("%8.2f %7.1f    %5.2f   %5.2f\n",theta*180/Pi,x,hc,kc);
> if j=lastj then phi:=Pi/2:
>  else
> phi:=arctan((cr*sin(theta)+x-pivp_x)/(cr*(1+cos(theta))));
> end if:
> #Sides of door, starting at NW corner & going anti-clockwise
> door1 := line([x-doorwidth*cos(phi),h+doorwidth*sin(phi)],[x,h] , color=black):
> door2 := line([x,h],[x-h*sin(phi),h-h*cos(phi)] , color=black):
> door3 := line([x-h*sin(phi),h-h*cos(phi)],[x-h*sin(phi)-doorwidth*cos(phi),h-h*cos(phi)+doorwidth*sin(phi)], color=black):
> door4 := line([x-h*sin(phi)-doorwidth*cos(phi),h-h*cos(phi)+doorwidth*sin(phi)],[x-doorwidth*cos(phi),h+doorwidth*sin(phi)], color=black):
> #Counter balance arm
> cba:=line([x-(h-base)*sin(phi),h-(h-base)*cos(phi)],[pivp_x+cr_ext*sin(theta),h1+cr_ext*cos(theta)],color=blue):
> #Spring calcs # ???
> spring:=line([pivp_x,sbase],[pivp_x+cr_ext*sin(theta),h1+cr_ext*cos(theta)], linestyle=2, color=grey):
> #Turnbuckle
> tbuck1:=line([pivp_x,sbase],[pivp_x+cr_ext*propn1*sin(theta),sbase+propn1*(h1-sbase+cr_ext*cos(theta))], color=black):
> #for tbuck2 see below - it requires angle chi
> chi:=arctan(cr_ext*sin(theta)/(h1-sbase+cr_ext*cos(theta))):
> tbuck2:=arc([pivp_x,sbase],doorwidth/6,Pi/2-chi..3*Pi/2+.2, color=blue):
> #sl is spring length (l is the letter L lower case)
> sl:=sqrt(cr_ext^2+(h1-sbase)*((h1-sbase)+2*cr_ext*cos(theta))):
> for i from 0 to nc do
> x1[i]:=pivp_x+(propn1+(propn2-propn1)*i/nc)*sl*sin(chi):
> y1[i]:=sbase+(propn1+(propn2-propn1)*i/nc)*sl*cos(chi):
> connect_point:=circle([pivp_x+cr_ext*sin(theta),h1+cr_ext*cos(theta)],doorwidth/4, color=blue):
> printlevel:=1:
> #printf("x[%g] = %8.2f  y[%g] = %8.2f theta = %8.2f chi = %8.2f\n", i,x[i],i,y[i],theta*180/Pi,chi*180/Pi);
> #####---PRINT STATEMENT  (NB 2 #)
> #printf("i=%g x = %4.2f  y = %5.2f theta = %6.3f chi = %7.3f  Sp len=%5.3f\n",
> #i, x1[i],y1[i],theta*180/Pi,chi*180/Pi,sl);
> s_coil[i]:=line([x1[i]-doorwidth/2,y1[i]-doorwidth/2*tan(alpha-chi)], [x1[i]+doorwidth/2,y1[i]+doorwidth/2*tan(alpha-chi)], color=blue):
> end do:
> #Coords of end of spring (& counter-balance arm) are #[pivp_x+cr_ext*sin(theta),h1+cr_ext*cos(theta)]
> #Line from top of spring to kicker bolt
> #connectline[j]:=line([pivp_x+cr_ext*sin(theta),h1+cr_ext*cos(theta)], #[x1[nc]+doorwidth/2,y1[nc]+doorwidth/2*tan(alpha-chi)], color=green):
> printlevel:=-1:
> frame[j]:=plots[display](door1,door2,door3,door4,garagefloor,rooflevel,g1,g2,gdupright,pivpoint,cba,mpp,connect_point,seq(s_coil[i],, tbuck1,tbuck2, scaling=constrained, axes=none):
> end do;
> # - - - - - - - - - - - - - -
> printlevel:=1:
> for j from 0 to lastj do
> frame[j];
> end do;
> # - - - - - - - - -
> animate( frame[j],j=0..lastj,t=1..2,frames=50);

A major-league pitcher releases a ball at a point 6 feet above the ground and 58 feet from home plate at a speed of 100 mi/hr ,  

If gravity had no effect, the ball would travel along a line and cross home plate 4 feet off the ground. Find the drop D caused by gravity.                                                                                                                                                      


NB: in this problem the angle alpha is the angle between the horizontal and the direction of the released ball. Since the ball is dropping, alpha will be negative.

Hi every body:

i have a second order ode and will convert to two ode of first order with maple,how do this work???

eq := diff(y(x), x, x)+2*y(x)+y(x)^2 = 0

taylor(1/(1+z^2), z = 1, 4)

The result is 


but in fact the result is 


my Maple is Maple 16,How to solve this problem?

Hi there,

is it possible to have the legend of a pointplot accepting arguments?

Say I have an array of 3 values (e.g. p:=[1.5,2,2.5]) representing a given parameter for a function. When representing this function by means of a plot, I would like the legend (legend="Parameter " + value in array; legend=["Parameter", "Parameter", "Parameter") to accept the contents of the array, without entering the values manually:

Parameter 1.5

Parameter 2

Parameter 2.5


How can this be achieved?




When I plot an expresion I would the graphics be framed. What I am getting, instead, is the curve and the axis, whith no frame at all. How can I force Maple to make the graphic surrounded by a frame? 


I figured I'd start a new thread for odd things I come across whilst using the new physics package. 

I have found this, and am not sure if it is expected. 




Setup(mathematicalnotation = true):


Setup(Commutator(Psigma[i], Psigma[j]) = Physics:-`*`(Physics:-`*`(I, ep_[i, j, k]), Psigma[k]), AntiCommutator(Psigma[i], Psigma[j]) = Physics:-`*`(2, kd_[i, j]));

[algebrarules = {%AntiCommutator(Physics:-Psigma[i], Physics:-Psigma[j]) = 2*Physics:-KroneckerDelta[i, j], %Commutator(Physics:-Psigma[i], Physics:-Psigma[j]) = I*Physics:-LeviCivita[i, j, k]*Physics:-Psigma[k]}]














Archimedes supposedlly, was asked to determine whether a crown made for the king consisted of pure gold. According to 

legend, he solved this problem by weighing the crown first in air and then in water. Suppose the scale read 7.84 N when the 

crown was in the air and 6.84 N when it was in water.


What should Archimedes have told the king ?


Matlab to maple...

Yesterday at 12:03 PM hikki 5

Hi! I have a matlab worksheet that i need to convert it to Maplesoft. Is it possible?



Take a look at below. I was expecting maple to give me "g'(1)"! :)

hi.i am a problem with following dsolve.please help me....thanks alot

dsys3 := {10*f2(x)+12*(diff(f1(x), x))+14*f3(x) = 0, 2*(diff(f1(x), x, x))+4*(diff(f2(x), x))+6*(diff(f3(x), x)) = 0, 16*(diff(f3(x), x, x, x, x))+19*(diff(f3(x), x, x))+22*(diff(f1(x), x))+25*f2(x)+27*f3(x)+29*f3(x)+31+32 = 0, f1(0) = 0, f1(1) = 0, f2(0) = 0, f2(1) = 0, f3(0) = 0, f3(1) = 0, ((D@@1)(f1))(0) = 0, ((D@@1)(f1))(1) = 0, ((D@@1)(f2))(0) = 0, ((D@@1)(f2))(1) = 0, ((D@@1)(f3))(0) = 0, ((D@@1)(f3))(1) = 0}; dsol5 := dsolve(dsys3, 'maxmesh' = 500, numeric, range = 0 .. 1, abserr = .1, output = listprocedure); fy3 := eval(f3(x), dsol5); fy2 := eval(f2(x), dsol5); fy1 := eval(f1(x), dsol5)

Let N be an integer. 


For each pair of integers (n,m) where 1<= n,m <= N, we have a variable f_{n,m}(t). 


Then for these we have a system of ODEs 


d/dt f_{n,m}(t) = \sum_{n', m'} f_m'n' * f_m''n'' * (m'n'' - m''n') 


where m''=m-m', n''=n=n', and the sum is simply over for all pairs (n',m'). 


I simply do not know how to put these set of equations into Maple in a nice way. 


I will really appreciate any help!

1 2 3 4 5 6 7 Last Page 1 of 962