# MaplePrimes Questions

Search Questions:

## Latest Questions Latest Questions Feed

### Beg for a model(speed control of DC motor)...

April 08 2014
1 1

Recently I started to learn to use maplesim. I wanted to set up a feedback system which is used to control the speed of DC motor. I don't know how to build it. Please give me some advice. I really appreciate your help.

### return the indicis of a value from list...

April 08 2014
0 2

Hi, with a list

l:=[1,1,1,2,3,3,4];

What's the best way to get the index(s) for the values equal to '1'?

Say for x=1, we want

[1,2,3]

for x=2, we want

[4]

ect.

### Error in 2nd Order Coupled Nonlinear ODE System...

April 08 2014
1 5

I'm calculating the geodesics to a parametrized system in R3. When trying to solve the geodesic equations for a surface of revolution, I'm getting a strange error. The goal is to write the code for any parametrized surface, not just revolution (hence I didn't use the short cut for surfaces of revolution).

For the code, I find the first fundamental for, then the geodesics, then turn the christoffel symbols into a time-variant array. (Gamma for the position of (u,v) in the uv-plane, and C as the array so I can take derivatives with respect to time.)

The code for creating the Christoffel Symbols and the parametrization of the paraboloid:

restart; with(LinearAlgebra):
V := (u, v) -> <v*cos(u), v*sin(u), v^2+1>;

Christoff := proc (X)
local x1, x2, M, N, i, j, k, s, E, F, G, g, Q, Delta, Prelim, cyclicPrelim;
global Gamma, C; #GAMMA
x1 := (u, v) -> <diff(X[1], u), diff(X[2], u), diff(X[3], u)>;
x2 := (u, v)-> <(diff(X[1], v), diff(X[2], v), diff(X[3], v))>;
E :=  (u, v) -> DotProduct(x1(u, v), x1(u, v), conjugate = false);
F := (u, v) -> DotProduct(x1(u, v), x2(u, v), conjugate = false);
G := (u, v) -> DotProduct(x2(u, v), x2(u, v), conjugate = false);
simplify([E(u, v), F(u, v), G(u, v)]);
M := (u, v) -> <E(u, v), F(u, v); F(u, v), G(u, v)>;
simplify(M(u,v));
printlevel := 3;
Delta := simplify(Determinant(M(u, v)));
N := (1/Delta)*<G(u, v), -F(u, v); -F(u, v), E(u, v)>;
Q[1] := simplify(map(diff, M(u, v), u));
Q[2] := simplify(map(diff, M(u, v), v));
for i to 2 do for j to 2 do for k to 2 do
Prelim[i, j, k] := Q[k][i, j];
simplify(Prelim[i, j, k] ); end do end do end do;
#(OPTIONAL PRINTOUT) print(Prelim);
for i to 2 do for j to 2 do for k to 2 do
cyclicPrelim[i, j, k] := Prelim[i, j, k]+Prelim[j, k, i]-Prelim[k, i, j] ;
end do end do end do;
#(OPTIONAL PRINTOUT)  print(cyclicPrelim);
for i to 2 do for j to 2 do for k to 2 do
Gamma[i, j, k] := simplify((1/2)*add(N[i, s]*cyclicPrelim[j, s, k], s = 1 .. 2));
end do end do end do;
# for k from 1 to 2 do
#print(GAMMA[i,j,k] = Matrix([[ %a , %a ],[ %a , %a ]]) \n, Gamma[1,1,k], [Gamma[1,2,k], Gamma[2,1,k], Gamma[2,2,k]);
# end do;
#printf('GAMMA[%a,%a,%a] = %a \n', i,j,k, Gamma[i,j,k]);

print([Gamma[1,1,1], Gamma[1,2,1], Gamma[2,1,1], Gamma[2,2,1], Gamma[1,1,2], Gamma[1,2,2], Gamma[2,1,2], Gamma[2,2,2]]);

for i from 1 to 2 do
for j from 1 to 2 do
for k from 1 to 2 do
C[i,j,k]:= apply(Gamma[i,j,k],t);
end do end do end do;
C:=Array(1..2,1..2,1..2,[ [ [ apply(Gamma[1,1,1],t), apply(Gamma[1,2,1],t) ], [ apply(Gamma[1,1,2],t), apply(Gamma[1,2,2],t) ] ], [ [ apply(Gamma[2,1,1],t), apply(Gamma[2,2,1],t) ],  [ apply(Gamma[2,1,2],t), apply(Gamma[2,2,2],t) ] ] ]);
print(C);

end proc;

The differential equation solver:

inits:=[u(0)=1, D(u(t))(0)=1,v(0) = 1, D(v(t))(0)=1];

sys1:= [D[1$2](u(t))+C[1,1,1]*(D(u(t)))^(2)+2*C[1,1,2]*(D(u(t)))*(D(v(t)))+C[1,2,2]*(D(v(t)))^2=0, D[1$2](v(t))+C[2,1,1]*(D(u(t)))^(2)+2*C[2,1,2]*(D(u(t))*D(v(t)))^(2)+C[2,2,2]*(D(v(t)))^2=0];

L:=dsolve({sys1} union {inits});

The error message that comes up is:

"Error, (in unknown) invalid input: op expects 1 or 2 arguments, but received 0"

Any help would be greatly appreciated.

### How to take away each element in a Vector in turn...

April 08 2014
0 3

Hi say I have the vector V1.

V1:=Vector([a,b,c,d,e,f,g]):

and function myfun.

how do i use it as the input to the function my fun, by taking away each element in turn?
myfun(V1[2..]);              # 1st element removed
myfun(V1[[1,3..]]);         # 2nd element removed
myfun(V1[[1,2,4..]]);      # 3rd element removed

and so go

is there a more efficient way?

Many thanks,

### How to calculate the rms deviation from the mean o...

April 08 2014
0 13

Hi everybody,

I have never done statistics in Maple.  In a simple calculation, I need to calculate the RMS of 55 numbers.  The average of those numbers is 100484.3 and it is given that the RMS is 1.28 counts.  I have the a list of the 55 numbers.  Since I don't need a demonstration, it would help me a lot if you could tell me how to load the data from a *.txt file (one number per line), and use the appropriate commands to obtaine the result that is only given.

For the moment, I only need the steps to proceed with the calculations and how to do it in Maple.

--------------------------------------
Mario Lemelin
Maple 18 Ubuntu 13.10 - 64 bitsMaple 18 Win 7 -  64 bits
messagerie : mario.lemelin@cgocable.ca
téléphone :  (819) 376-0987

### Error, (in dsolve/numeric/bvp/convertsys) unable t...

April 08 2014
0 13

i am trying to solve 6 ODE with boundary condition

 (1)

 (2)

 (3)

 (4)

 (5)

 (6)

 (7)

 (8)

 (9)

 (10)

 (11)

 (12)

 (13)

 (14)

 (15)

 (16)

 (17)

 (18)

 (19)

 (20)

 (1)

 (2)

 (3)

 (4)

 (5)

 (6)

 (7)

 (8)

 (9)

 (10)

 (11)

 (12)

 (13)

 (14)

 (15)

 (16)

 (17)

 (18)

 (19)

 (20)

then i get this error

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system

i dont know where i need to change after view it one by one..

### Linear of Equations.......

April 07 2014
0 1

Hi:

i will linear the system of nonlinear ODE second order with maple,how to do it?

### Need to solve system of PDEs...

April 07 2014
2 9

Hi, everyone!

I need help.

There are a system of 2 pde's:

diff(Y(x, t), x$2) = exp(-2*x*b)*(A(x, t)-Y(x, t)), diff(A(x, t), t) = exp(-2*x*b)*(Y(x, t)-A(x, t)) and initial and boundary conditions: A(x, 0) = 0, Y(0, t) = 0.1, (D[1](Y))(0, t) = 0. Goal: For each b = 0, 0.05, 0.1. 1)to plot 3-d Y(x,t): 0<=x<=20,0<=t<=7. 2)to plot Y(x,4). Are there any methods with no finite-difference mesh? I realized the methods such as pds1 := pdsolve(sys, ibc, numeric, time = t, range = 0 .. 7) can't help me: Error, (in pdsolve/numeric/match_PDEs_BCs) cannot handle systems with multiple PDE describing the time dependence of the same dependent variable, or having no time dependence I found something, that can solve my system analytically: pds := pdsolve(sys), where sys - my system without initial and boundary conditions. At the end of the output: huge monster, consisted of symbols and numbers :) And I couldn't affiliate init-bound conditions to it. I use Maple 13. ### Maple LaTeX font consistency... April 07 2014 2 4 Dear Mapleprimes, I have been struggling with a problem in the last couple of days. I wish to export a Maple plot to LaTeX while ensuring font consistency. While searching for solutions online, I found the psfrag package in LaTeX. So far, however, I have been unsuccesful in making this work. As as test, I attempted to export plot(x^2) to LaTeX. I used the following code to convert to .eps which worked fine: plotsetup(ps, plotoutput = plot1.eps, plotoptions = portrait, noborder,height=5in,width=5in);plot(x^2); Then in LaTeX, I have: \documentclass{article} \usepackage{graphicx} \usepackage{psfrag} \begin{document} \begin{figure}[!h] \centering \psfrag{x}{$ \alpha $} \includegraphics[scale=0.5]{plot1.eps} \end{figure} \end{document} However, no replacements are made. After intense Google searching I found the following post http://www.mapleprimes.com/posts/43255-Trouble-Replacing-Maple-Axes-Labels which to sum up argues that this was only possible with earlier versions of Maple. Does anyone know if the problem has been resolved? Does anyone know any other ways to ensure font consistency for plots imported from Maple to LaTeX? Thank you very much in advance! C ### Exporting plot data... April 07 2014 1 5 Ok I dont think I provided enough data last I asked this and as a result I am still stuck so here goes; I have data in 4 matrices describing a wave going from one medium to another, the incident wave transmission and reflection coefficients (F1), the exiting waves transmittance and reflection coefficients (F2) and the propagating waves in each medium (P1 and P2). All this boils down to 4 matrices with data. The propagating wave and incident wave vectors are summed and square rooted and the Real parts defined as cos_phi[i] for increasing k which the 4 matrices before are defined by. I plotted the results as cos_bloch_phase1 using pointplot and the sequence of values of k versus cos_phi. Then displayed cos_bloch_phase1,plot... etc What I am struggling to figure out is how to export the data that is plotted in cos_bloch_phase1. I have copied and pasted my code in its entirety of which a further plot is included but can be ignored as they are constructed similarly; restart; with(plots): with(linalg): matrix elements for the first interface incident parameters theta0:=89*Pi/180; k_min:=0.0; k_max:=25; number_of_points:=1000; step:=(k_max-k_min)/number_of_points; 1000 0.02500000000 parameters of a binary crystal n1:=1.46; n2:=4.6; d1:=0.1; d2:=0.1; 1.46 4.6 0.1 0.1 for i from 0 by 1 to number_of_points do k[i]:=k_min+i*step; theta1:=evalf(arcsin(n0*sin(theta0)/n1)); theta2:=evalf(arcsin(n0*sin(theta0)/n2)); q1:=k[i]*n1*cos(theta1); q2:=k[i]*n2*cos(theta2); F1:=Matrix([[(q1+q2)/(2*q1),(q1-q2)/(2*q1)],[(q1-q2)/(2*q1),(q1+q2)/(2*q1)]]); F2:=Matrix([[(q2+q1)/(2*q2),(q2-q1)/(2*q2)],[(q2-q1)/(2*q2),(q2+q1)/(2*q2)]]); P1:=Matrix([[exp(-I*q1*d1),0],[0,exp(I*q1*d1)]]); P2:=Matrix([[exp(-I*q2*d2),0],[0,exp(I*q2*d2)]]); M_period:=multiply(P1, F1, P2, F2); cos_phi[i]:=Re(1/2*(M_period[1,1]+M_period[2,2])); end: cos_bloch_phase1:=pointplot([seq([k[i],cos_phi[i]],i=0..number_of_points)],connect=true): display(cos_bloch_phase1,plot([1,-1],x=0..k_max,color=[red,red])); for i from 0 by 1 to number_of_points do k[i]:=k_min+i*step; theta1:=evalf(arcsin(n0*sin(theta0)/n1)); theta2:=evalf(arcsin(n0*sin(theta0)/n2)); q1:=k[i]*n1*cos(theta1); q2:=k[i]*n2*cos(theta2); F1p:=Matrix([[(q1/n1^2+q2/n2^2)/(2*q1/n1^2),(q1/n1^2-q2/n2^2)/(2*q1/n1^2)],[(q1/n1^2-q2/n2^2)/(2*q1/n1^2),(q1/n1^2+q2/n2^2)/(2*q1/n1^2)]]); F2p:=Matrix([[(q2/n2^2+q1/n1^2)/(2*q2/n2^2),(q2/n2^2-q1/n1^2)/(2*q2/n2^2)],[(q2/n2^2-q1/n1^2)/(2*q2/n2^2),(q2/n2^2+q1/n1^2)/(2*q2/n2^2)]]); P1p:=Matrix([[exp(-I*q1*d1),0],[0,exp(I*q1*d1)]]); P2p:=Matrix([[exp(-I*q2*d2),0],[0,exp(I*q2*d2)]]); Mp_period:=multiply(P1p, F1p, P2p, F2p); cos_phi2[i]:=Re(1/2*(Mp_period[1,1]+Mp_period[2,2])); end: cos_bloch_phase2:=pointplot([seq([k[i],cos_phi2[i]],i=0..number_of_points)],connect=true): display(cos_bloch_phase2,plot([1,-1],x=0..k_max,color=[red,red])); display(cos_bloch_phase2,cos_bloch_phase1,plot([1,-1],x=0..k_max+5,color=[red,red])); ### Difficult system of PDEs... April 07 2014 1 5 Is it possible to solve (numerically or symbolically) the system of PDEs sys:={diff(Y(x, t), x$2) = exp(-2*x*b)*(A(x, t)-Y(x, t)), diff(A(x, t), t) = exp(-2*x*b)*(Y(x, t)-A(x, t)) }
under the conditions
ibc:={A(x, 0) = 0, Y(0, t) = 0.1, D[1](Y)(0, t) = 0},
where the parameter b takes the values 0,0.05,0.1, in Maple? The ranges are t=0..7, x=0..20.

