Maple 2015 Questions and Posts

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

I have an expression involving a sqrt, and i'd like to simplify it, but simplify(expression,sqrt) doesn't seem to fully help.

Eq1 := [(1/2)*(R[b]*kh[a2]+R[m]*kh[a2]-Rh[m]*kh[a2]+sqrt(R[b]^2*kh[a2]^2+2*R[b]*R[m]*kh[a2]^2-2*R[b]*Rh[m]*kh[a2]^2+R[m]^2*kh[a2]^2-2*R[m]*Rh[m]*kh[a2]^2+Rh[m]^2*kh[a2]^2))/kh[a2] = 0, 0 = 0, -(1/2)*(R[b]*kh[a2]+R[m]*kh[a2]-Rh[m]*kh[a2]+sqrt(R[b]^2*kh[a2]^2+2*R[b]*R[m]*kh[a2]^2-2*R[b]*Rh[m]*kh[a2]^2+R[m]^2*kh[a2]^2-2*R[m]*Rh[m]*kh[a2]^2+Rh[m]^2*kh[a2]^2))/kh[a2] = 0]

simplify(Eq1, sqrt)


[(1/2)*(R[b]*kh[a2]+R[m]*kh[a2]-Rh[m]*kh[a2]+sqrt(kh[a2]^2*(R[b]+R[m]-Rh[m])^2))/kh[a2] = 0, 0 = 0, -(1/2)*(R[b]*kh[a2]+R[m]*kh[a2]-Rh[m]*kh[a2]+sqrt(kh[a2]^2*(R[b]+R[m]-Rh[m])^2))/kh[a2] = 0]

which on paper simplifies to:


is there a way to get maple to show this?

[In part I am trying to better understand how to manipulate sqrt expressions in maple]

I have a complicated expression which includes RootOf( a quadratic ) but holds for all x what i'd like to do is turn it into a polynomial in x[1], x[2], x[3] so i can start looking at the monomial coefficients.

k[a1]*((x[1]+x[3])*k[d1]+C[T]*k[m])*(R[b]-x[1]-2*x[2])/((R[b]+R[m]-x[1]-2*x[2]-x[3])*k[a1]+k[m])-k[d1]*x[1]-k[a2]*x[1]*(R[b]-x[1]-2*x[2])+2*k[d2]*x[2] = (-R[b]*k[a2]+2*k[a2]*x[1]+2*k[a2]*x[2])*(k[a1]*kh[m]*((x[1]+x[3])*k[d1]+C[T]*k[m])*(R[b]+R[m]-Rh[m]-x[1]-2*x[2])/(k[m]*((R[b]+R[m]-x[1]-2*x[2]-x[3])*k[a1]*kh[m]/k[m]+kh[m]))-k[d1]*x[1]-kh[a2]*x[1]*(R[b]+R[m]-Rh[m]-x[1]-2*x[2])+2*kh[d2]*x[2])/(2*kh[a2]*RootOf(kh[a2]*_Z^2+(-R[b]*kh[a2]-R[m]*kh[a2]+Rh[m]*kh[a2]+2*kh[a2]*x[2])*_Z-2*k[a2]*x[1]*x[2]-k[a2]*x[1]^2+k[a2]*x[1]*R[b]+2*kh[d2]*x[2]-2*k[d2]*x[2])-R[b]*kh[a2]-R[m]*kh[a2]+Rh[m]*kh[a2]+2*kh[a2]*x[2])+(-2*kh[a2]*RootOf(kh[a2]*_Z^2+(-R[b]*kh[a2]-R[m]*kh[a2]+Rh[m]*kh[a2]+2*kh[a2]*x[2])*_Z-2*k[a2]*x[1]*x[2]-k[a2]*x[1]^2+k[a2]*x[1]*R[b]+2*kh[d2]*x[2]-2*k[d2]*x[2])+2*k[a2]*x[1]+2*k[d2]-2*kh[d2])*(kh[a2]*x[1]*(R[b]+R[m]-Rh[m]-x[1]-2*x[2])-2*kh[d2]*x[2])/(2*kh[a2]*RootOf(kh[a2]*_Z^2+(-R[b]*kh[a2]-R[m]*kh[a2]+Rh[m]*kh[a2]+2*kh[a2]*x[2])*_Z-2*k[a2]*x[1]*x[2]-k[a2]*x[1]^2+k[a2]*x[1]*R[b]+2*kh[d2]*x[2]-2*k[d2]*x[2])-R[b]*kh[a2]-R[m]*kh[a2]+Rh[m]*kh[a2]+2*kh[a2]*x[2])

