Maple 2016 Questions and Posts

These are Posts and Questions associated with the product, Maple 2016

 

 

 

I have tried to solve a matrix with the function "LinearSolve" as seen in the picture, but instead of solving it just gives me back the operation i wrote (3). My which is to solve an equation system a quick as possible - have a templet fill in the matrix and press enter. I thought this "LinearSolve" function was the easiest way of doing. I know that I can right click and choose the function, but I want it as a command.

 

Any solutions on how to use the "LinearSolve" command to solve an equation system?

 

We assume that the radius of the outer stationary circle is  1. If we set the radius  x  of the inner stationary circle, all the other circles are uniquely determined by solving the system Sys.  Should be  x<=1/3 . If  x=1/3  then all the inner circles have a radius  1/3 . The following picture explains the meaning of symbols in the procedure Circles:

                                   

 

 

Circles:=proc(x)

local OO, O1, O2, O3, O4, O2x, O2y, O3x, O3y, OT, T1, T2, T3, s, t, dist, Sys, Sol, sol, y, u, v, z, C0, R0, P;

uses plottools, plots;

OO:=[0,0]: O1:=[x+y,0]: O2:=[O2x,O2y]: O3:=[O3x,O3y]: O4:=[-x-z,0]: OT:=[x+2*y-1,0]:

T1:=(O2*~y+O1*~u)/~(y+u): T2:=(O3*~u+O2*~v)/~(u+v): T3:=(O4*~v+O3*~z)/~(v+z):

solve({(T2-T1)[1]*(s-((T1+T2)/2)[1])+(T2-T1)[2]*(t-((T1+T2)/2)[2])=0, (T3-T2)[1]*(s-((T2+T3)/2)[1])+(T3-T2)[2]*(t-((T3+T2)/2)[2])=0}, {s,t}):

assign(%);

dist:=(A,B)->sqrt((B[1]-A[1])^2+(B[2]-A[2])^2):

Sys:={dist(O1,O2)^2=(y+u)^2, dist(OO,O2)^2=(x+u)^2, dist(O2,O3)^2=(u+v)^2, dist(OO,O3)^2=(x+v)^2, dist(O3,O4)^2=(z+v)^2, x+y+z=1, dist(O2,OT)^2=(1-u)^2, dist(O3,OT)^2=(1-v)^2};

Sol:=op~([allvalues([solve(Sys)])]);

sol:=select(i->is(eval(convert([y>0,u>0,v>0,z>0,O2y>0,x<=y,u<=y,v<=u,z<=v],`and`),i)), Sol)[];

assign(sol);

O1:=[x+y,0]: O2:=[O2x,O2y]: O3:=[O3x,O3y]: O4:=[-x-z,0]: OT:=[x+2*y-1,0]:

C0:=eval([s,t],sol);

R0:=eval(dist(T1,C0),sol):

P:=proc(phi)

local eq, r1, r, R, Ot, El, i, S, s, t, P1, P2;

uses plots,plottools;

eq:=1-dist([r*cos(s),r*sin(s)],OT)=r-x;

r1:=solve(eq,r);

r:=eval(r1,s=phi);

R[1]:=evalf(r-x);

Ot[1]:=evalf([r*cos(phi),r*sin(phi)]);

El:=plot([r1*cos(s),r1*sin(s),s=0..2*Pi],color="Green",thickness=3);

for i from 2 to 6 do

S:=[solve({1-dist(OT,[s,t])=dist(Ot[i-1],[s,t])-R[i-1], 1-dist(OT,[s,t])=dist(OO,[s,t])-x})];

P1:=eval([s,t],S[1]); P2:=eval([s,t],S[2]);

Ot[i]:=`if`(evalf(Ot[i-1][1]*P1[2]-Ot[i-1][2]*P1[1])>0,P1,P2);

R[i]:=dist(Ot[i],OO)-x;

od;

display(El,seq(disk(Ot[k],0.012),k=1..6),circle(C0,R0,color=gold,thickness=3),circle([x+2*y-1,0],1, color=blue,thickness=4), circle(OO,x, color=red,thickness=4), seq(circle(Ot[k],R[k], thickness=3),k=1..6), scaling=constrained, axes=none);

end proc:

animate(P,[phi], phi=0..Pi, frames=120);

end proc:  

 

Example of use (I got  x=0.22  just by measuring the ruler displayed original animation):

Circles(0.22);

                               

 

 

