Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

When I use the Groebner package I normally use it something like this:

with(Groebner):
F≔[x3−3xy,x2y−2y2+x]
Basis(F,plex(x,y))

Does this calculate a reduced Groebner basis or just a Groebner basis? The output looks reduced to me, and I'm sure that I've seen people treat it is as a reduced GB; but the help page doesn't confirm this. Interestingly i can't seem to find any other mention of reduced bases in the help documentation - which makes me think that this method does it (because otherwise people would want a seperate algorithm specifically for getting reduced GBs)

We know that Grid:-Map(x->f(x),[x1..xn]) is for parallel computing f(xi)'s but when some xi's are equal I think Maple copies one result for the others. But maybe my function f has some random sampling inside and so will have different output for same inputs. So I need to do parallel computations for same inputs without cheating of copying the result of one for the rest. For a very simple case that Maple copies while it is wrong to copy, see the following.

I will be happy if someone tells me how to solve this issue. Thanks.

More surprising to me is that if I try to use different xi's and then typing same xi's, I will see some new patterns of copying. 

For example in output (3) and (4), first random point of one parallel computation is the second random point of another computation. Or in output (6) only the two last computations are copy of each other!

 

I may need to add that I did this computations on a computer with 4 core processor. Is Maple producing random numbers using something like processor's time? Or something like this?
I can't report Maple computations if they don't really produce random points independently in seperate parallel computations.

Hello,

At the moment there is no support on GitHub for language recognition and syntax highlighting for Maple. I think better support for Maple on GitHub would be a good thing:

  1. It makes Maple more recognizable, for example in language searches such as this one for one of its competitors.
     
  2. The list of currently supported languages is long and even contains many obscure entries. Maple is not obscure and deserves to be there.

So, why am I posting this here, as it concerns GitHub more than Maple? The reason is that adding support for new languages is often done by GitHub users themselves, using the Linguist library mentioned on this help page. The process does not seem very difficult to me, but it requires a few careful steps.

Referring to those steps:

  1. I think it would be nice to add support for the extensions , and .
     
  2. Perhaps this project by @Daniel Skoog could be used for syntax highlighting? However, currently it does not have a license.
     
  3. Does anybody know of a body of Maple source code that is representative of the modern Maple language as a whole? Probably it should be available under a permissive open source license such as MIT or BSD. (I am not sure whether GPLed work would qualify.)
     
  4. I know of a few Maple projects by others that are maintained on GitHub, such as the ParametricMatrixTools package and some packages by Daniel Skoog. If there are other Maple projects being maintained on GitHub, it would be good to know about them in the comments.

So, in summary, could you perhaps help me with the above Steps 2, 3 and 5 or, if you prefer, could you take care of them yourself and open a pull request, so Maple on GitHub can literally get the recognition it deserves?

My best wishes,

Sebastiaan Janssens.

 

I am trying to solve system of differential equation as shown in file attached. The differentail eqaution has peicewise function for t=8*n and t not equal to 8*n where n is a positive integer. but i am getting error. please help.

 

 

problem30.mw

This started as calculating the location of a machine tool bit that is tangent to a line and a circle.  I watched the part being made.  The machinist moved the tool bit manually until it touched straight and circular markings on a aluminum blank.  Repeating this two times, recording the x-y values, the g-code was altered and the CNC machine started to make the part.  Should be a simple calculation, right?

Well, not for me:

restart; with(geometry):
## Find the (x, y) location of a machine mill path such that the tool is
## tangent to a line and a circle.
##
## Given a line, L1, and a circle, C1, find a circle, C4 tangent to
## both L1 and C1.  Choose the X value of C4 to be such that the
## center of C4 is between the intersection of L1 with the X axis and
## origin.
x0 := (3+1/2)/2;
x1 := x0; y1 := x0 + (1+1/4);
point('P1', x1, y1); ## center of the circle

circle('C2', [P1, x0]);

## X value for line L1
x3 := (3+1/2)/2-(3/4+20/1000)/2-1/2; y3 := 1+1/4; evalf([x3, y3]);
## points P2 and P3 lie on the line
point('P2', x3, 0); point('P3', x3, y3);
line('L1', [P2, P3]);

intersection('I1', L1, C2);
for s in I1 do print(evalf(coordinates(s))) end do;

tr := 1/8;  ## tool radius, radius of C4
## find P4 such that C4 is tangent to L1
x4 := x3 - tr;
## P4 moves parallel to L1
point('P4', x4, 'y4');
circle('C4', [P4, tr]);
Equation(C4); Equation(C2);
intersection('I2', C2, C4);
## fails