If this were something like q(x)=p1(x)/sqrt(p2(x)) where p1 and p2 are polynomials and q is a quotient- this would be as simple as making sqrt(p2(x)) the subject and squaring both sides, and then movinbg everything onto one and multiplying out denominators. However RootOf is something I'm not used to manipulating.

Is there anyway of converting this expression to a polynomial using maple commands?

I am working on a problem that involves finding a map lambda(x) which maple stores using RootOf:

LambdaMap := [lambda[1] = RootOf(kh[a2]*_Z^2+(-R[b]*kh[a2]-R[m]*kh[a2]+Rh[m]*kh[a2]+2*kh[a2]*x[2])*_Z-2*k[a2]*x[1]*x[2]-k[a2]*x[1]^2+k[a2]*x[1]*R[b]+2*kh[d2]*x[2]-2*k[d2]*x[2]), lambda[2] = x[2], lambda[3] = x[1]+x[3]-RootOf(kh[a2]*_Z^2+(-R[b]*kh[a2]-R[m]*kh[a2]+Rh[m]*kh[a2]+2*kh[a2]*x[2])*_Z-2*k[a2]*x[1]*x[2]-k[a2]*x[1]^2+k[a2]*x[1]*R[b]+2*kh[d2]*x[2]-2*k[d2]*x[2])]