### how to force the maple to outputs numeric value? e...

April 07 2014
2 6

my codes list below.note the last line of the codes.evalf is not effective? the output is a long expression. how to force the maple to evaluate the long expression into a numeric value?

--------------------codes---------------------

restart:
with(Tolerances):
ALL := [\$(1 .. 3)]:
solution_k := simplify(solve(map(proc (i) options operator, arrow:
1/k[i] = (cos(Phi)*(x[i]-Tx)+sin(Phi)*(y[i]-Ty))/(-sin(Phi)*(x[i]-Tx)+cos(Phi)*(y[i]-Ty)) end proc, ALL), [Tx, Ty, Phi]), size):
assign(solution_k):
k := map(proc (i) options operator, arrow:
tan(phi[i]) end proc, ALL):
deg2rad := Tolerances:-*(Pi, Tolerances:-^(180, Tolerances:--(1))):
phi0[1] := Tolerances:-*(Pi, Tolerances:-^(3, Tolerances:--(1))):
phi0[2] := Pi:
phi0[3] := Tolerances:--(Tolerances:-*(Pi, Tolerances:-^(3, Tolerances:--(1)))):
alpha := Tolerances:-*(Pi, Tolerances:-^(10, Tolerances:--(1))):
L := 1:
phi := phi0:
x := map(proc (i) options operator, arrow:
cos(phi0[i]+alpha)*L end proc, ALL):
y := map(proc (i) options operator, arrow:
sin(phi0[i]+alpha)*L end proc, ALL):
angleError := Tolerances:-&+-(0, Tolerances:-^(10, -4)):
locError := Tolerances:-&+-(0, Tolerances:-^(10, -4)):
phi := map(proc (i) options operator, arrow:
phi[i]+angleError end proc, ALL):
x := map(proc (i) options operator, arrow:
x[i]+locError end proc, ALL):
y := map(proc (i) options operator, arrow:
y[i]+locError end proc, ALL):
evalf(Phi)

-----------------------------outputs--------------------

### equations to Maple...

April 07 2014
1 3
1. How can I represent the following in Maple?

(1) B(t+1) = B(t)+X (t,t+1)–D(t,t+1)

(2) T(t+1) =(m +1)/m(X(t,t+1)+X(t–1,t)+…+X (t–m+1,t–m+2))

### How to find the constants of integration?...

April 07 2014
0 7

restart:assume(M>0);

Eq1 := diff(psi(y), y, y, y, y)-M*(diff(psi(y), y, y))-Gr*b*y = 0;

bcs1:=psi(0)=0,(D@@2)(psi)(0)=0,psi(h)=-F/2,D(psi)(h)=A;

res1:=(dsolve(Eq1));

res2:=(dsolve({Eq1,bcs1},psi(y)));

match(rhs(res2)=rhs(res1),y,s);

s:

C3:=eval(_C3, s);

I am unable to find the constants. Anyway around this?

### Error, (in dsolve/numeric/bvp/convertsys) unable t...

April 06 2014
2 12

i am solving 4 ODE with boundary condition..

> restart;
> with*plots;

then i got this error..

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system

i dont know where i need to change.. could you help me..

 3 4 5 6 7 8 9 Last Page 5 of 993
﻿