## The centerline of the part is at x = (3+1/2)/2 Another dimension of
## the part, is (3/4+20/1000), centered on the centerline.  A second
## dimension of the part is 1/2.  From the physical layout of the
## part, observe that
x_value := (3+1/2)/2 - (3/4+20/1000)/2 - 1/2 - tr: evalf(%);
eq1 := subs(x = x_value, Equation(C4)); eq2 := subs(x = x_value, Equation(C2));
sol := solve([eq1, eq2]); evalf(%);
evalf(sol);

## want the solution with the least y value for point P4
res1 := subs(sol[1], coordinates(P4));
res2 := subs(sol[2], coordinates(P4));

if evalf(res1[2]) < evalf(res2[2]) then
    soln := res1;
else
    soln := res2;
end if;
evalf(soln);

point('P8', soln); evalf(coordinates(P8));
circle('C8', [P8, 1/8]); evalf(Equation(C8)); evalf(Equation(C2));
## the intersect fails  Why?

intersection('I8', C2, C8);

evalf(coordinates(I8[1])); evalf(coordinates(I8[2]));

solve([Equation(C2), Equation(C8)]); evalf(%);
print("The location is", evalf(soln));

 

Hi,

I am trying to do a simple numerical calculation, and need to evaluate functions on a grid. I woult then like to build expression like finite differences, such as

Y[ i + 1 ] - Y[ i - 1 ]

where Y is my Array of function values. However I would then always get the "Error, bad index into Array", even though in the expressions I build i is specified as a summation index over a certain range. Interestingly, indexing with an i works though within the sequence command: seq( Y[ i ], i = 1..n) would produce an output.

I am not sure what is going on.

Thanks for Help!

If I type pi, Maple just show what I typed, but if I insert the Greek letter pi, then it works. Are there other things that I should take care of them when I'm using "floor" command in my programming?

help me for remove this error.

Error, `;` unexpected
 

thanks_Prab.mw

 

Hello

 

Please have a look at the attached picture. I create an expression, hit enter, then Maple auto simplifies it causing a mess. How do i prevent Maple from manipulating expressions?

Thanks

 

https://www.dropbox.com/s/o12crq77b0qffmy/maple_auto_simp.jpg?dl=0

 

 

 

I am not sure why I am getting this RootOf result when I solve for x.

Here is my code.

restart:
eq:=4*x^2+2*y(x)^2=32.5625:
deq:=solve(  diff(eq,x), diff(y(x),x) ):
deq=3;
y(x)=solve(deq=3,y(x));
x=solve(deq=3,x);

The last equation we are solving is  -2x / y = 3.
So we should get y  = -2/3 x and  x = -3/2 y.

The Maple software correctly solves for y in terms of x,
but gives an odd Rootof answer when solving for x. Why is that?

I am not sure how to intepret RootOf(2*_Z+3*y(_Z)).

What is it that's wrong with the following input in Maple?
Note that all variables are real. The sample worksheet is attached. 


 

NULL

with(Physics[Vectors])

p_ := px_i+py_j+pz_k

px_i+py_j+pz_k

(1)

NULL

q_ := qx_i+qy_j+qz_k

qx_i+qy_j+qz_k

(2)

NULL

w_ := wx_i+wy_j+wz_k

wx_i+wy_j+wz_k

(3)

NULL

'`#mover(mi("p"),mo("&rarr;"))`^2/(((a^2+`#mover(mi("p"),mo("&rarr;"))`^2)^2)(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`).(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`)+b1^2)'

