Maple 2017 Questions and Posts

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

Requesting a procedure to calculate primes p for which there exists a prime q <= p such that pi(p)=q-pi(q), where pi is the prime counting function. If possible options to select output as p, or as (p,q).

p list starts:2,13,17,29,31,43.....

q list starts: 2,11,13,17,19,23...

Thanks in advance,

David.

The input

f(x) := x^2;

n := evalf(int(f(x)^2, x = 0 .. 1));

f(x) :=  f(x)/n;

plot(f(x), x = 0 .. 1)

leads to the error

Error, (in f) too many levels of recursion
I need to reassign the function as itself divided by n that depends on the old f...

A piece of code like this is supposed to be inside a loop, so creating f_new(x):=f(x)/n doesn't solve the issue.

If it was a cpp code I'd write something like f(x)/=n for every x. How can I do it in Maple?

Thank you in advance for you answers!

I have two functions, f(x) and g(x).

Based the plot, I can see that they intersect around x equals 0, 1, around 4.5 and 10.

So I tried to find the numerical solution by solving f(x) -  g(x) for x assuming x is real.

I'm stuck here because the aswer involves RootOf and _Z and I don't know what to do next.

This is what I've tried so far:
 

``

``

"f(x):=18*log10(x)"

proc (x) options operator, arrow; 18*log10(x) end proc

(1)

"g(x):=1/(2) x^(3)-8*x^(2)+(69/(2))^()*x-27"

proc (x) options operator, arrow; (1/2)*x^3-8*x^2+(69/2)*x-27 end proc

(2)

plot([f(x), g(x)], x = -1 .. 11)

 

``

`assuming`([solve(f(x)-g(x), x)], [x::real])

exp(RootOf(-(exp(_Z))^3*ln(10)+16*(exp(_Z))^2*ln(10)-69*exp(_Z)*ln(10)+54*ln(10)+36*_Z))

(3)

allvalues(exp(RootOf(-(exp(_Z))^3*ln(10)+16*(exp(_Z))^2*ln(10)-69*exp(_Z)*ln(10)+54*ln(10)+36*_Z)))

exp(RootOf(-(exp(_Z))^3*ln(10)+16*(exp(_Z))^2*ln(10)-69*exp(_Z)*ln(10)+54*ln(10)+36*_Z, 1.505446443)), exp(RootOf(-(exp(_Z))^3*ln(10)+16*(exp(_Z))^2*ln(10)-69*exp(_Z)*ln(10)+54*ln(10)+36*_Z, -3.291052648)), exp(RootOf(-(exp(_Z))^3*ln(10)+16*(exp(_Z))^2*ln(10)-69*exp(_Z)*ln(10)+54*ln(10)+36*_Z, 2.302585093)), 1

(4)

``

``


 

Download intersect_curve.mw

 

I know there's an answer to this because I can get the expected answer from Wolfram Alpha (see here).

How can I accomplish this in Maple? 

Hi friends!

I have the following problem.

I'm trying to generate a matrix given a certain lenght n and a polynomial g(x) of degree r as follows:

If n=10, g(x)=x^4+3x^3+x^2+2x+1 and r=degree(g(x))=4, then the resulting matrix will be

 

 

 

 

 

i.e. a matrix with 10 columns, n-r=6 lines, and whose inputs are the coefficients of the polynomial, as follows:

Any help will be very appreciated.

Thank you!

Hi,

I have questions about linestyle in maple, how to change solid and Dash whatever  to line with cross or line with plus 

Please see a plot attached.

Look forward to hearing from you as soon as possible.

Regards,

Mathastr

plots.pdf

Hello Everyone,

I have an equation system which is under-determined and thus yields infinite solutions. 
These usually come in the form of "_t1[1]" or similar variables. Mostly one, sometimes even two.
I am also working on a script for automated solving of a buckling problem and the solution yields of course these t-variables.
Everytime the code run, I get a different t-variable, which makes automation harder.

Please see attached code. (Of course simplified, not my actual code.)

It starts with a random matrix and a solution vector for the equation system.
The system is solved and its coefficients transfered to an equation.
However every time I hit "Enter" on the LinearSolve command, the name of the _t4[1] variable changes.

Is there a way to keep getting the same variable name? How do you work with this?

Best Regards,
Lennart

