Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi, I'm trying to display a rotation matrix, but due to the interaction with the explore controls and the working numerical precision for the controls / trig terms, I'm getting displays like

1.0  0.0

0.0  -2*10^-10

What I'd like is for the -2*10^-10 to be displayed in decimal format (by default) and therefore would be displayed as 0.0.

So is there a way to control the display formatting of:

x := cos(Pi/(2.0));

so that it displays 0.0 instead of -2*10^-10?

I realise that Increasing the Digits increases the precision, but this simply increases the magnitude of the exponent and I can't simply use x := cos(Pi/(2)), because of the interaction with the explore controls.

Thanks.

I have a code that outputs a long string of mathematics after various string replacements which I save into a file in the format of a Python function. Here is the code (for a 1 x 1 matrix):

restart:
Size:=1:
## This is the matrix which is generated in a string format
mat1:="Matrix(1, 1, [[-1/2*(A^8*hh*m3+6*A^7*B*hh*m3-2*A^7*hh*m3*z3+16*A^6*B^2*hh*m3-14*A^6*B]])":
## Open up file
filename2:=fopen(cat("Matrix", Size, "x", Size,"HH.py"),WRITE,TEXT): 

## Format file
fprintf(filename2,"import numpy as np\ndef myfuncHH(A,B):\n    z3 = 2\n    m3 = float('inf')\n    Mat_size = %a", Size): 
fprintf(filename2,"\n    arr = np.array([%a",mat1): 
fprintf(filename2,"],dtype=np.float64)"): 
fprintf(filename2,"\n    shape = ( Mat_size, Mat_size )\n    HH=arr.reshape( shape )\n    return HH"):
fclose(filename2):


This generates almost the exact output that is required:

 

import numpy as np
def myfuncHH(A,B):
    z3 = 2
    m3 = float('inf')
    Mat_size = 1
    arr = np.array(["Matrix(1, 1, [[-1/2*(A^8*hh*m3+6*A^7*B*hh*m3-2*A^7*hh*m3*z3+16*A^6*B^2*hh*m3-14*A^6*B]])"],dtype=np.float64)
    shape = ( Mat_size, Mat_size )
    HH=arr.reshape( shape )
    return HH

The part I want to remove is the "Matrix(1, 1, [   "Maths in here"   ])"]

 

I can use stringtools to tidy up most of this, but I am having trouble getting rid of the quotes of the string itself. I have tried escaping them and that does nothing. Is there a simple way to do this or will a regex have to be made?

 

- Yeti

Suppose Delta:=f(a,b)x^2+g(a,b)x+h(a,b), where f,g,h are functions of a and b. Is there a way to find conditions on a,b such that Delta is positive?

i want to solve this DAE system usin Dsolve , but i obtain this error message (cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up), if anyone can help me ,

I am trying to export a number of matrices from maple to matlab with meaningful names.

For instance with this code:
legend := ["ini_que", "ini_que_A", "ini_que_B"];
ExportMatrix("test.mat", [r_mean_Q_ini, r_mean_Q_ini_A, r_mean_Q_ini_B], arraynames = legend, target = MATLAB);

The problem is when I open the resulting file in either python or matlab, I only get  the matrices with names "ini_que" and "ini_que_". My guess is that  long strings in arraynames are truncated and only one of the options are kept.

Is this the case and can the maximum length of the name of the matrix be changed? Or is the only way to use shorter but less readable names?

How to write procedure to find factorial n? Induction to be used.

 

I just quickly checked Nasser Abassi 12000.org to see if he's updated it for Maple 2017.  In some areas he has.  I thought I would check one of the integrals that failed for Maple in his tests.  In the Computer Algegbra independent integration tests Maple failed to solve 11.68% of the 3407 integrals in his test while Mathematica only failed 0.88%.  For Maple that seemed quite high, so it is perhaps his method of solving for Maple and perhaps he's more adept with Mathematica. 

Here is one of the failed integrals and the single line code he used to solve it.

int((5*x^2+3*(x+exp(x))^(1/3)+exp(x)*(2*x^2+3*x))/x/(x+exp(x))^(1/3),x) # of course because it failed it just spits back the integral.