`#mover(mi("p"),mo("&rarr;"))`^2/(Typesetting:-delayDotProduct(((a^2+`#mover(mi("p"),mo("&rarr;"))`^2)^2)(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`), `#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`)+b1^2)

(4)

NULL

int(`#mover(mi("p"),mo("&rarr;"))`^2/(Typesetting:-delayDotProduct(((a^2+`#mover(mi("p"),mo("&rarr;"))`^2)^2)(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`), `#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`)+b1^2), [px = -infinity .. infinity, py = -infinity .. infinity, pz = -infinity .. infinity])

`#mover(mi("p"),mo("&rarr;"))`^2*infinity/((a(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`)^2+`#mover(mi("p"),mo("&rarr;"))`(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`)^2)^2.(`#mover(mi("p"),mo("&rarr;"))`-`#mover(mi("q"),mo("&rarr;"))`+`#mover(mi("w"),mo("&rarr;"))`)+b1^2)

(5)

NULL

NULL

NULL


 

Download Integration-Vec-Example.mw

Hi,

I'm new into Maple and I need some serious help. I'm supposed to read numbers from file (teploty.txt) and according to value assign some text to them and write it in other file (barvy.txt). I think I've done it right (propably not, I learn it for like half a year), but Maple keeps writing "Error, cannot determine if this expression is true or false: value < 20".

Can anybody help me, please?

Thank a lot!

Hello,

      I've noticed a strange phenomenon involving simplify: given the exact same input, its output varies between two different results depending on memory usage patterns.

      I've attached a sample code. There, I have an equation which should simplify to 0=0. If I run the code with garbage collection gc uncommented, it will correctly give 0=0. However, with gc commented out, it gives the unsimplified result result ~80% of the time (with 0=0 the remaining 20%):

1/2*A1*k*epsilon*p*(-I*exp(I*psi__p)*(2-2*cos(2*psi__p))^(1/2)+exp(2*I*psi__p)-1)*exp(-I*psi__p-1/2*2^(1/2)*k^(1/2)*(-k*p*cos(psi__p)+(k^2*p^2+2*k*p*
cos(psi__p)+1)^(1/2)-1)^(1/2)*t)*(-exp(-I*k*x-1/2*I*2^(1/2)*k^(1/2)*(k*p*cos(psi__p)+(k^2*p^2+2*k*p*cos(psi__p)+1)^(1/2)+1)^(1/2)*t)+exp(I*k*x+1/2*I*
2^(1/2)*k^(1/2)*(k*p*cos(psi__p)+(k^2*p^2+2*k*p*cos(psi__p)+1)^(1/2)+1)^(1/2)*t)) = 0

For my particular machine, it seems that when the memory usage is <98.4MB, it gives 0=0, and the unsimplied case otherwise.

      Any idea why this is? It seems odd that simplify would return different results depending on garbage collection, especially since use of gc is now discouraged.

example.txt

A few notes:

  • It seems replacing gc with a simple call to kernelopts(memusage) also produces the correct output
  • This is a snippet of a larger body of code I wrote: there, even without gc, it will sporadically (with the exact same input) produce the correct answer ~50% of the time
  • Only the last 4 lines are relevant; the beginning of the attached code is simply to generate appropriate memory usage and doesn't affect the relevant, final 4 lines

EDIT

I could solve my problem already. I edit in the solution at the end, in case some one ever runs into the same issue, and is happy finding this post when searching for a solution.

/EDIT

 

Hi there!

I am starting to learn how to use the Optimization package. The help page for the NLPSolve command contains the example

NLPSolve(sin(x)/x, x=1..30)

which would spit out the local minumum at x=23.519… with value -0.042… .

I tried to use the initialpoint option in order to solve for other local minima or maxima, but regardless which initial point choose, I get

Warning, initial point option ignored by solver

and again the same local minimum as before. I entered the option as follows:

NLPSolve(sin(x)/x, x=1..30,initialpoint={x=17})

I am not sure why it doesn't work, since the NLPSolve help page contains an example using the initialpoint option right underneath this example, and there everything works as intended.

Does anyone know what is going on here?

Cheers!

 

EDIT

The problem was that NLPSolve uses the quadratic interpolation method by default if the function which should be extremised is univariate and unconstrained. This information can be found under the Optimization/General/Methods help page. This method however, is the only one which doesn't accept an initialpoint. Hence, the solution is to apply a different method, such as

NLPSolve(sin(x)/x, x=1..30,initialpoint={x=17},method=modifiednewton)

/EDIT

restart; with(Physics);
Setup(mathematicalnotation = true);
                 [mathematicalnotation = true]
Setup(signature = `-+++`);
                     [signature = - + + +]
Coordinates(M = [t, rho, z, phi]);
 

  Default differentiation variables for d_, D_ and dAlembertian 

   are: (Mequals(t,&rho;,z,&phi;))
 Systems of spacetime Coordinates are: (Mequals(t,&rho;,z,&phi;))
                              {M}
ds2 := -exp(2*psi(rho, z))*d*(t^2)+exp(2*gamma(rho, z)-2*psi(rho, z))*(drho^2+dz^2)+exp(-2*psi(rho, z))*(rho^2)*(dphi^2);
                                  2
    ds2 := -exp(2 psi(rho, z)) d t 

                                              /    2     2\
       + exp(2 gamma(rho, z) - 2 psi(rho, z)) \drho  + dz /

                                2     2
       + exp(-2 psi(rho, z)) rho  dphi 
Setup(metric = ds2);
Error, (in Physics:-Setup) expected the metric as an expression quadratic in [d_(t), d_(rho), d_(z), d_(phi)], or square Matrix, Array or table with 4 lines and 4 columns; or a set with the nonzero components of such a matrix; received: -exp(2*psi(rho, z))*d*t^2+exp(2*gamma(rho, z)-2*psi(rho, z))*(drho^2+dz^2)+exp(-2*psi(rho, z))*rho^2*dphi^2

First 647 648 649 650 651 652 653 Last Page 649 of 2097