The curve on the following animation is an astroid (a special case of hypocycloid). See wiki for details. Hypocycloid procedure creates animation for any hypocycloid.  Parameters of the procedure: R is the radius of the outer circle, r is the radius of the inner circle.

Hypocycloid:=proc(R,r)

local A, B, f, g, F;

uses plots,plottools;

A:=circle(R,color=green,thickness=4):

B:=display(circle([R-r,0],r,color=red,thickness=4),line([R-r,0],[R,0],color=red,thickness=4)):

f:=t->plot([(R-r)*cos(s)+r*cos((R-r)/r*s),(R-r)*sin(s)-r*sin((R-r)/r*s),s=0..t],color=blue,thickness=4):

g:=t->rotate(rotate(B,-R/r*t,[R-r,0]),t):

F:=t->display(A,f(t),g(t),scaling=constrained):

animate(F,[t], t=0..2*Pi*denom(R/r), frames=90);

end proc:

 

Examples of use:

Hypocycloid(4,1); 

                                      

 

 

Hypocycloid(5,3);

                                      

 

 

 Круги.mw

HI there,

 

I have the following problem: I want to improve the runtime of my script (Maple 2016) and want to use multithreading/tasking.

First I have this script (let's start with an easy example):

>restart;
  with(LinearAlgebra): 
  with(Student[MultivariateCalculus]):
  with(plots):
  with(Statistics):
  with(Threads):
  with(RealDomain): #I know, I don't need all of that here

>cdf := x-> int(PDF(GammaDistribution(4.5/100,2.5),xi-0.068),xi=0.068..x):
>N:= 20:
>sample := (i) -> solve( (1/(2*(N+1))+1/(N+1)*i)=cdf(x),x): #this is an equidistant sampling

> smpl := [Seq(sample(i),i=1..(N-1))]; #I try to run a multithread seq -> got it from the documentation

   Error, (in assuming) when calling 'Engine:-Process'. Received: 'type `System` does not exist'

I get this error message, but I don't really know what to do with it. I googled and searched, but I couldn't find useful help. Note that when I run this command, I still use only one processor (at least until it returns the error). I also tried:

>smpl := Map(sample,sample_dists);>N:= 20:
   Error, (in assuming) when calling 'Engine:-Process'. Received: 'type `System` does not exist'

I also tried to implement it with threads:

> cont := proc()
      global mutex_sample, smpl:
      smpl := [op(smpl), _passed]: #add the results of the tasks to the smpl var.
      print("Sampling Done");
   end proc:

> sample := proc(cdf, min, max, N) #samle the region
      local output:
      seq(solve(,x),i=0..(N-1)); #return value
   end proc:

> startSampling := proc()
      local sampling_tasks,i:

      print("Starting Sampling!");
      sampling_tasks := []:
      for i from 1 to kernelopts(numcpus) do #for each processor
          sampling_tasks := [op(sampling_tasks), Task=[sample, cdf, i/(kernelopts(numcpus)+1),(i+1)/(kernelopts(numcpus)+1),ceil(N/kernelopts(numcpus))]]; #sample a region
      end do:

      print("Starting Sampling Tasks!");
      Threads:-Task:-Continue( cont, op(sampling_tasks)); #start sampling threads
      print("Sampling Tasks started!");
   end proc:

> Threads:-Task:-Start( startSampling ); #start everything

"Starting Sampling!"
"Starting Sampling Tasks!"
"Sampling Tasks started!"
Error, (in assuming) when calling 'Engine:-Process'. Received: 'type `System` does not exist'

 I know I'm doing here something systematically wrong, but I can't figure it out.

I would be very greatful, for your help or insiged.  

 

EDIT: 
1) The presented script might doesn't make sense (or might be pointless), because I have a much larger and more complex (model) in my original script. But, my script didn't work (exactly same error). So, I tried this simple example, to figure out what the problem is. But it didn't work either. I thought, it might be better (didactically) to find the problem in the simple code. It might be easier to explain in a forum and easier to analyse. (SO I could then see why my more complex code is not working).

2) I was running the script in Linux (Ubuntu 16.04 x64) and it produced this error. I also run the script in Windows 10.2 where I got the same error (and sometimes I got an "Maple Kernel cannot be reached" message where I had to restart Maple.

3) I noticed that solve sometimes returns a complex solution (usually it returned: "value + 0.0 I"). I therefore added "with(RealDomain): ", which had the consequence that some sample points were "NULL". I know that, and that is another issue, which I'm not bothered about (right now).