A := Matrix(4, 4, {(1, 1) = 1, (1, 2) = 3, (1, 3) = 4.5, (1, 4) = 7, (2, 1) = 0, (2, 2) = 2, (2, 3) = 5, (2, 4) = 9, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0}); B := Vector(4, {(1) = 0, (2) = 0, (3) = 0, (4) = 0}); C := LinearAlgebra[LinearSolve](A, B)

Vector[column](%id = 18446746248681490062)

(1)

W1 := C[1]; W2 := C[2]; W3 := C[3]; W4 := C[4]; Q := W1*x^4+W2*x^3+W3*x^2+W1

(HFloat(3.0)*_t4[2]+HFloat(6.5)*_t4[1])*x^4+(-HFloat(2.5)*_t4[2]-HFloat(4.5)*_t4[1])*x^3+_t4[2]*x^2+HFloat(3.0)*_t4[2]+HFloat(6.5)*_t4[1]

(2)

restart

``


 

Download MultipleTCoefficients.mw

Hello Everyone,

I am currently trying to tidy up my worksheet and hide all of the script/code that I wrote in the Maple 2D-Math within the execution script of buttons etc.
Was going well so far until I started transferring code where I was using a lot of symbolic math (if I understood correctly)
There is one instance where I have a variable chi which equals x divided by a.
a being a number, e.g. 5000, while x is and remains a variable.
No problem in 2D-Math as the unknown x is dragged through all following equations.

Not so in the code editor, I think. Doing the calculation results not in x/5000, but in this:


It keeps getting worse because this term will be derived, assembled into a matrix, etc. where the expressions are getting ridiculous:


Without getting into the details of what my script should do, I believe this is a very general issue, not specific to my code.

Is the code editor / "Code when Used/Clicked" not capable of symbolic math? Oder is there some setting that could potentially help me?

Best Regards,
Lennart
 

Hello Everyone,

Me Again... So I have been working do create a procedure, but I started the coding without encasing it in the proc() / end proc; brackets, thinking I could add it later.
What the script does is take parameters and create a matrix and determines the determinant of that matrix.
When I let the script run on its own, it is working perfectly, but when I activate the proc() / end proc; brackets it suddenly gives me a number of errors, telling me the matrix is not square or that the if-loop misses its 2nd argument.

I am kind of suspecting this happens because I take the variable "NumberPlies" from a Table that exists outside the proc(), but on the same work sheet, but I am not 100% sure.
I have uploaded the code, so one of you experts could perhaps have a look and tell me where I am wrong. Why is the script behaving differently on its own compared to when I call it as a procedure?

Any help would be fantastic!

Best Regards,
Lennart
 

Download Test_GetDet_MaplePrimes.mw
 

Maple*des*zur*Berechnung*Beulverhaltens*Composite*Programm*symmetrischer-LEVY*Platten*nach
Anzahl Lagen des Laminates (Ohne Mittellage, eine Seite der Symmetrie):


Lastfall-Definition:

Maple*des*zur*Berechnung*Beulverhaltens*Composite*Programm*symmetrischer-LEVY*Platten*nach

(1)

 

