Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

hello Dear

I am new here I am not clear about Loop in Maple, I am stuck here.

Please correct and guide me 

thank you

input

 

Loop

Expect result

-------------------------------------------Code--------------------------------

KTe := Matrix(3, 1, [[Matrix(4, 4, [[216, -288, -216, 288], [-288, 384, 288, -384], [-216, 288, 216, -288], [288, -384, -288, 384]])], [Matrix(4, 4, [[216, 288, -216, -288], [288, 384, -288, -384], [-216, -288, 216, 288], [-288, -384, 288, 384]])], [Matrix(4, 4, [[500, 0, -500, 0], [0, 0, 0, 0], [-500, 0, 500, 0], [0, 0, 0, 0]])]]);
DOFe := Matrix(3, 4, [[1, 2, 3, 4], [3, 4, 5, 6], [5, 6, 1, 2]]);
with(ListTools);


with(LinearAlgebra);
nn1 := Row(DOFe, 1);
                      nn1 := [1, 2, 3, 4]

KG1 := Matrix(6, 6);


KG := Matrix(3, 1);

for k from 1 to 3  for i from 1 to 4 do      for j from 1 to 4 do    nn:=Row(DOFe,k):   KG1[nn1[i],nn1[j]]:=(KTe[k[],1])[i,j]    end do  end do   KG[k,1]:=KG1[k] end do;
 

Is there a way to print points that have additional information that can be probed when mousing over the points?

I have an array of arrays with information in each element including the point: [x,y1,y2,R1, R2, R3, R4]

Where y1 and y2 are different values to graph per x(different plots)  and Rk are records for the data(other info that goes along with them such as day of week, rainfall on that day, etc). The different graphs might have different scales so it would be nice if they handled scaling effectively(e.g., |y1| < 1 and y2 > 3430).

I have about 50k points so it has to be relatively fast... as it's already taking a few minutes to process the data in to the array from a file using fopen and readline(not sure why so slow as I'm just using a few parses and cats to put it in an array but probably is being slowed by not being able to pre-allocate the array.

Hello every one, i am New using maple and I am trying to translate This code from matemática to maple, someone can help me please? 

I need to count how many times a special function shows up in an expression.

The problem is that indets returns a set. So if the same function shows up more than one time in the original expression, with same arguments, only one of these will show up in the result. So I would not know if there were mmore than one of these.

Here is a simple example, using sin(x) here.

restart;
expr:=sin(x)+3*cos(x)*sin(x)+1/sin(2*x);
indets(expr,'specfunc(anything,sin)')

#gives
#   {sin(x), sin(2*x)}

So when I do nops() on the above, it gives 2 and not 3.

How to obtain number of times a function shows in an expression, even it if is repeated?

Hello everybody, im at it again. Math with maple. I should be picking up some speed again to plow through this Dutch math book that explains Maple. It creeps me out.. But hey, im learning Maple in the process, and that is what its all about!

The example shows what is done. I made question a. happen, and the answer was right. The thing is with question b. they ask to plot the phase vectors alpha of f(t), g(t), and s(t), although there is no variable t in the phase vector. So how on earth will i plot it in the complex plane?

The literal translation of quesion b is: "check graphically the answer of part a. by drawing the phase vectors f(t), g(t), and s(t) in the complex plane."

I cant get it done. 

Would anyone know the right question. There were no graphs displayed at the answers in the back of the book. 

Thank you!

Greetings,

The Function

Opdracht 2

a.

"f(t):=3*cos(2*t-Pi/(4))"

proc (t) options operator, arrow, function_assign; 3*cos(2*t-(1/4)*Pi) end proc

(1)

"g(t):=4*cos(2*t+Pi/(6))"

proc (t) options operator, arrow, function_assign; 4*cos(2*t+(1/6)*Pi) end proc

(2)

f(t)+g(t)

3*sin(2*t+(1/4)*Pi)+4*cos(2*t+(1/6)*Pi)

(3)

smartplot(3*sin(2*t+(1/4)*Pi)+4*cos(2*t+(1/6)*Pi))

 

3*sin(2*t+(1/4)*Pi)+4*cos(2*t+(1/6)*Pi)

3*sin(2*t+(1/4)*Pi)+4*cos(2*t+(1/6)*Pi)

(4)

3*exp(I*(0-(1/4)*Pi))

(3/2)*2^(1/2)-((3/2)*I)*2^(1/2)

(5)

4*exp(I*((1/6)*Pi))

2*3^(1/2)+2*I

(6)

NULL

3*sqrt(2)*(1/2)-(1/2)*(3*I)*sqrt(2)+2*sqrt(3)+2*I

(3/2)*2^(1/2)-((3/2)*I)*2^(1/2)+2*3^(1/2)+2*I

(7)

evalf(%)

5.585421959-.121320343*I

(8)

