MaplePrimes Questions

Hello!

Is there any chance to bring the expression x2+xy+y2 to the form like x2+y2+xy (i.e. to set/define exact order of monomials) with Maple? What syntax (i.e. commands, packages, etc.) should I use? Many thaks in advance for any useful advice

 

When dsolve throws an error, is it always due to invalid user input, such as parsing error of some sort related to the input given to it, or could it throw an error not related to the parsing part? And if so, how would one know, in code, the difference between an error thrown due to parsing error, vs. something else?

For example, this will throw an error due to parsing

 

ode:=diff(y(x),x)+y;
try
   dsolve(ode,y(x));
catch:    
    print(StringTools:-FormatMessage( lastexception[2..-1] )); 
end try;

   "y(x) and y cannot both appear in the given ODE."

I want to check programmatically, if and when an error thrown by dsolve, if it is due to input itself being invalid, such as parsing error, or invalid initial conditions, and such bad input from the user, vs. other possible error that could be generated internally for other reasons when the input is valid.

I looked at help and there is no mention of what type of exceptions dsolve can throw, or how would would determine the type of exception, as Maple exceptions seem to be just strings and there is no actual identifier or type associated with them to use to check on.

I also looked at https://www.maplesoft.com/support/help/Maple/view.aspx?path=ErrorMessageGuideOverview  and seen nothing there that helps. It just says
 

There are three circumstances that would generate an error in Maple:

1. 	User Errors - the user has supplied incorrect input
2. 	No Solution - in some cases, a Maple routine will issue an error, indicating that the given problem has no solution
3. 	Maple Errors - Maple generates an error during internal computation in response to a problem with its own code

Great., But it does not say how a would a user know which is which when an error is thrown? (using code, not by looking at the screen and then using google).

In Mathematica for example, error messages have actual names, and one could check for the actual message tag itself in the code, to find what the error actually is, instead of using just a plain string of the error message. 

Does Maple have such a thing to use to help find what class of error was thrown out the above three classes shown in the above web page?

 

x1=time, x2=rpm, x3=volu, f1=result; 
> x1=30; 
> f1:=11.921131-0.140022*x2+0.001034*x3+0.000836*x1*x1+0.001003*x2*x1-0.000052693*x2*x2+0.000177*x3*x1+0.000157*x3*x2-0.000011584*x3*x3;
> plot3d(f1,x1=15..60,x2=0..100,x3=400..800,axes=boxed);

Error, (in plot3d/options3d) unknown or bad optional argument: x3 = 400 .. 800

This is my code. and "Error, (in plot3d/options3d) unknown or bad optional argument: x3 = 400 .. 800" is my problem.

How to i get the solution???

please help me..!! 


The command L2(1,2) etc (statements 5 to 8) all are considered as valid and gives the complete list as the answer. Can anyone interpret the behaviour and logic behind the maple answers?

s := [1], [2]

[1], [2]

(1)

L2 := [s]

[[1], [2]]

(2)

type(L2, listlist)

true

(3)

L2__1

L2__1

(4)

"Following commands  give the list L2, which in my opinion is wrong."

L2(1)

[[1], [2]]

(5)

L2(1, 1)

[[1], [2]]

(6)

L2(1, 2)

[[1], [2]]

(7)

L2(2, 2)

[[1], [2]]

(8)

``

L2[2]

[2]

(9)

L2[1][2]

Error, invalid subscript selector

 

``


 

Download Doubt1.mw


 

restart; with(LinearAlgebra); with(plots)

M := 3:

for i while i <= 3 do t[i] := cos((2*i+1)*evalf(Pi)/(2^k*M)) end do;

-0.2051033808e-9

 

-.8660254038

 

-.8660254034

(1)

``

``

printlevel := 2:

-0.2051033808e-9

 

-1.000000000

 

-.8660254038

 

-2.732050808

 

-.8660254034

 

-2.732050807

 

-0.3076550712e-9*p[1](-0.2051033808e-9)-1/2

 

-1.732050808*p[1](-0.2051033808e-9)

 

-1.299038106*p[1](-.8660254038)-1/2

 

-4.732050809*p[1](-.8660254038)

 

-1.299038105*p[1](-.8660254034)-1/2

 

-4.732050808*p[1](-.8660254034)

 

-0.3418389680e-9*p[2](-0.2051033808e-9)-(2/3)*p[1](-0.2051033808e-9)

 

-2.236067977*p[2](-0.2051033808e-9)

 