SOLUTION: (most likely)
Thanks to everyone who replied. But Carl_Love probably is right by pointing out that int, solve, fsolve ... are not thread-safe and therefore caused the crahses/error messages, while calling thesefunctions in different threads.

Does anyone know what the default function is for the pre-subscript and pre-superscript?  I would like to use them for a variable name to represent the local reference frame and global reference frame in my multibody calculations.  Thanks

Hello people in mapleprimes,

I have a question:
What are you doing when you use maple in calculating, for example, your paper,
to avoid missing, for example, variables you use, or for your needs to look back the outcomes you obtained before?
If this is a paper-using work, on considering what to do next, you will read some pieces of papers you wrote and
on which you had calculated and obtained necessary equations. But, with small monitor 13 inch, and with
inconvenience of dealing with things in PC, compared with papers, I feel some stress in using maple in writing a paper.
So, now, I am asking you what kind of methods you has devised to make what you are writing compact and easy,
for you to handle with what you are writing.

I know surely that there are the document block, which enables output or input to not be shown, the workbook,
which is helpful in putting attached worksheets or jpg files together at one workbook, and the distinction of ":" and ";",
which in the case of the former, hides expressions in the outcome.

But, yet, I want to ask you about the ways you use to make it easy to write something.
If you have some, I will be very glad if you show it here.

Best wishes.

taro

 

 

 

 

 

 

Hello everybody!
I have a PDE with initial and boundary conditions. I want to plot its solution by taking "t" as x axis. I have seen the documentation. It only has the space variable on x axis. Please show me a way to achieve what I intend.

here is the file pdsolve.mw

The value of x can be chosen as 0.16 or 0.21

I am trying to solve a PDE using pdsolve-numeric. I am getting an error related to boundary conditions.
Please see the follwing worksheet and suggest me some solutions

pdsolve.mw

When I copy mathml into Maple it always pasted the subscipts as indexed.  How could I quickly convert the indexed subscripts into literal subscripts without having to right click and convert each variable?

How to prove or disprove the flatness of the surface x = (u-v)^2, y =  u^2-3*v^2, z = (1/2)*v*(u-2*v), where u and v are real-valued parameters? Here is my try:

 

plot3d([(u-v)^2, u^2-3*v^2, (1/2)*v*(u-2*v)], u = -1 .. 1, v = -1 .. 1, axes = frame);plot3d([(u-v)^2, u^2-3*v^2, (1/2)*v*(u-2*v)], u = -1 .. 1, v = -1 .. 1, axes = frame)

 

eliminate([x = (u-v)^2, y = u^2-3*v^2, z = (1/2)*v*(u-2*v)], [u, v])

[{u = -2*(-x+2*z+(x^2-8*x*z)^(1/2))/(-2*(x^2-8*x*z)^(1/2)+2*x-8*z)^(1/2), v = (1/2)*(-2*(x^2-8*x*z)^(1/2)+2*x-8*z)^(1/2)}, {-(x^2-8*x*z)^(1/2)*x+y*(x^2-8*x*z)^(1/2)-4*(x^2-8*x*z)^(1/2)*z+x^2-y*x+4*y*z-16*z^2}], [{u = 2*(-x+2*z+(x^2-8*x*z)^(1/2))/(-2*(x^2-8*x*z)^(1/2)+2*x-8*z)^(1/2), v = -(1/2)*(-2*(x^2-8*x*z)^(1/2)+2*x-8*z)^(1/2)}, {-(x^2-8*x*z)^(1/2)*x+y*(x^2-8*x*z)^(1/2)-4*(x^2-8*x*z)^(1/2)*z+x^2-y*x+4*y*z-16*z^2}], [{u = -2*(x-2*z+(x^2-8*x*z)^(1/2))/(2*(x^2-8*x*z)^(1/2)+2*x-8*z)^(1/2), v = -(1/2)*(2*(x^2-8*x*z)^(1/2)+2*x-8*z)^(1/2)}, {(x^2-8*x*z)^(1/2)*x-y*(x^2-8*x*z)^(1/2)+4*(x^2-8*x*z)^(1/2)*z+x^2-y*x+4*y*z-16*z^2}], [{u = 2*(x-2*z+(x^2-8*x*z)^(1/2))/(2*(x^2-8*x*z)^(1/2)+2*x-8*z)^(1/2), v = (1/2)*(2*(x^2-8*x*z)^(1/2)+2*x-8*z)^(1/2)}, {(x^2-8*x*z)^(1/2)*x-y*(x^2-8*x*z)^(1/2)+4*(x^2-8*x*z)^(1/2)*z+x^2-y*x+4*y*z-16*z^2}]