arctan((2-3*sqrt(2)*(1/2))/(3*sqrt(2)*(1/2)+2*sqrt(3)))

arctan((-(3/2)*2^(1/2)+2)/((3/2)*2^(1/2)+2*3^(1/2)))

(9)

evalf(%)

-0.2171747628e-1

(10)

5.585421959*cos(2*t-0.2171747628e-1)

5.585421959*cos(2*t-0.2171747628e-1)

(11)

smartplot(5.585421959*cos(2*t-0.2171747628e-1))

 

b.

"fc(t):=3*(e)^(I*(0-Pi/(4)))"

proc (t) options operator, arrow, function_assign; 3*exp(-((1/4)*I)*Pi) end proc

(12)

"gc(t):=4*(e)^((I*Pi)/(6))"

4*exp(((1/6)*I)*Pi)

(13)

"sc(t):=(3 sqrt(2))/2-(3 &ImaginaryI; sqrt(2))/2+2 sqrt(3)+2 &ImaginaryI;"

proc (t) options operator, arrow, function_assign; (3/2)*sqrt(2)-((3/2)*I)*sqrt(2)+2*sqrt(3)+2*I end proc

(14)

``

Download Mapleprimes_Question_Book_2_Paragraph_3.9_Question_2_b.mw

I wonder if there is any way to use ArrayInterpolation with contourplot or similar effect?

N_data.xlsx 

Thank you in advance,

restart;

with(CurveFitting)

[ArrayInterpolation, BSpline, BSplineCurve, Interactive, LeastSquares, Lowess, PolynomialInterpolation, RationalInterpolation, Spline, ThieleInterpolation]

(1)

with(plots);

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(2)

alpha := <seq(0..10,evalf(10/50))>:
beta := <seq(0..10,evalf(10/50))>:

excelfile:= FileTools:-JoinPath(["C:","Users","aimer","OneDrive","Desktop","Msc Thesis","Maple ref","N_data.xlsx"]);

"C:\Users\aimer\OneDrive\Desktop\Msc Thesis\Maple ref\N_data.xlsx"

(3)

NN:=ImportMatrix(excelfile,source=Excel):

_rtable[36893489576445216036]

(4)

#?ImportMatrix;

#NN:=ImportMatrix(matlabData, source=MATLAB);

#currentdir();

"C:\Users\aimer\OneDrive\Desktop\Msc Thesis\Maple ref"

(5)

 

contourplot(ArrayInterpolation([beta,alpha],NN,[x,y]),x=0..10,y=0..10,contours=[0]);

Error, (in CurveFitting:-ArrayInterpolation) invalid input: xvalues are not specified correctly

 

#?listcontplot

 

Download test1.mw

I do not know what is the problem with Using ImportMatrix. N_data.xlsx is in the same directory.

Any comment would be appreciated.

restart;

with(CurveFitting)

[ArrayInterpolation, BSpline, BSplineCurve, Interactive, LeastSquares, Lowess, PolynomialInterpolation, RationalInterpolation, Spline, ThieleInterpolation]

(1)

with(plots);

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(2)

alpha := <seq(0..10,evalf(10/50))>:
beta := <seq(0..10,evalf(10/50))>:

excelfile:= FileTools:-JoinPath(["C: ","Users","aimer","OneDrive","Desktop","Msc Thesis","Maple ref","N_data.xlsx"]);

"C: \Users\aimer\OneDrive\Desktop\Msc Thesis\Maple ref\N_data.xlsx"

(3)

NN:=ImportMatrix(excelfile,source=Excel);

Error, (in ImportMatrix) file or directory does not exist: C: \Users\aimer\OneDrive\Desktop\Msc Thesis\Maple ref\N_data.xlsx

 

?ImportMatrix;

#NN:=ImportMatrix(matlabData, source=MATLAB);

currentdir();

"C:\Users\aimer\OneDrive\Desktop\Msc Thesis\Maple ref"

(4)

?Joinpath

 

Download test1.mw

I have a non-linear deq of 2nd order which I want to solve numerically. The integration should stop if the integrated variable exceeds a certain value, i.e. phi(t)>phi_ end or equivalently phi(t)-phi_end>0. Maple doesn't accept this type of event and the test phi(t)=phi_end doesn't catch (obviously). How to work around?

Hi

just downloaded maple on my windows computer with AMD processor but I can't get it to work!!!!

The program opens up but as soon as I start to write, the program freezes. When the program is frozen there is nothing I can do I can't even close it.

I have tried just about everything ( antivirus, deleting the program, updating the computer) u name it.

if anyone has any suggestions, please write to me!!!

Hi everyone, I have copied soem code from a paper. I hope to try and manupiluate some of the varables. However it seems while I am coping the code I get this error Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations .I have checked online but it seems that there is nothing I can find to fix this problem. My code is posted below 