restart; interface(warnlevel = 0); with(DocumentTools); with(LinearAlgebra); with(DocumentTools); with(LinearAlgebra); E1 := 125000; E2 := 10000; v12 := .3; G12 := 5000; t := .25; v21 := E2*v12/E1; Q11 := E1/(-v12*v21+1); Q22 := E2/(-v12*v21+1); Q12 := v21*E1/(-v12*v21+1); Q66 := G12; NumberPlies := GetProperty('ComboBox1', 'selectedindex'); A11 := 0; A12 := 0; A16 := 0; A21 := 0; A22 := 0; A26 := 0; A61 := 0; A62 := 0; A66 := 0; B11 := 0; B12 := 0; B16 := 0; B21 := 0; B22 := 0; B26 := 0; B61 := 0; B62 := 0; B66 := 0; D11 := 0; D12 := 0; D16 := 0; D21 := 0; D22 := 0; D26 := 0; D61 := 0; D62 := 0; D66 := 0; for i to NumberPlies do CurrentAngle := PlyTable1[i, 1]; CurrentHeight := t*i; CurrentHeight := CurrentHeight-.5*t*NumberPlies; CurrentAngleRad := (1/180)*Pi*CurrentAngle; CurrentQMatrix := Matrix(3, 3, {(1, 1) = Q11, (1, 2) = Q12, (1, 3) = 0, (2, 1) = Q12, (2, 2) = Q22, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = Q66}); TurnMatrix := Matrix(3, 3, {(1, 1) = cos(CurrentAngleRad)^2, (1, 2) = sin(CurrentAngleRad)^2, (1, 3) = -2*cos(CurrentAngleRad)*sin(CurrentAngleRad), (2, 1) = sin(CurrentAngleRad)^2, (2, 2) = cos(CurrentAngleRad)^2, (2, 3) = 2*cos(CurrentAngleRad)*sin(CurrentAngleRad), (3, 1) = -2*cos(CurrentAngleRad)*sin(CurrentAngleRad), (3, 2) = 2*cos(CurrentAngleRad)*sin(CurrentAngleRad), (3, 3) = cos(CurrentAngleRad)^2-sin(CurrentAngleRad)^2}); CurrentQMatrixTurned := Multiply(TurnMatrix, Multiply(CurrentQMatrix, Transpose(TurnMatrix))); Q_11 := CurrentQMatrixTurned[1, 1]; Q_12 := CurrentQMatrixTurned[1, 2]; Q_16 := CurrentQMatrixTurned[1, 3]; Q_21 := CurrentQMatrixTurned[2, 1]; Q_22 := CurrentQMatrixTurned[2, 2]; Q_26 := CurrentQMatrixTurned[2, 3]; Q_61 := CurrentQMatrixTurned[3, 1]; Q_62 := CurrentQMatrixTurned[3, 2]; Q_66 := CurrentQMatrixTurned[3, 3]; A11 := A11+Q_11*(CurrentHeight-CurrentHeight+t); A12 := A12+Q_12*(CurrentHeight-CurrentHeight+t); A16 := A16+Q_16*(CurrentHeight-CurrentHeight+t); A21 := A21+Q_21*(CurrentHeight-CurrentHeight+t); A22 := A22+Q_22*(CurrentHeight-CurrentHeight+t); A26 := A26+Q_26*(CurrentHeight-CurrentHeight+t); A61 := A61+Q_61*(CurrentHeight-CurrentHeight+t); A62 := A62+Q_62*(CurrentHeight-CurrentHeight+t); A66 := A66+Q_66*(CurrentHeight-CurrentHeight+t); B11 := B11+.5*Q_11*(CurrentHeight^2-(CurrentHeight-t)^2); B12 := B12+.5*Q_12*(CurrentHeight^2-(CurrentHeight-t)^2); B16 := B16+.5*Q_16*(CurrentHeight^2-(CurrentHeight-t)^2); B21 := B21+.5*Q_21*(CurrentHeight^2-(CurrentHeight-t)^2); B22 := B22+.5*Q_22*(CurrentHeight^2-(CurrentHeight-t)^2); B26 := B26+.5*Q_26*(CurrentHeight^2-(CurrentHeight-t)^2); B61 := B61+.5*Q_61*(CurrentHeight^2-(CurrentHeight-t)^2); B62 := B62+.5*Q_62*(CurrentHeight^2-(CurrentHeight-t)^2); B66 := B66+.5*Q_66*(CurrentHeight^2-(CurrentHeight-t)^2); D11 := D11+(1/3)*Q_11*(CurrentHeight^3-(CurrentHeight-t)^3); D12 := D12+(1/3)*Q_12*(CurrentHeight^3-(CurrentHeight-t)^3); D16 := D16+(1/3)*Q_16*(CurrentHeight^3-(CurrentHeight-t)^3); D21 := D21+(1/3)*Q_21*(CurrentHeight^3-(CurrentHeight-t)^3); D22 := D22+(1/3)*Q_22*(CurrentHeight^3-(CurrentHeight-t)^3); D26 := D26+(1/3)*Q_26*(CurrentHeight^3-(CurrentHeight-t)^3); D61 := D61+(1/3)*Q_61*(CurrentHeight^3-(CurrentHeight-t)^3); D62 := D62+(1/3)*Q_62*(CurrentHeight^3-(CurrentHeight-t)^3); D66 := D66+(1/3)*Q_66*(CurrentHeight^3-(CurrentHeight-t)^3) end do; A = (Matrix(3, 3, {(1, 1) = A11, (1, 2) = A12, (1, 3) = A16, (2, 1) = A21, (2, 2) = A22, (2, 3) = A26, (3, 1) = A61, (3, 2) = A62, (3, 3) = A66})); B = (Matrix(3, 3, {(1, 1) = B11, (1, 2) = B12, (1, 3) = B16, (2, 1) = B21, (2, 2) = B22, (2, 3) = B26, (3, 1) = B61, (3, 2) = B62, (3, 3) = B66})); D = (Matrix(3, 3, {(1, 1) = D11, (1, 2) = D12, (1, 3) = D16, (2, 1) = D21, (2, 2) = D22, (2, 3) = D26, (3, 1) = D61, (3, 2) = D62, (3, 3) = D66})); Nx := 200; Ny := 0; Nxy := 0; a := 500; b := 500; m := 1; chi := x/a; eta := y/b; alpha := a/b; alphaD := a*(D22/D11)^(1/4)/b; betaM := m*Pi/alphaD; betaD := (D12+2*D66)/sqrt(D11*D22); etaD := D12/sqrt(D11*D22); nyD := etaD/betaD; kx := Nx*b^2/(Pi^2*sqrt(D11*D22)); ky := Ny*b^2/(Pi^2*D22); kxy := Nxy*b^2/(Pi^2*(D11*D22^3)^(1/4)); Omega := betaD^2-1+kx*(alphaD/m)^2; if kx > (m/alphaD)^2 then lambda1 := m*Pi*sqrt(betaD+sqrt(Omega))/alphaD; lambda3 := m*Pi*sqrt(sqrt(Omega)-betaD)/alphaD; GenFunc := W1*cosh(lambda1*eta)+W2*sinh(lambda1*eta)+W3*cos(lambda3*eta)+W4*sin(lambda3*eta); Status := 1 elif kx < (m/alphaD)^2*(-betaD^2+1) then omegaklein := sqrt(.5*(sqrt(betaD^2-Omega)+betaD)); phi := sqrt(.5*(sqrt(betaD^2-Omega)-betaD)); GenFunc := W1*cosh(omegaklein*eta)*cos(phi*eta)+W2*sinh(omegaklein*eta)*cos(phi*eta)+W3*cosh(omegaklein*eta)*sin(phi*eta)+W4*sinh(omegaklein*eta)*sin(phi*eta); Status := 5 elif (m/alphaD)^2 > kx then if kx > (m/alphaD)^2*(-betaD^2+1) then lambda1 := m*Pi*sqrt(betaD+sqrt(Omega))/alphaD; lambda3 := m*Pi*sqrt(sqrt(Omega)-betaD)/alphaD; GenFunc := W1*cosh(lambda1*eta)+W2*sinh(lambda1*eta)+W3*cosh(lambda3*eta)+W4*sinh(lambda3*eta); Status := 3 end if end if; y := 0; EQ1 := GenFunc = 0; unassign('y'); GenFunc; EQHelp := diff(GenFunc, `$`(y, 1)); y := 0; EQ2 := EQHelp = 0; unassign('y')*GenFunc; y := b; EQ3 := GenFunc = 0; unassign('y'); GenFunc; EQHelp2 := diff(GenFunc, `$`(y, 1)); y := b; EQ4 := EQHelp2 = 0; unassign('y'); Test := GenerateMatrix({EQ1, EQ2, EQ3, EQ4}, {W1, W2, W3, W4}); Determinant(Test[1]); return Determinant(Test[1])