(1)

NULL

I think Gaussian curvature should be used to this end. Dr. Robert J. Lopez is my hope.

Download flat.mw

in Mathematica, there is the option called BoxRatios

"is an option for Graphics3D that gives the ratios of side lengths for the bounding box of the threedimensional picture."

It is sort-of like aspect ratio, but for 3D. It is set by default so make 3D plot looks "nice". I can't seem to find equivalent Maple option. The closest is the option "s=" for plot3d, but this just turns of/on "constrained scaling" and does not allow one to modify the "BoxRatios"

Let me give an example. Here is 3D plot in Mathematica and the same in Maple. I'd like to get the Maple 3D to look similar to Mathematica 3D in terms of the "aspect ratio". Maple on the z-axis is using the same size as in the x and y axis, and even though this is realistic, it does not make the plot as nice. I want to change this ratio.

T0[x_, y_, m_] :=20/Pi Sum[ (-1)^(n + 1)/n Exp[- (n Pi/10) y] Sin[ (n Pi/10) x], {n,1, m}]
Plot3D[T0[x, y, 70], {x, 0, 10}, {y, 0, 10}, PlotRange -> All,  AxesLabel -> {x, y, z}]

In Maple:

T0:= (x,y,m)-> 20/Pi*sum( (-1)^(n+1)/n*exp(- n*Pi/10*y)*sin(n*Pi/10*x),n=1..m);
plot3d(T0(x,y,50),x=0..10,y=0..10,scaling=unconstrained);

So Maple is using 1:1:1 box ratio. Mathematica default is 1:1:0.4, and I wanted to see if I can change Maple to be the same.

I get same plot in Maple using scaling=unconstrained or scaling=constrained. So this option is not very useful for what I want.

Is there a way to change the "BoxRatios" as defined above in Maple? There must be, right? Do I need to use different package?

 

How can one find out when a Maple command or package became part of Maple? i.e. which Maple version first had this command or package?

For example, I'd like to know when applyrule https://www.maplesoft.com/support/help/Maple/view.aspx?path=applyrule was introduced. But this applies really to any command I see.

In Mathematica, this is easy to find out, since it is documented in the help page for the command, at the botton of each page when the command was added. Is there a command or a web page that shows this type of information about Maple commands and packages?

 

This came up in another language. I tried to solve it in Maple, but I am newbie so did not know how to.

The problem is to remove all products of  "a^n*b^m" that shows up in an expression, including any powers of "n,m". For example, given these three expressions

f0 := a^4+4*a^3*b +6*a^2*b^2+4*a*b^3+ b^4;
f1 := 3*(a*b -2*c);
f2 := (a*b -2*c)/(c - a*b);

Then applying the transformation needed, will result in

f0:= a^4+b^4;
f1:=-6*c;
f2:=-2;

Becuase the transformation will detect any a^n*b^m and simply replace this product by zero
from the resulting expression. So "a*b^2 + 2" will become "2", and so on.

I assume a function such as "patmatch" or "match" is needed. I tried, but could not figure how.
I also tried algsubs. How would this be coded in Maple?


hi every one...

how i can simplify this result (R_arm_F2 $  Twflex) via tringular relations.

where Ixflex & tetadot and other... are constants

thanks

matrix_f.mw


NULL

NULL