Thanks for your time and help!

restart

with(VariationalCalculus)

with(ODEtools)

Error, invalid input: with expects its 1st argument, pname, to be of type {`module`, package}, but received ODEtools

 

with(DEtools)

with(plots); with(plottools); PDEtools[declare]((theta, phi, psi)(t), prime = t)

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

(1)

with(linalg)

We will now declare our first equations

 

 

x[1] := l[1]*sin(theta(t))

y[1] := -l[1]*cos(theta(t))``

x[2] := -l[2]*sin(theta(t)); y[2] := l[2]*cos(theta(t))

x[4] := x[1]-l[4]*sin(theta(t)+phi(t)); y[4] := y[1]+l[4]*cos(theta(t)+phi(t)); x[3] := x[2]+l[3]*sin(theta(t)-psi(t)); y[3] := y[2]-l[3]*cos(theta(t)-psi(t))

R[1] := vector(2, [x[1], y[1]]); R[2] := vector(2, [x[2], y[2]]); R[4] := vector(2, [x[4], y[4]]); R[3] := vector(2, [x[3], y[3]])

`\`R`[1]*` &Assign; map`(diff, R[1], t); `\`R`[2]*` &Assign; map`(diff, R[2], t); `\`R`[4]*` &Assign; map`(diff, R[4], t); `\`R`[3]*`&Assign;map`(diff, R[3], t)

NULL

NULL

T := combine(simplify(collect((1/2)*m[1]*innerprod(`\`R`[4]*`,`*R[4]*`)+m[2]/2*
innerprod(\`R[3]\`,\`R[3]`), [l[1], l[2], l[3], l[4], m[1], m[2], diff(theta(t), t), diff(phi(t), t), diff(psi(t), t), cos(psi(t)), sin(psi(t))])), trig)

NULL

U := collect(simplify(expand(g*m[1]*y[4]+g*m[2]*y[3])), [l[1], l[2], l[3], l[4], m[1], m[2], diff(theta(t), t), diff(phi(t), t), diff(psi(t), t), cos(psi(t)), sin(psi(t)), g])

NULL

L := simplify(collect(T-U, [l[1], l[2], l[3], l[4], m[1], m[2], diff(theta(t), t), diff(phi(t), t), diff(psi(t), t), cos(psi(t)), sin(psi(t))]))

NULL

NULL

NULL

Eul := remove(has, EulerLagrange(L, t, [theta(t), phi(t), psi(t)]), K[1]); eq1 := op(select(has, Eul, (diff(psi(t), t))^2)); eq2 := op(select(has, remove(has, Eul, (diff(psi(t), t))^2), sin(psi(t)))); eq3 := op(remove(has, remove(has, Eul, (diff(psi(t), t))^2), sin(psi(t))))

NULL

NULL

INITS := {phi(0) = (1/4)*Pi, psi(0) = (1/4)*Pi, theta(0) = 3*Pi*(1/4), (D(phi))(0) = 0, (D(psi))(0) = 0, (D(theta))(0) = 0}

NULL

PARAM := [g = 9.8, l[1] = 10, l[2] = 100, l[3] = 100, l[4] = 21, m[1] = 1000, m[2] = 1]

NULL

sys := eval([eq1, eq2, eq3], PARAM)

NULL

sol := dsolve([op(sys), op(INITS)], numeric, output = listprocedure)

Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

 

NULL``

 

 

NULL

NULL

``

Download Test_1.mw

Is there any method to handle the huge expression of A where it is given that sigma+x=a, sigma*x=b

It is huge. I tryed with

B := mtaylor(A, [sigma, x], 8)

Unable to handle. I know that the expression can be written in powers in sigma^ix^j and thereafter sigma+x=a, sigma*x=b could be substituted..

Any help.

A := -sigma*(sigma^2+2*sigma*(alpha-1)+alpha*beta+1-alpha)*(alpha+sigma-1)^2*(sigma*theta+delta)*(gamma1*(alpha+sigma-1)+(1-sigma)*(beta+sigma))*alpha*(1-x)^2*(beta+x)^3*((theta*x+delta-gamma1)*(alpha+x-1)-(1-x)*(beta+x))+alpha*(1-sigma)^2*(beta+sigma)^3*((sigma*theta+delta-gamma1)*(alpha+sigma-1)-(1-sigma)*(beta+sigma))*x*(x^2+2*x*(alpha-1)+alpha*beta+1-alpha)*(alpha+x-1)^2*(theta*x+delta)*(gamma1*(alpha+x-1)+(1-x)*(beta+x))