HFloat(-0.2442128895120277)

(2)

GetDet

GetDet

(3)

GetDet()

Error, (in LinearAlgebra:-Determinant) matrix must be square

 

``


 

Download Test_GetDet_MaplePrimes.mw

 

Test_GetDet_MaplePrimes.mw

Hello Everyone,

Firstly thank you for your help everyone with answering my other question yesterday, it really helped.
Today I present with yet another issue, which is dealing with solving differential equations using the dsolve-command.

I have written a script which is defining the differential equations, (some numbers), and the constraints. However when I let it solve using dsolve, I only get a very very trivial answer, meaning f(x) = 0.
of course this is a valid answer, but not one I can work with... 
(Can I maybe give an additional information, e.g. the function type it is supposed to do this task? In the documentation there is information on setting it up as a series, but what about exponential equations?)

I have uploaded to script (very short), maybe someone knows where I went wrong?
Also, I am assuming that for solving a DE which involves a fourth order derivative I need exactly four boundary conditions, which I provided.
Things are also getting really wonky when I set Nxy to something non-zero... Then I get a solutions which involves a mysterious Z which never happened before and again all four C_x, which I assume resemble missing boundary conditions, reappear.

Any help would be fantastic! :)

Best Regards,

Lennart
 

``

 

restart*with(DocumentTools); with(LinearAlgebra); D11 := 10000; D12 := 10000; D22 := 10000; D66 := 10000; Nx := 1000; Ny := 1000; Nxy := 0; a := 5000; b := 5000; w := sin(y)*GenFunc(x); PDGL := D11*(diff(w, `$`(x, 4)))+(2*(D12+2*D66))*(diff(w, `$`(x, 2), `$`(y, 2)))+D22*(diff(w, `$`(y, 4)))+Nx*(diff(w, `$`(x, 2)))+Ny*(diff(w, `$`(y, 2)))+2*Nxy*(diff(w, `$`(x, 1), `$`(y, 1))) = 0; RB := GenFunc(0) = 0, (D(GenFunc))(0) = 0, GenFunc(a) = 0, (D(GenFunc))(a) = 0; dsolve({PDGL, RB}, GenFunc(x))