R := (Matrix(3, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = cos(teta), (2, 3) = -sin(teta), (3, 1) = 0, (3, 2) = sin(teta), (3, 3) = cos(teta)})).(Matrix(3, 3, {(1, 1) = cos(phi), (1, 2) = 0, (1, 3) = sin(phi), (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (3, 1) = -sin(phi), (3, 2) = 0, (3, 3) = cos(phi)})).(Matrix(3, 3, {(1, 1) = cos(si), (1, 2) = -sin(si), (1, 3) = 0, (2, 1) = sin(si), (2, 2) = cos(si), (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1}))

R := Matrix(3, 3, {(1, 1) = cos(phi)*cos(si), (1, 2) = -cos(phi)*sin(si), (1, 3) = sin(phi), (2, 1) = sin(teta)*sin(phi)*cos(si)+cos(teta)*sin(si), (2, 2) = -sin(teta)*sin(phi)*sin(si)+cos(teta)*cos(si), (2, 3) = -sin(teta)*cos(phi), (3, 1) = -cos(teta)*sin(phi)*cos(si)+sin(teta)*sin(si), (3, 2) = cos(teta)*sin(phi)*sin(si)+sin(teta)*cos(si), (3, 3) = cos(teta)*cos(phi)})

(1)

NULL

RT := simplify(1/R)

RT := Matrix(3, 3, {(1, 1) = cos(phi)*cos(si), (1, 2) = sin(teta)*sin(phi)*cos(si)+cos(teta)*sin(si), (1, 3) = -cos(teta)*sin(phi)*cos(si)+sin(teta)*sin(si), (2, 1) = -cos(phi)*sin(si), (2, 2) = -sin(teta)*sin(phi)*sin(si)+cos(teta)*cos(si), (2, 3) = cos(teta)*sin(phi)*sin(si)+sin(teta)*cos(si), (3, 1) = sin(phi), (3, 2) = -sin(teta)*cos(phi), (3, 3) = cos(teta)*cos(phi)})

(2)

R_I_F2 := Matrix(3, 3, {(1, 1) = sin(phi)^2.(1-cos(si))+cos(si), (1, 2) = -(sin(phi).cos(phi).sin(teta))*(1-cos(si))-cos(phi).cos(teta).sin(si), (1, 3) = (sin(phi).cos(phi).cos(teta))*(1-cos(si))-sin(teta)*cos(phi).sin(si), (2, 1) = -(2*sin(phi).cos(phi).sin(teta).cos(teta))*(1-cos(si))+(cos(phi).sin(si))*(cos(teta)^2-sin(teta)^2), (2, 2) = (2*cos(phi)^2.(sin(teta)^2).cos(teta))*(1-cos(si))+cos(teta).cos(si)-sin(teta).sin(phi).sin(si), (2, 3) = -(2*cos(phi)^2.sin(teta))*cos(teta)^2*(1-cos(si))-sin(phi).cos(teta).sin(si)-sin(teta).cos(si), (3, 1) = (sin(phi).cos(phi))*(1-cos(si))*(cos(teta)^2-sin(teta)^2)+2*cos(phi).cos(teta).sin(teta).sin(si), (3, 2) = (cos(phi)^2.sin(teta))*(sin(teta)^2-cos(teta)^2)*(1-cos(si))+cos(si).sin(teta)+sin(phi).cos(teta).sin(si), (3, 3) = (cos(phi)^2.cos(teta))*(cos(teta)^2-sin(teta)^2)*(1-cos(si))-sin(phi).sin(teta).sin(si)+cos(teta).cos(si)})

R_I_F2 := Matrix(3, 3, {(1, 1) = sin(phi)^2.(1-cos(si))+cos(si), (1, 2) = -(`.`(sin(phi), cos(phi), sin(teta)))*(1-cos(si))-`.`(cos(phi), cos(teta), sin(si)), (1, 3) = (`.`(sin(phi), cos(phi), cos(teta)))*(1-cos(si))-sin(teta)*cos(phi).sin(si), (2, 1) = -2*(sin(phi).cos(phi).sin(teta).cos(teta))*(1-cos(si))+(cos(phi).sin(si))*(cos(teta)^2-sin(teta)^2), (2, 2) = 2*(cos(phi)^2.(sin(teta)^2).cos(teta))*(1-cos(si))+cos(teta).cos(si)-`.`(sin(teta), sin(phi), sin(si)), (2, 3) = -2*(cos(phi)^2.sin(teta))*cos(teta)^2*(1-cos(si))-`.`(sin(phi), cos(teta), sin(si))-sin(teta).cos(si), (3, 1) = (sin(phi).cos(phi))*(1-cos(si))*(cos(teta)^2-sin(teta)^2)+2*(cos(phi).cos(teta).sin(teta).sin(si)), (3, 2) = (cos(phi)^2.sin(teta))*(sin(teta)^2-cos(teta)^2)*(1-cos(si))+cos(si).sin(teta)+`.`(sin(phi), cos(teta), sin(si)), (3, 3) = (cos(phi)^2.cos(teta))*(cos(teta)^2-sin(teta)^2)*(1-cos(si))-`.`(sin(phi), sin(teta), sin(si))+cos(teta).cos(si)})

(3)

NULL

R_arm_F2 := RT.R_I_F2

R_arm_F2 := Matrix(3, 3, {(1, 1) = cos(phi)*cos(si)*(sin(phi)^2.(1-cos(si))+cos(si))+(sin(teta)*sin(phi)*cos(si)+cos(teta)*sin(si))*(-2*(`.`(sin(phi), cos(phi), sin(teta), cos(teta)))*(1-cos(si))+(cos(phi).sin(si))*(cos(teta)^2-sin(teta)^2))+(-cos(teta)*sin(phi)*cos(si)+sin(teta)*sin(si))*((sin(phi).cos(phi))*(1-cos(si))*(cos(teta)^2-sin(teta)^2)+2*(`.`(cos(phi), cos(teta), sin(teta), sin(si)))), (1, 2) = cos(phi)*cos(si)*(-(`.`(sin(phi), cos(phi), sin(teta)))*(1-cos(si))-`.`(cos(phi), cos(teta), sin(si)))+(sin(teta)*sin(phi)*cos(si)+cos(teta)*sin(si))*(2*(`.`(cos(phi)^2, sin(teta)^2, cos(teta)))*(1-cos(si))+cos(teta).cos(si)-`.`(sin(teta), sin(phi), sin(si)))+(-cos(teta)*sin(phi)*cos(si)+sin(teta)*sin(si))*((cos(phi)^2.sin(teta))*(sin(teta)^2-cos(teta)^2)*(1-cos(si))+cos(si).sin(teta)+`.`(sin(phi), cos(teta), sin(si))), (1, 3) = cos(phi)*cos(si)*((`.`(sin(phi), cos(phi), cos(teta)))*(1-cos(si))-sin(teta)*cos(phi).sin(si))+(sin(teta)*sin(phi)*cos(si)+cos(teta)*sin(si))*(-2*(cos(phi)^2.sin(teta))*cos(teta)^2*(1-cos(si))-`.`(sin(phi), cos(teta), sin(si))-sin(teta).cos(si))+(-cos(teta)*sin(phi)*cos(si)+sin(teta)*sin(si))*((cos(phi)^2.cos(teta))*(cos(teta)^2-sin(teta)^2)*(1-cos(si))-`.`(sin(phi), sin(teta), sin(si))+cos(teta).cos(si)), (2, 1) = -cos(phi)*sin(si)*(sin(phi)^2.(1-cos(si))+cos(si))+(-sin(teta)*sin(phi)*sin(si)+cos(teta)*cos(si))*(-2*(`.`(sin(phi), cos(phi), sin(teta), cos(teta)))*(1-cos(si))+(cos(phi).sin(si))*(cos(teta)^2-sin(teta)^2))+(cos(teta)*sin(phi)*sin(si)+sin(teta)*cos(si))*((sin(phi).cos(phi))*(1-cos(si))*(cos(teta)^2-sin(teta)^2)+2*(`.`(cos(phi), cos(teta), sin(teta), sin(si)))), (2, 2) = -cos(phi)*sin(si)*(-(`.`(sin(phi), cos(phi), sin(teta)))*(1-cos(si))-`.`(cos(phi), cos(teta), sin(si)))+(-sin(teta)*sin(phi)*sin(si)+cos(teta)*cos(si))*(2*(`.`(cos(phi)^2, sin(teta)^2, cos(teta)))*(1-cos(si))+cos(teta).cos(si)-`.`(sin(teta), sin(phi), sin(si)))+(cos(teta)*sin(phi)*sin(si)+sin(teta)*cos(si))*((cos(phi)^2.sin(teta))*(sin(teta)^2-cos(teta)^2)*(1-cos(si))+cos(si).sin(teta)+`.`(sin(phi), cos(teta), sin(si))), (2, 3) = -cos(phi)*sin(si)*((`.`(sin(phi), cos(phi), cos(teta)))*(1-cos(si))-sin(teta)*cos(phi).sin(si))+(-sin(teta)*sin(phi)*sin(si)+cos(teta)*cos(si))*(-2*(cos(phi)^2.sin(teta))*cos(teta)^2*(1-cos(si))-`.`(sin(phi), cos(teta), sin(si))-sin(teta).cos(si))+(cos(teta)*sin(phi)*sin(si)+sin(teta)*cos(si))*((cos(phi)^2.cos(teta))*(cos(teta)^2-sin(teta)^2)*(1-cos(si))-`.`(sin(phi), sin(teta), sin(si))+cos(teta).cos(si)), (3, 1) = sin(phi)*(sin(phi)^2.(1-cos(si))+cos(si))-sin(teta)*cos(phi)*(-2*(`.`(sin(phi), cos(phi), sin(teta), cos(teta)))*(1-cos(si))+(cos(phi).sin(si))*(cos(teta)^2-sin(teta)^2))+cos(teta)*cos(phi)*((sin(phi).cos(phi))*(1-cos(si))*(cos(teta)^2-sin(teta)^2)+2*(`.`(cos(phi), cos(teta), sin(teta), sin(si)))), (3, 2) = sin(phi)*(-(`.`(sin(phi), cos(phi), sin(teta)))*(1-cos(si))-`.`(cos(phi), cos(teta), sin(si)))-sin(teta)*cos(phi)*(2*(`.`(cos(phi)^2, sin(teta)^2, cos(teta)))*(1-cos(si))+cos(teta).cos(si)-`.`(sin(teta), sin(phi), sin(si)))+cos(teta)*cos(phi)*((cos(phi)^2.sin(teta))*(sin(teta)^2-cos(teta)^2)*(1-cos(si))+cos(si).sin(teta)+`.`(sin(phi), cos(teta), sin(si))), (3, 3) = sin(phi)*((`.`(sin(phi), cos(phi), cos(teta)))*(1-cos(si))-sin(teta)*cos(phi).sin(si))-sin(teta)*cos(phi)*(-2*(cos(phi)^2.sin(teta))*cos(teta)^2*(1-cos(si))-`.`(sin(phi), cos(teta), sin(si))-sin(teta).cos(si))+cos(teta)*cos(phi)*((cos(phi)^2.cos(teta))*(cos(teta)^2-sin(teta)^2)*(1-cos(si))-`.`(sin(phi), sin(teta), sin(si))+cos(teta).cos(si))})

(4)

Twflex := Typesetting:-delayDotProduct(Ixflex, (Typesetting:-delayDotProduct(tetadot, Typesetting:-delayDotProduct(sin(phi)^2, 1-cos(si))+cos(si))+Typesetting:-delayDotProduct(sidot, sin(phi)^3+Typesetting:-delayDotProduct(cos(phi)^2, Typesetting:-delayDotProduct(sin(phi), cos(si)+Typesetting:-delayDotProduct(cos(teta), 1-cos(si)))+Typesetting:-delayDotProduct(sin(teta), sin(si)))))^2)

Ixflex.((tetadot.(sin(phi)^2.(1-cos(si))+cos(si))+sidot.(sin(phi)^3+cos(phi)^2.(sin(phi).(cos(si)+cos(teta).(1-cos(si)))+sin(teta).sin(si))))^2)

(5)

simplify(Twflex)

Ixflex.((tetadot.(sin(phi)^2.(1-cos(si))+cos(si))+sidot.(-sin(phi)*cos(phi)^2+sin(phi)+cos(phi)^2.(sin(phi).(cos(si)+cos(teta).(1-cos(si)))+sin(teta).sin(si))))^2)

(6)

expand(Twflex)

Ixflex.((tetadot.(sin(phi)^2.(1-cos(si))+cos(si))+sidot.(sin(phi)^3+cos(phi)^2.(sin(phi).(cos(si)+cos(teta).(1-cos(si)))+sin(teta).sin(si))))^2)

(7)

``

NULL


Download matrix_f.mw

Walking into the big blue Maplesoft office on August 3rd was a bit nerve wracking. I had no idea who anyone was, what to expect, or even what I would be doing. As I sat in the front hall waiting for someone to receive me, I remember thinking, “What have I gotten myself into?”. Despite my worries on that first day, interning at Maplesoft has been a great experience! I never knew that I would be able to learn so much about programming and working in a company in such a short amount of time. Although Maple was a programming language that was foreign to me a couple weeks ago, I feel like I’m relatively well versed in it now. Trying to learn a new language in this short timespan hasn’t been easy, but I think that I picked it up quickly, even if I’ve had my fair share of frustrations.

Chaos Game example on Rosetta Code

At Maplesoft, I’ve been contributing to the Rosetta Code project by writing short programs using Maple. The Rosetta Code project is dedicated to creating programming examples for many different tasks in different programming languages. My summer project has been to create solutions using Maple for as many tasks as possible and to post these to Rosetta Code; the goal being to have the list of tasks without Maple implementation shrink with each passing day. It’s nice to feel like I’m leaving a mark in this world, even if it is in such a small corner of the internet.

Flipping Bits example on Rosetta Code/MapleCloud

This internship, of course, came with its share of challenges. During my work on the Rosetta Code project, I posted solutions for a total of 38 tasks. Some of them were easy, but some of them took days to complete. On some days, I felt like I was on top of the world. Everything I made turned out great and I knew exactly how to tackle each problem. Other days were slower. I’ve spent ages just staring at a computer monitor trying to figure out just how on earth I was going to make this machine do what I wanted it to do! The 24 Game task was particularly hard, but also very educational. Through this task, I learned about modules, a concept previously unknown to me. I’m fairly sure that the 24 Game also took me the longest, whereas the Increment a numerical string task took me no time at all. Despite it being easy, the Increment a numerical string task wasn’t particularly fun; a bit of a challenge is required for something to be entertaining, after all. My personal favourite was the Fibonacci n-step number sequences task. It was the first really challenging task I encountered, and for after which the feeling of finally completing a task that I spent so long on, of finally overcoming that mountain, was extremely satisfying. Not all challenges end in satisfaction, however. I often found myself accidentally doing something that made the window freeze. I would close the program, then cry a bit on the inside when I realized I just lost the past half an hour’s worth of unsaved work. Nevertheless, I’m glad I got to face all these obstacles because they have made me more resilient and a better programmer.

The following is the code for the Fibonacci n-step number sequences task

numSequence := proc(initValues :: Array)
	local n, i, values;
n := numelems(initValues);
values := copy(initValues);
for i from (n+1) to 15 do
values(i) := add(values[i-n..i-1]);
end do;
return values;
end proc:
 
initValues := Array([1]):
for i from 2 to 10 do
initValues(i) := add(initValues):
printf ("nacci(%d): %a\n", i, convert(numSequence(initValues), list));
end do:
printf ("lucas: %a\n", convert(numSequence(Array([2, 1])), list));

Maple was a great software to program with and a fairly straightforward language to learn. Having previously programmed in Java, I found Maple similar enough that transitioning wasn’t too difficult. In fact, every once in a while when I didn`t know what to do for a task, I would take a look at the Java example in Rosetta Code and it would point me in a direction or give me some hints. While the two languages are similar, there are still many differences. For example, I liked the fact that in Maple, lists started at an index of 1 rather than 0 and arrays could an arbitrary starting index. Although it was different from what I was used to, I found that it made many things much less confusing. Another thing I liked was that the for loop syntax was very simple. I never once had to run through in my head how many times something would loop for. There were such a wide variety of commands in Maple. There was a command for practically anything, and if you knew that it existed and how to use it, then so much power could be at your fingertips. This is where the help system came in extremely handy. With a single search you might find that the solution to the exact problem you were trying to solve already existed as a Maple command. I always had a help window open when I was using Maple.

Multiplication Tables example on Rosetta Code

Spending my summer coding at Maplesoft has been fun, sometimes challenging, but an overall rewarding experience. Through contributing to the Rosetta Code project, I’ve learned so much about computer programming, and it certainly made the 45 minute drive out to Waterloo worth it!

Yili Xu,
Maplesoft SHAD Intern

Hello, I need help in add/sum, there are two problems:

 

1. How we write triple summation (sigma) in Maple? (See pic)

Pic 1 (Triple Sigma)

I try sum(sum(sum or add(add(add but it isn't working.

 

 

2. How we write summation like in this pic?

Pic 2

I already try these syntax:

for e from 1 to 9 do

for k from 1 to 17 do

if i=(2*e-1) then next else

constraint12[2*e-1,k]:=add(x[2*e-1,i,k],i from i in T)=1

end if

end do

end do

 

For example, the expected result for e=2 and k=1 is like following equation:

x[2,1,1]+x[2,3,1]+x[2,4,1]+x[2,5,1]+...+x[2,17,1]+x[2,18,1]=1

But the result I get:

x[2,1,1]+x[2,2,1]+x[2,3,1]+...+x[2,18,1]=1

 

How to omit the x[2,2,1]?

 

Thank you.

First 26 27 28 29 30 31 32 Last Page 28 of 39