-sigma*(sigma^2+2*sigma*(alpha-1)+alpha*beta+1-alpha)*(alpha+sigma-1)^2*(sigma*theta+delta)*(gamma1*(alpha+sigma-1)+(1-sigma)*(beta+sigma))*alpha*(1-x)^2*(beta+x)^3*((theta*x+delta-gamma1)*(alpha+x-1)-(1-x)*(beta+x))+alpha*(1-sigma)^2*(beta+sigma)^3*((sigma*theta+delta-gamma1)*(alpha+sigma-1)-(1-sigma)*(beta+sigma))*x*(x^2+2*x*(alpha-1)+alpha*beta+1-alpha)*(alpha+x-1)^2*(theta*x+delta)*(gamma1*(alpha+x-1)+(1-x)*(beta+x))

(1)

NULL``

``

Download 1.mw1.mw

Hi, everyone! I am a new user to maple and I need to import some code I have found from a paper, just so I can manupluate some of the variables. However when I have copied and pasted my code, I keep getting the error Error, mismatched or missing bracket/operator.  I did check online and it seems to be a bracket missing but I have copied without errors from the source. 

I have attached a picture and did a copy paste of the code that is giving me an error below. 

Thanks for your help 

x[1] := l[1]*sin(theta(t));
y[1] := -l[1]*cos(theta(t));

x[2] := -l[2]*sin(theta(t));
y[2] := l[2]*cos(theta(t));
R[1] := vector(2, [x[1], y[1]]);
R[2] := vector(2, [x[2], y[2]]);
'R[1]'':=map(diff,R[1],t):

 

polysols(diff(u(x), x) = u(x)^2 - 1) produces no results, while it can be verified by direct observation that u(x) = 1 is a polynomial solution.

Hi
Can someone help me write the program for this equation?
I really need this program.
With respect

 

I was experimenting on and found coeff and degrees  do not work with algebraic type powers. So I set aboud dismanteling  a example polynomial. I certainly went around the houses doing this. I wanted to put the powers and coefficinets of x in an array.

I sure there must be a simpler way.

restart

NULLNULL

r := proc (x) options operator, arrow; a[0]+a[1]*x-a[2]*x^2+a[8]*x^(8/5)-a[h]*x^h+k*x^(-b/a) end proc

proc (x) options operator, arrow; a[0]+a[1]*x-a[2]*x^2+a[8]*x^(8/5)-a[h]*x^h+k*x^(-b/a) end proc

mnmls := [op(r(x))]

[a[0], a[1]*x, -a[2]*x^2, a[8]*x^(8/5), -a[h]*x^h, k*x^(-b/a)]

A := Array(1 .. 2, 1 .. nops(mnmls))

Array(%id = 36893489621187187044)

mnmls, x0 := selectremove(has, mnmls, x)

[a[1]*x, -a[2]*x^2, a[8]*x^(8/5), -a[h]*x^h, k*x^(-b/a)], [a[0]]

NULL

A[2, 1] := op(x0)

a[0]

coeff(r(x), x, 2)

Error, unable to compute coeff

coeffs(r(x), x)

Error, invalid arguments to coeffs

degree(mnmls[1], x)

1

degree(mnmls[4], x)

FAIL

degree(mnmls[5], x)

FAIL

indets(r(x))

{a, b, h, k, x, a[0], a[1], a[2], a[8], a[h], x^h, x^(-b/a), x^(8/5)}

bits := [seq([op(mnmls[i])], i = 1 .. nops(mnmls))]

[[a[1], x], [-1, a[2], x^2], [a[8], x^(8/5)], [-1, a[h], x^h], [k, x^(-b/a)]]

deeperbits := [seq(op(op(bits)[i]), i = 1 .. nops(bits))]

[a[1], x, -1, a[2], x^2, a[8], x^(8/5), -1, a[h], x^h, k, x^(-b/a)]

varpwrs, cofsl := selectremove(has, deeperbits, x)

[x, x^2, x^(8/5), x^h, x^(-b/a)], [a[1], -1, a[2], a[8], -1, a[h], k]

is(nops(vars) = nops(cofsl))

false

cofs := convert(cofsl, Array)

Array(%id = 36893489621220545228)

for i to numelems(cofs)-1 do if cofs[i] = -1 then cofs[i] := 0; cofs[i+1] := -cofs[i+1]; i = i+2 end if end do; cofs; cofs := remove[flatten](has, cofs, 0)

Array(%id = 36893489621220530764)

cofs

Array(%id = 36893489621220530764)

is(nops(vars) = numelems(cofs))

false

NULL

pwrs := `assuming`([simplify(`~`[log[x]](varpwrs))], [x > 0, a::'real', b::'real', h::'real'])

[1, 2, 8/5, h, -b/a]

A

Array(%id = 36893489621187187044)

for i to nops(mnmls) do A[1, i+1] := pwrs[i]; A[2, i+1] := cofs[i] end do; A

Array(%id = 36893489621187187044)

 

NULL


Download Q_11-9-22_monomial_powers_and_coeffs.mw

First 158 159 160 161 162 163 164 Last Page 160 of 2097