MaplePrimes Questions

Maple programming is certainly full of pitfalls for the unwary and the inexperienced as my recent difficulty demonstrates.

I have encountered disconcerting behaviour in the way the Maple type system treats tables and names as a result of last name evaluation.  In my case, it created a rather difficult debugging session in a procedure I was writing.

Specifically, in a procedure where a defined table is an argument, within the procedure the table satisfies the type test for a table, as well as for a name and a symbol. In retrospect, I realize that this makes sense when last name evaluation is in play, but I don't recall any mention of this particular side effect in the help files describing parameter processing or tables.  (or I forgot)
Once identified the problem, I found two fixes:

1) test for a table before I testing for a name(symbol).
2) use eval(T) as the argument when calling the procedure.  

I feel a bit uneasy about the first approach because I'm not certain there isn't some pitfall writing a procedure where the order of execution changes the outcome. Is the second approach the best way (as a rule of thumb) to feed a table into a procedure.

A somewhat artifical worksheet is attached to illustrate the problem and these approaches.


tabletypeanomaly.mw

I was playing with some of the geometry plotting in maple for fun(I rarely use it) and came up with an IFS like system. While I'm sure maple sucks for IFS it is somewhat easy to do. I was just using rectangles though.

Is there any way though to modify a shape using a transform such as a complex map? Not just the vertices but the edges too.

 

Also, is there any way to do a complex map in some easy way? e.g., "paint the geometry on to a texture" and then map it with a complex plot. Usually one just uses a pixel coloring map and maps that, which would be fine for playing around but I'd like to have more control.

 

Basically draw something on a plot(geometry, functions, image, etc), transform them in some interesting way(e.g., complex map) and then IFS them to get interesting visuals.

 

I realize one can do this in maple by turning the edges in to curves and all that mess but I'd like to avoid that since maple is not really good at it anyways(would probably end up very slow).

 

Hi everyone:

How can I solve numerically the system of nonlinear algebraic equations by Newton’s method?

eq1:= (1/2)*x[0]*sqrt(3)-(1/2)*x[1]*sqrt(3) = ((1/2)*x[0]*(t+(1/3)*sqrt(3))*sqrt(3)-(1/2)*x[1]*(t-(1/3)*sqrt(3))*sqrt(3))*(1-(1/6)*y[0]*(t+(1/3)*sqrt(3))*sqrt(3)+(1/6)*y[1]*(t-(1/3)*sqrt(3))*sqrt(3)-(1/8)*y[0]*(5*sqrt(3)*(1/12)-1/4+t)*sqrt(3)+(1/8)*y[1]*(-(1/4)*sqrt(3)-1/4+t)*sqrt(3)-(1/8)*y[0]*((1/4)*sqrt(3)-1/4+t)*sqrt(3)+(1/8)*y[1]*(-5*sqrt(3)*(1/12)-1/4+t)*sqrt(3))-5*t^3*(1/2)+49*t^2*(1/12)+17*t*(1/12)-23/6;
eq2:= (1/2)*y[0]*sqrt(3)-(1/2)*y[1]*sqrt(3) = ((1/2)*y[0]*(t+(1/3)*sqrt(3))*sqrt(3)-(1/2)*y[1]*(t-(1/3)*sqrt(3))*sqrt(3))*(-2+(1/2)*x[0]*(t+(1/3)*sqrt(3))*sqrt(3)-(1/2)*x[1]*(t-(1/3)*sqrt(3))*sqrt(3)+(1/4)*(-(1/12)*sqrt(3)-3/4)*((1/2)*x[0]*(5*sqrt(3)*(1/12)-1/4+t)*sqrt(3)-(1/2)*x[1]*(-(1/4)*sqrt(3)-1/4+t)*sqrt(3))+(1/4)*((1/12)*sqrt(3)-3/4)*((1/2)*x[0]*((1/4)*sqrt(3)-1/4+t)*sqrt(3)-(1/2)*x[1]*(-5*sqrt(3)*(1/12)-1/4+t)*sqrt(3)))+15*t^3*(1/8)-(1/4)*t^2+3*t*(1/8)-1;
eq3:=(1/2)*x[0]+(1/2)*x[1] = 1;
eq4:=(1/2)*y[0]+(1/2)*y[1] = 0;

 

I teach high school IB Math.