-1.443375673*p[2](-.8660254038)-(2/3)*p[1](-.8660254038)

 

-6.109051323*p[2](-.8660254038)

 

-1.443375672*p[2](-.8660254034)-(2/3)*p[1](-.8660254034)

 

-6.109051321*p[2](-.8660254034)

 

-0.3589309164e-9*p[3](-0.2051033808e-9)-(3/4)*p[2](-0.2051033808e-9)

 

-2.645751310*p[3](-0.2051033808e-9)

 

-1.515544457*p[3](-.8660254038)-(3/4)*p[2](-.8660254038)

 

-7.228327004*p[3](-.8660254038)

 

-1.515544456*p[3](-.8660254034)-(3/4)*p[2](-.8660254034)

 

-7.228327002*p[3](-.8660254034)

(2)

y(t) := -1.204*phi[1, 0]+.754*phi[1, 1]+.647*phi[1, 2];

3.289389172-3.567966309*p[1](-.8660254034)-3.952556205*p[2](-.8660254034)

(3)

 

``

plot(y(t))

 plot called with arguments: 3.289389172-3.567966309*p[1](-.8660254034)-3.952556205*p[2](-.8660254034), axiscoordinates = (), coords = (), ispolarplot = false
 #(plot,7): error

Error, (in plot) cannot determine plotting variable

 

 locals defined as: cname = cname

 

``

``


 

Download us3.mw

Do not have a working activation code for Maple17.  Have these 2, but neither works.
Y3KKTP32PLF9PXFU 

ZJLL59SMMXQSE8MU

 

I am running Ubuntu 18 (linux).

Thanks

Tom Vawter

(John Vawter)

 

How can I quickly construct a lower triangular matrix?

I tried the following:

restart;

n := 4;

M1 := Matrix(Vector([seq(k, k = 1 .. n)]), shape = diagonal);

M2 := Matrix(Vector([seq(1, k = 1 .. n-1)]), shape = diagonal);

M := Matrix([M1, M2], shape = triangular[lower])

 

 

 

In this case the diagonal has value 1,2,3,4 while the line below 1,1,1.

 

edit: Actually I managed with

M := Matrix([[1], seq([seq(0, i = 1 .. k-2), 1, k], k = 2 .. n)], shape = triangular[lower])

 

 

 

but I was wondering if it is also possible to use Matrices to fill parts of a bigger matrix?

Hi, I cant explain these answers. Can you help me?

Is it possible to use the diff(f,x) operator together with @@ ??

So as in

((x*D)@@2)(f)(x)

-> (x*diff(f,x))@@2 which is of course wrong, but I guess you know what I mean.

In the first case maple evaluates ((x*D)@@1)(x) to x(x)*D(x), but of course x(x) is nonsense here, as x is the variable, so x(anything)=x and D(x) should also be reduced to 1. Is it not possible to tell D that x is the differentiation variable?

 

Probably I could make rules like

applyrule(x(a::anything)=x,expression)

but that seems rather cumbersome.

Much simpler would it be to tell maple in the first place how D and x precisely act.

Hi everyone

I'm stuck with a maple problem

I've got a text file with hundred thousnad of numbers in that form, correspond to point position:

1728
 generated by VMD
  C1        -6.932300       12.540000      -20.260000
  C1        -7.005000       13.914000      -18.431999
  C2        -8.143600       11.942000      -19.424000
  C2        -8.236300       12.972000      -18.327000
  C3        -5.110600       12.270000      -18.719000
  C4        -5.390700       14.318000      -20.143000
  C5        -4.419600       15.242000      -19.368999
  C6        -2.534000       15.407000      -20.941000
  C1        10.458000      -20.974001       -1.023700
  C1         9.977000      -19.162001        0.231220

My problems is, I need to extract specific position, for example, extract all of the position of C1, and put them in a matrix, such as C11(x,y,z),C12(x,y,z)...

in order to be able to extract positions, I currently programmed that:


fileToImport := "metoxyHFtest.txt";

numberreadline := 10;

for i to numberreadline do

lineread := readline(fileToImport);

C6 = sscanf(lineread, " C6%f %f%f")

end do;

Which extract well the position of C6 in that case, but I don't understand how to put these C6 sting in a matrix, even more that each time maple don't find C6, an empty string is produce.

Thanks a lot in advance for your help!

cheers

 

Why seq command dont arrange sequently?
 

``