GenFunc(x) = 0

(1)

NULL


 

Download Test_DGL1.mw

Hello Everyone,

I am fairly new with Maple, but I am slowly getting the hang of it.

For a university project I need to be able to create a form where a user can input a matrix manually.
Also, I need to have something like a ComboBox where I can input how many rows that matrix will need. (1-20 or so)

I have solved the latter part by adding a "When Use"-Code that sets my Array/Matrix of the DataTable to be a Zero Matrix with the correct dimensions in accordance with the value chosen in the ComboBox.
(This is for a composite calculation, the ComboBox gives the number of plies, the matrix defines the ply orientation)

I then expected that the ZeroMatrix would serve as the baseline and the user can then manually edit the Matrix to be the correct values manually, but this gives me the error message that the DataTable cannot be edited.
I suspect the ZeroMatrix is now the "Master", because I defined it via Code.

Working with "visibleRows" did not help, because it does not change the matrix size only the size of DataTable and the user can still scroll down.

What I need is that I have a fully editable DataTable with exactly the number of rows that I specified using the ComboBox.

Does anyone of you perhaps have an idea what I could do to achieve this?
Any help would be fantastic! :)

Best Regards,
Lennart

Hello everyone

I am trying to plot some vectors that have both numeric entries and NA. The vectors represent the root of some function depending on certain parameters (NA means that there is no root for these parameters) and I want to represent the value of the root (vertical) vs the vector that store the variable parameter (horizontal) omitting the values that yield NA. Is there a fast way to do that?

 

Thank you so much in advance

hi

i have expression like

z:=f0(x) + f1(x)*diff(y(x),x) + f2(x)*diff(y(x),x,x) + f4(x)*diff(y(x),x,x,x,x) ... etc ;

always linear terms diff((y(x),x) etc, never like diff((y(x),x)^2

want vector with coeffs of diff((y(x),x) etc in order low to high so want

<f1(x), f2(x), 0, f4(x) ...>

if z:=f0(x) + f2(x)*diff(y(x),x,x) + f4(x)*diff(y(x),x,x,x,x) ... etc ; want <0, f2(x), 0, f4(x) ...>

first term in vector always for diff((y(x),x)

how to do thanks

 

 

 

 

Any could you please help me to write program using for loop of 

U(0, h, m)=0 for h=1 .. 10, m=0..10.?

Hello everyone,

I am trying to represent a set of data using the errorplot command as follows

plotlims50 := ErrorPlot(xcoords = vectorl, sigmasl50, yerrors = [0.1e-1, 0.4e-1, 0.1e-1, 0.3e-1, 0.3e-1, 0.6e-1, 0.6e-1, 0.1e-1, 0.4e-1, 0.6e-1, 0.5e-1, 0.3e-1, 0.2e-1, 0.2e-1], color = "green")

I guess it's okey, but I would like to have that kind of small lines at the end of the bar and perpendicular to it (like in the image below). Is it possible?

Thank you so much in advance

Hi,

I'm working on a procedure involving conic equations such as follows... 

Conic:=a*x^2+2*h*x*y+b*y^2+2*f*x+2*g*y+c;

and I have a file filled with values in order of the variables I want them assigned to.

e.g 2,-6,3,0,0

I'm only looking for the specific command I need for maple to link the two.

Any help would be greatly apreciated.

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