(as an aside, after a few years of using maple and reading the help page I find RootOf confusing, and I think this is the root of this question, I'd love to get some recomended reading on it in the answers)

I want to use the restriction lambda(0,0,0)=(0,0,0) to find relationships between the parameters (kh,k,Rh,R etc)

I tried:

`~`[`=`](`~`[rhs](subs([x[1] = 0, x[2] = 0, x[3] = 0], LambdaMap)), [0, 0, 0]);

which returned:
[RootOf(kh[a2]*_Z^2+(-R[b]*kh[a2]-R[m]*kh[a2]+Rh[m]*kh[a2])*_Z) = 0, 0 = 0, -RootOf(kh[a2]*_Z^2+(-R[b]*kh[a2]-R[m]*kh[a2]+Rh[m]*kh[a2])*_Z) = 0]
{R[b] = R[b], R[m] = R[m], Rh[m] = Rh[m]}

which seems wrong (both the first and third equations are quadratics sharing roots, the first root is _Z=0, and the second is _Z=-R[b]-R[m]+Rh[m]- i'm not sure how either result in this solve)

Is this the right way to do this? i.e. do solve and subs, work intuitively with RootOf expressions.

I am doing some calculus on lambda next - is there anything i should be mindful of when calculating its Jacobean or using diff?

I have this sum which should be equal to argument(GAMMA(I*x)) with x>0.


`assuming`([x*ln(n)-(1/2)*Pi-(sum(arctan(x/k), k = 1 .. n))], [x > 1]);

aG := `assuming`([limit(%, n = infinity)], [x > 1]);

`~`[evalf](eval([aG, argument(GAMMA(I*x))], x = 1))


However this limit evaluation is somehow broken in as it always gives some order symbol O(1) etc..

What is happening here?


I have a Vector of polynomials in x[1] and x[2]; and I want to use coeffs to get the coefficients of bothe elements of the Vector; using the command:

Eq2Coeffs := `~`[coeffs](%, [x[1], x[2]])

bizarely the result i get is something in terms of x[1] and x[2].

Here is the worksheet this problem emerged in, the specific command is 3.8.

Help page says "minus~" is an element-wise operators in Maple
Why this command doesn't return [{1}, {3}] but generates an error ?
[{1, 2}, {2, 3}] minus~ {2};
Error, dimension bounds must be the same for all container objects in an elementwise operation

OK, you can answer I could use  map(u -> u minus {2}, [{1, 2}, {2, 3}]), but it wouldn't explain the reason of the (my?) error.

Thanks in advance




I have two matrices, one of the dimension of solution space that i have been using solve to navigate
this matrix will look something like:

M := matrix([[3, 2, 1], [2, 1, 1],[2, 1, 1]])

and I have another matix of the times that it takes solve to find these regions:

N := matrix([[.2, .4, .8], [.3, .6, .5], [.8, 2.3, 2.6]])

I'd like to find the sets {N[ij]:M[ij]=m for some integer m}; that is I'd like to get all the elements of N on entries of M with the same number so i can start thinking about them statistiaclly.

i.e. for 3 i'd like the list [.2]

      for 2                      [.4 .3 .8]

and so on.

I've made a worksheet (updated)in which I'm timing a program (GTS2) because it sometimes takes a long time to run, and I am not interested in timing the cases where it takes an exceptionally long time to run I've created a timer function that runs GTS2 through timelimit.

timelimit(20, GTS2(H, F, Na, Nd))

this should run the function for 20 seconds, and then stop it if it overruns, before returning that the whole function ( GTS2timer2  ) has taken 20 seconds.

On line 3.3 GTStimer2 is run with two sets of inputs which give a runtime >40s. My guess is that the 20+ extra seconds that the operation takes are spent running solve which is called in GTS, and I expect i can solve the problem by putting solve in the timelimit function directly (if i'm wrong about this please tell my why).

My question is why timelimit isn't able to stop GTS after 20 seconds.


Playing around with the worksheet the morning after I made it the case that was running for 40+s is now giving the error

Error, (in factor/diophant) time expired

My guess is that as it is stopping the solve in GTS2  needs a try/catch of its own. Any idea how to make that work? 

I was making a maple worksheet (out of functions from another), when i noticed that  execution groups and new execution groups that i was making were not showing an output.  I'm wondering why this happens, and how it can be fixed.

in more detail there are 4  [> groups of commands, the first two give the correct output when i hit enter, however, if enter is pressed on any group of commands after the second the command wont return the any output.

I believe this is a formatting issue that comes from the way i cut/paste and edited the previous worksheet down to this, but i'd like to understand so i can avoid it happening again.

Ahh, this is a teathing problem, I had been using writeto so i could store measurements of RAM; this changes the nature of the question.

How do you implement writeto so only some things are sent there? (in the case of this worksheet the output of GTS2usage

Dear users!

Hope everyone fine here. I want to compare the coefficients of like power of exponential function in attachemed file. Please see and fix my problem.

Maple 2015

With straight line selected in following plot, I right-click on plot and select Line → Line Width...  In Set line width dialog I toggle line width to 1 and click OK.

I have the changes I want, but if I choose Restart → Execute Worksheet all my changes are lost.  It is often easier to use the Plot Options Toolbar instead of hunting for Maple syntax to make changes in a plot graphic.  I'm wondering if there is a way to "lock" my plot edits so that they won't disappear as I continue working on a Maple worksheet?

eq1 := -y^3+x^2+x*y-7; eq2 := y = (8/9)*x-2/3;
implicitplot({eq1, eq2}, x = 0 .. 4, y = 0 .. 3, axis = [gridlines = [6, color = "MidnightBlue"]], size = [1/2, 1], axesfont = ["Roman", bold, 10], thickness = 3);


Using spacecurve I've created a diagram of two curves in space, they are reflections in the plane x=y (in this diagram they are labeled k[a1]=k[a2]). How can I add the plane to the diagram?

My intuition is to use 3dplot, and then combine them with display. The problem with that is that 3d plot wants a function of the form z=f(x,y) rather than x=y.

(here is the code for the diagram)

spacecurve({[(5*10^(-4)*100)/C[T], 100*10^(-3)/C[T], C[T]], [100*10^(-3)/C[T], (5*10^(-4)*100)/C[T], C[T]]}, C[T] = 10 .. 100, labelfont = [TIMES, 32], axesfont = [TIMES, 32], titlefont = [TIMES, 32], captionfont = [TIMES, 32], labels = [conjugate(k)[a1], conjugate(k)[a2], conjugate(C)[T]], tickmarks = [[0.1e-2 = k[a1], 5*10^(-3) = 5*k[a1], 10^(-2) = 10*k[a1]], [0.1e-2 = k[a1], 5*10^(-3) = 5*k[a1], 10^(-2) = 10*k[a1]], [0 = 0, 10 = (1/10)*C[T], 50 = (1/2)*C[T], 100 = C[T]]], view = [0 .. 0.1e-1, 0 .. 0.1e-1, 0 .. 100])

I have a polynomial in the variables ya[i] and yd[i] where i are integers. I want to divide each of the coefficients by the 'shortest' coeficient. What i mean by that is the coefficient that is going to cause me the least trouble when i later do things with groebner bases of on the coefficients - I expect a good proxy for that is the one that has the smallest number of terms.

For example, for the polynomial:


2*k[a1]*k[d1] is the shortest monomial coefficient


I have a program that produces lists of polynomails in multiple variables; I want to remove any polynomials that have the variable x[i] where i is a number.

An example list would be:

I am calling a function (GTS2) multiple times with varying inputs, using the curry function, and i want to record how long/how much RAM the function takes with each input, and put those in seperate matrices that i can plot later

Sols3 := proc (H::algebraic, F::(list(algebraic)), i::posint, j::posint) options operator, arrow; GTS2(H, F, i, j) end proc;
n, m := 5, 4;
M=Matrix(n, m, curry(Sols3, H, F))

You can find all the functions required in this worksheet. The curried call to this function is in section 4.

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