Can maple solve it?

The answer is supposed to be

I am interested to know difference between eval and evalf. Will evaluating a function at a point using these commands gives the same answer or not. I mean will there will be any exception or not. How can I evaluate the value of  a series using eval instead of evalf without the problem of memory running out (No comprimise in accuracy).

Hi all I am attempting to use the randpoly feature to generate a random polynomial of 1st degree with non-zero coeffs between -2 and 2.

I have tried the following:

factor1 := randpoly(x, dense, degree = 1, coeffs = rand(-2 .. 2))

unfortunately as you will find quite often this produces the polynomial "0".  Which it is very clear this is not wanted.

 

Any ideas would be appreciated.

 

Thanks,

Mark

Hi, 

I need to solve system of 6 non linear equations. 

Down here you can see the code I wrote and at the end used to fsolve function, and it is not running. I get an error about the const 'V': Error, (in fsolve) V is in the equation, and is not solved for.

What is the right way to solve this system?

Thank you very much!

 

 

omega1 := 1.562;
omega2 := 2.449;
omega3 := 3.325;
y1 := c1*sin(omega1*t+phi1)+c2*sin(omega2*t+phi2)+c3*sin(omega3*t+phi3);

 

 

y2 := .1019*c1*sin(omega1*t+phi1)+.75*c2*sin(omega2*t+phi2)+.4608*c3*sin(omega3*t+phi3);

 

 

y3 := .407*c1*sin(omega1*t+phi1)+(0*c2)*sin(omega2*t+phi2)+1.844*c3*sin(omega3*t+phi3);
 
eq1 := subs(t = 0, y1) = 0;
 
eq2 := subs(t = 0, y2) = 0;
 
eq3 := subs(t = 0, y3) = 0;
 
eq4 := subs(t = 0, diff(y1, t)) = V;
eq5 := subs(t = 0, diff(y2, t)) = 0;
eq6 := subs(t = 0, diff(y3, t)) = 0;

 

 

eqs := [eq1, eq2, eq3, eq4, eq5, eq6];
 
vars := [c1, c2, c3, phi1, phi2, phi3];
 
fsolve({eq1, eq2, eq3, eq4, eq5, eq6}, {c1, c2, c3, phi1, phi2, phi3});
 

 

Hello all, 

I am trying to compute the Groebner basis for a set of 3 coupled nonlinear equations. The variables I wish to solve for are A0,B0, and B1; however, my equations also have the variables DC, a, nu, q, and t. I wish to solve the 3 equations in terms of these other 5 variables such that I can substitute in any values I desire and obtain a result. When attempting to put the three equations into the PolynomialIdeal command from the PolynomialIdeals package, Maple gives me an error stating that the inputs must be polynomials with respect to all 8 variables. How would I go about declaring the other 5 variables such that they are considered arbitrary constants? 

I was able to get around the errors by assigning values to these 5 variables, though this is not what I am trying to accomplish. I need these 5 values to remain arbitrary.

I am very new to the concept of Groebner Bases and these commands so any help would be appreciated. I have attached my worksheet for reference. I am also happy to supply any additional information that may be needed to assist with this issue.

Thanks!
 

restart

NULL

``

SED2 := proc (A0, B0, B1) options operator, arrow; (32/3)*(nu+7)*A0^2*Pi*DC/(a^2*(1+nu))+3*DC*Pi*((1+nu)^4*(B0^2+(13/42)*B1^2+(4/5)*B0*B1)*a^2+(328/315)*A0^2*(1+nu)^2*((B0+(142/451)*B1)*nu^3+((323/41)*B0+(1490/451)*B1)*nu^2+(11*B0+(3874/451)*B1)*nu-(1847/41)*B0-(8034/451)*B1)*a+(128/105)*A0^4*(nu^4+18*nu^3+132*nu^2+494*nu+939))/(t^2*a^2*(1+nu)^4)-(1/6)*q*a^2*A0-(-(1/4)/a^2-(1/4)*(5+nu)/(a^2*(1+nu)))*A0*q*a^4-(1/2)*(5+nu)*A0*q*a^2/(1+nu) end proc;