I want to find someone who can take problems I have created and enter them into Maple (problem and solution) so I can use those in my classroom.

I can keep up with the new stuff I create, but I have almost 20 years of accumulated material I'd like to move into Maple.

 

Does anyone know where I can find someone to enter the problem and solution so that it is proved out in Maple? Maybe an existing college student using Maple at their school for math, engineering, or education? I am willing to pay them, it is just locating them that is a problem.

 

Even if you know a site for maple contractor types, that would be helpful.

 

Thanks a ton!

 

Robert

I have a function e^(-\lambda z \sqrt(x^2 + y^2)), is it possible to use Maple to find some sequence of derivatives wrt to x and y which could be applied to this function to get

(z/(1+2*sqrt(x^2 + y^2)*lambda))*e^(-\lambda z \sqrt(x^2 + y^2))

 

 

Any maple built-in function can find the possible numbers when modular a fixed number? 

For example, 

(x&^3+y) mod 124 = 123 mod 124

Find the possible values of x and y. 

for i from 1 to numelems(X) do    
    A := x:
    B := C;
end;

 

maple will print all statements even though I use the colon to try to suppress the first line. This just seems wrong. If I suppress the entire loop I have to use prints, and if I have a lot of statements I have to do it for every one even if I just want to supress 1.

It seems maple is suppose to suppress but it isn't.

One problem I come across far to often is that if maple get's bogged down in a computation or I screwed something up I can't always stop it. Sometimes the red ! is greyed out and I have to kill the mserver. When I do this I get the error that I need to save but save doenst' work and I can't do anything because the the kernel was killed. Maple doesn't seem to be able to properly recover... even though it does it most of the time when I click on the red !.

 

Is there any way around this?

 

I get tired of having to resize my plots constantly so I can get a nicer view.

 

setPlotSize:=proc(P,sz::[posint,posint])
  op(0,P)(remove(type,[op(P)],'specfunc(ROOT)')[],
          ROOT(BOUNDS_X(0),BOUNDS_Y(0),
               BOUNDS_WIDTH(sz[1]),BOUNDS_HEIGHT(sz[2])));
end proc:

 

This let's one set the size(mine is usually 1200x500) but I have to stick it in every plot.

 

Is there a way to override the plot functions to automatically do this for every plot or create a simple short option to scale it to the window size or some specific size?

 

I could probably make a simple function like RPF()

 

that I can wrap every plot but I'd like to avoid that step and just apply it to all plots by default(since 99% of the time I have to scale them.

 

 

 

Something really weird is going on when I build a MultiSet in two different ways, using the "+" operation.  The two constructions give the same MultiSet (since U=V), but in some mysterious way they are not really equal (since X=Y is false).  Does anyone know how to avoid this?  Should the "+" operator be avoided altogether?

There is more:  I tried saving the values of X and Y using the command:  save X, Y, "anomaly.m" 

When I tried reading it with the command:  read "anomaly.m"
I got the error message:  "Error, could not open `anomaly.m` for reading".

Thanks!
 

restart

 

U := MultiSet(3 = 1)+MultiSet(4 = 1)

module MultiSet () local instance, hash, generalized; option object; end module

(1)

V := MultiSet(3 = 1)+MultiSet(4 = 1)

module MultiSet () local instance, hash, generalized; option object; end module

(2)

evalb(U = V)

true

(3)

X := [2, 7, U]; Y := [2, 7, V]

[2, 7, module MultiSet () local instance, hash, generalized; option object; end module]

 

[2, 7, module MultiSet () local instance, hash, generalized; option object; end module]

(4)

evalb(X = Y)

false

(5)

seq(evalb(X[i] = Y[i]), i = 1 .. 3)

true, true, true

(6)

``


 

Download Anomaly.mw

Hi everyone:

How can I re-write the EQ with transformation       s=1+2*((tau-t)/T0)    ?

EQ:=int(f1(t-tau)*(Sum(y[k]*F[k](tau), k = 0 .. M)), tau = t-T0 .. t)

tnx...

Hi,

How can I force the command InsertContent(Worksheet(Group(Input( T )))) to display the variable eq as it appears in label (2) ?

(a screen capture of the output of InsertContent(Worksheet(Group(Input( T )))) is given after the Maple code)

restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

with(DocumentTools):

with(DocumentTools[Layout]):

eq := piecewise(t < 1, sin(t), cos(t));