Qnon[1] := 5.4763071242*10^(-13)*tau[1](t)-.20506349752*tau[4](t)+7.3355613350*10^(-13)*mu*(diff(tau[4](t), t))-1.5518674346*10^(-12)*mu*(diff(tau[3](t), t))-5.4168963155*10^(-11)*mu*(diff(tau[2](t), t))-8.9983661295*10^(-8)*mu*(diff(tau[1](t), t))+0.38286171190e-3*tau[3](t)-.50952212298*tau[2](t):

Qnon[2] := .50952212392*tau[1](t)-0.10721294912e-3*tau[4](t)+1.8909112516*10^(-10)*mu*(diff(tau[4](t), t))+4.7780699202*10^(-11)*mu*(diff(tau[3](t), t))-8.7982781415*10^(-8)*mu*(diff(tau[2](t), t))-5.4168963155*10^(-11)*mu*(diff(tau[1](t), t))-.92166949920*tau[3](t)-2.1814462038*10^(-9)*tau[2](t):

Qnon[3] := -0.38286183048e-3*tau[1](t)-1.3167782709*tau[4](t)+1.4850896418*10^(-11)*mu*(diff(tau[4](t), t))-8.9970916042*10^(-8)*mu*(diff(tau[3](t), t))+4.7780699202*10^(-11)*mu*(diff(tau[2](t), t))-1.5518674346*10^(-12)*mu*(diff(tau[1](t), t))+6.4450739945*10^(-11)*tau[3](t)+.92166950002*tau[2](t):

Qnon[4] := .20506350370*tau[1](t)+1.5790484882*10^(-8)*tau[4](t)-8.8717209465*10^(-8)*mu*(diff(tau[4](t), t))+1.4850896418*10^(-11)*mu*(diff(tau[3](t), t))+1.8909112516*10^(-10)*mu*(diff(tau[2](t), t))+7.3355613350*10^(-13)*mu*(diff(tau[1](t), t))+1.3167782342*tau[3](t)+0.10721719888e-3*tau[2](t):

EqMR := {seq(Qnon[i], i = 1 .. 4)}[4]

.50952212392*tau[1](t)-0.10721294912e-3*tau[4](t)+0.18909112516e-9*mu*(diff(tau[4](t), t))+0.47780699202e-10*mu*(diff(tau[3](t), t))-0.87982781415e-7*mu*(diff(tau[2](t), t))-0.54168963155e-10*mu*(diff(tau[1](t), t))-.92166949920*tau[3](t)-0.21814462038e-8*tau[2](t)

(1)

``

``

``

``


 

Download seq.mw

arrow([u1, u2, u3], shape = cylindrical_arrow, length = sqrt(LinearAlgebra:-Transpose(f0).f0), color = [red, black, green]):

Why i get this error

Error: the number of colours in the COLOUR structure is not sufficient.Error: the number of colours in the COLOUR structure is not sufficient.Error: the number of colours in the COLOUR structure is not sufficient.Error: the number of colours in the COLOUR structure is not sufficient.Error: the number of colours in the COLOUR structure is not sufficient.Error: the number of colours in the COLOUR structure is not sufficient.

In this procedure I roll x dies and request a sum of the dies, n.
I then specify the third argument, o, to be exactly, minimum or maximum, so that it generates random rolls until the sum matches the conditions of my third argument.
It then returns the roll in a list and the number of rolls needed to match the conditions.

 

sim:=proc(x,n,o) uses RandomTools:

sim(3, 12, exactly)

[5, 2, 5], 1

(1)

````

optional_argument.mw
Can I somehow make the third argument optional, with exactly being the default, so that I can enter only sim(3,12) to get a roll that is exactly 12?
I've written through this maplesoft document, but don't quite seem to understand how to make an optional argument in  this regard: https://fr.maplesoft.com/support/help/maple/view.aspx?path=parameter_classes

Any help in understanding this is appreciatet :)

Dear Sir

There is error appears when we solve system of differential equations contains 13 equations ,

the form of error

Error, (in DEtools/convertsys) invalid terms in sum: -9*Y[8]+2 .. Y[3]+.3*Y[6]+.4*Y[7]+3.5*Y[11]+3.5*Y[13]

 

Hint we use dsolve, numerically

How to overcome on this error 

 

Thanks

Hello,

1 .

If A and B are non-commuting operators and I want to calculate

(A+B)^n for some integer n, how can I tell maple to not commute them?

 

2.

And if I have this operator construct A^3. How can I replace it with some defined function f, so A^3 becomes (f@@3)(...)

First 777 778 779 780 781 782 783 Last Page 779 of 2427