proc (A0, B0, B1) options operator, arrow; (32/3)*(nu+7)*A0^2*Pi*DC/(a^2*(1+nu))+3*DC*Pi*((1+nu)^4*(B0^2+(13/42)*B1^2+(4/5)*B0*B1)*a^2+(328/315)*A0^2*(1+nu)^2*((B0+(142/451)*B1)*nu^3+((323/41)*B0+(1490/451)*B1)*nu^2+(11*B0+(3874/451)*B1)*nu-(1847/41)*B0-(8034/451)*B1)*a+(128/105)*A0^4*(nu^4+18*nu^3+132*nu^2+494*nu+939))/(t^2*a^2*(1+nu)^4)-(1/6)*q*a^2*A0-(-(1/4)/a^2-(1/4)*(5+nu)/(a^2*(1+nu)))*A0*q*a^4-(1/2)*(5+nu)*A0*q*a^2/(1+nu) end proc

(1)

NULL

``

eqA0 := proc (A0, B0, B1) options operator, arrow; diff(SED2(A0, B0, B1), A0) end proc:

eqB0 := proc (A0, B0, B1) options operator, arrow; diff(SED2(A0, B0, B1), B0) end proc:

eqB1 := proc (A0, B0, B1) options operator, arrow; diff(SED2(A0, B0, B1), B1) end proc:

NULL

``

type(SED2, polynom);

true

(2)

type(eqA0, polynom);

true

(3)

type(eqB0, polynom);

true

(4)

type(eqB1, polynom);

true

(5)

NULL

``

with(Groebner):

with(PolynomialIdeals):

NULL

NULL

WL := PolynomialIdeal({eqA0(A0, B0, B1), eqB0(A0, B0, B1), eqB1(A0, B0, B1)})

Error, (in PolynomialIdeals:-PolynomialIdeal) generators must be polynomials with respect to, {A0, B0, B1, DC, a, nu, q, t}

 

NULL

type(WL, PolynomialIdeals:-PolynomialIdeal);

false

(6)

``

NULL

GB := Basis(WL, lexdeg([B0, B1], [A0]))

Error, (in Groebner:-Basis) the first argument must be a list or set of polynomials or a PolynomialIdeal

 

NULL

``

GB[1];

GB[1]

(7)

GB[2];

GB[2]

(8)

GB[3];

GB[3]

(9)

``

``

A00 := solve(GB[1], A0):

A00 := simplify(remove(has, [A00], I)):

A0 := A00[1]

Error, invalid subscript selector

 

B10 := solve(GB[2], B1):

B10 := simplify(remove(has, [B10], I)):

B1 := B10[1]

Error, invalid subscript selector

 

B00 := solve(GB[3], B0):

B00 := simplify(remove(has, [B00], I)):

B0 := B00[1]

Error, invalid subscript selector

 

NULL

``


 

Download Groebner_Basis_Work.mw

 

Dear all

I have an operator given below in the image. I want expand this operator upto order 5, when there are three independent variables x, y, t(i=1,2,3). The expansion can also be obtained manually, but that is always prone mistake, is the expansion posible using any routine of Differential Geometry package?

Problem.mw

Hi,

I want to know the partial derivative of

where

in order to 

ρ

If I write 

I obtain this

 

which is incorrect  since I did not have any indexes in sigma. However if I do this next command the result seems correct although no substituion of rhocrf

What I would like to obtain was the solution in order to rho and not to rhocrf and additionally having the result as a summation over p and q and not the extended result. How should I write it in Maple then? 

 

Thank you very much!

I want(ed) to plot a surface gievn by f(x,y,z),g(x,y,z),h(x,y,z) where k(x,y,z) =0. I suspect that is not possble but I thought I might ask.

 

thanks

Maple does not evaluate

>Re( (2-I*X)^4) ),  assuming((X, realcons)

or

>assume(X, realcons);

> Re( (2-I*X)^4) );

Why do these simple expression return unevealuated?

 

First 949 950 951 952 953 954 955 Last Page 951 of 2215