C := Cell( Textfield(style=TwoDimOutput,Equation(eq)) ):
T := Table(Column(), widthmode=percentage, width=40, Row(C)):
InsertContent(Worksheet(Group(Input( T )))):

eq := piecewise(t < 1, sin(t), cos(t))

(2)

 



Download Layout.mw

Hi!

There is a (relatively) known software code (written in C), called ." GKLS-generator" or "GKLS" to generate, according to certain user paramenters, optimization test functions. The code is available for free at the web

http://wwwinfo.deis.unical.it/%7Eyaro/GKLS.html

The download with the files of the GKLS is the following:  download

I would like to write this code in Maple. In the attached zip there is a PDF explaining how to build these functions. For now, I tried the follwoing Maple code GKLS_v4.mw

I think I'm doing something wrong, since the drawing generated by the attached Maple does not look much like the PDF in the attached zip (Fig. 1 of page 8).

Please, Can you help me with this?

Many thanks in advance for your comments.

 

 

Hello

I have problem with Maple that is not simplifying equation completly:

My simplified equation:

1/u * (z - F__n1*sin(alpha__n1)*a*b*c*d + F__n2*sin(alpha__n2)*a*b*c*d + F__n3*sin(alpha__n3)*a*b*c*d)

 

It`s sum of F__n1*sin(alpha__n1)*a*b*c*d for example 20 elements and only n is increasing so why maple will not move a,b,c,d ahead parenthesis ?

 

Hi User!

Hope you would be fine with everything. I have a vector "POL" of M dimension obatined for the following expression

restart; with(LinearAlgebra); nu := 1; M := 3;
for k while k <= M do
Poly[k] := simplify(sum(x^i*GAMMA(nu+1)/(factorial(i)*GAMMA(2*nu)), i = 0 .. k-1))
end do;
POL := `<,>`(seq(Poly[k], k = 1 .. M))

and I want to construct a matrix of M by M by collocating it on the points x=i/(M-1) for i=0,1,2,...,M-1 like the following way,

For M=3 I need

Matrix(3, 3, {(1, 1) = Poly[1](0), (1, 2) = Poly[1](1/2), (1, 3) = Poly[1](1), (2, 1) = Poly[2](0), (2, 2) = Poly[2](1/2), (2, 3) = Poly[2](1), (3, 1) = Poly[3](0), (3, 2) = Poly[3](1/2), (3, 3) = Poly[3](1)});

For M=4 I need

Matrix(4, 4, {(1, 1) = Poly[1](0), (1, 2) = Poly[1](1/3), (1, 3) = Poly[1](2/3), (1, 4) = Poly[1](1), (2, 1) = Poly[2](0), (2, 2) = Poly[2](1/3), (2, 3) = Poly[2](2/3), (2, 4) = Poly[2](1), (3, 1) = Poly[3](0), (3, 2) = Poly[3](1/3), (3, 3) = Poly[3](2/3), (3, 4) = Poly[3](1), (4, 1) = Poly[4](0), (4, 2) = Poly[4](1/3), (4, 3) = Poly[4](2/3), (4, 4) = Poly[4](1)})

 

and general form is like this

[[[Poly[1](0/(M-1)),Poly[1](1/(M-1)),Poly[1]((2)/(M-2)),...,Poly[1]((M-1)/(M-1))],[Poly[2](0/(M-1)),Poly[2]((1)/(M-1)),Poly[2]((2)/(M-1)),...,Poly[2]((M-1)/(M-1))],[Poly[3]((0)/(M-1)),Poly[3]((1)/(M-1)),Poly[3]((2)/(M-1)),...,Poly[3]((M-1)/(M-1))],[...,...,...,...,...],[Poly[M]((0)/(M-1)),Poly[M]((1)/(M-1)),Poly[M]((2)/(M-1)),...,Poly[M]((M-1)/(M-1))]]];

Another problem is I want to define a vector of M dimension using a function f(x)=sin(x) and two points a=1, b=2 like the following way,

Vec:=[[[a],[f((1)/(M-1))],[f((2)/(M-1))],[f((3)/(M-1))],[...],[f((M-1)/(M-1))],[b]]]
Please fix my problem. I'm waiting for your kind response.
Special request @acer @acer @Carl Love @Kitonum @Preben Alsholm

First 581 582 583 584 585 586 587 Last Page 583 of 2409