mehdi jafari

564 Reputation

13 Badges

7 years, 150 days

MaplePrimes Activity


These are answers submitted by mehdi jafari


restart:
f:=simplify(cosh(t)/(cosh((17/15)*t)+cosh(t)));

(1/2)*cosh(t)/(cosh((1/15)*t)*(32768*cosh((1/15)*t)^16-131072*cosh((1/15)*t)^14+212992*cosh((1/15)*t)^12-180224*cosh((1/15)*t)^10+84480*cosh((1/15)*t)^8-21504*cosh((1/15)*t)^6+2688*cosh((1/15)*t)^4-128*cosh((1/15)*t)^2+1))

(1)

evalf(Int(f, t = 0 .. infinity));

 

 

evalf(int(f, t = 0 .. infinity));

 

 

5.210624833

 

5.210624833

(2)

 

``


Download int.mw

restart:

sort(x+y+z, order = tdeg(z, y, x));

z+y+x

(1)

sort( x+y+z, order = plex(z, y, x));

z+y+x

(2)

 

``

 

Download one_way.mw

 


``

restart;

with(Physics):

        

Setup(mathematicalnotation = true):

Setup(quantumop = {Q,P}, algebrarule = {%AntiCommutator(Q[i], P[k]) = 2*KroneckerDelta[i, k], %Commutator(Q[j], P[k]) = 2*I*(add(LeviCivita[j, k, l]*Q[l], l = 1 .. 3))}):

`* Partial match of  'quantumop' against keyword 'quantumoperators'`

 

`* Partial match of  'algebrarule' against keyword 'algebrarules'`

 

Error, (in Physics:-Setup) multiple definition of algebra rule; received values for %Commutator(Q[j], P[k]) are {rule, 2*Physics:-KroneckerDelta[i, k]}

 

Commutator(Q[1], P[2]);

-2*Physics:-`*`(P[2], Q[1])

(1)

AntiCommutator(Q[1], P[2]);

0

(2)

AntiCommutator(Q[1], P[1]);

2

(3)

Commutator(Q[1], P[1]);

2-2*Physics:-`*`(P[1], Q[1])

(4)

``

``


Download corrected.mw

from maple help page :

userinfo - print useful information to the user

Calling Sequence
userinfo(lev, fn, e1, e2 ... );

• The user must assign a non-negative integer to some of the entries in the global table infolevel before invoking the procedure. If the entry infolevel[all] is a non-negative integer then every userinfo call will print if its level is less than or equal to infolevel[all] .

• Throughout the Maple library userinfo statements have been used with the following conventions:
Level 1: reserved for information that the user must be told.
Level 2,3: general information, including technique or algorithm being used.
Level 4,5: more detailed information about how the problem is being solved


The item infolevel[hints] is initialized to a value 1. Maple sometimes returns unevaluated answers when it does not have enough information to produce an explicit answer (because, for example, such an answer would not be correct over all complex numbers). This facility is intended to report hints as to which further information, given through assume(), would enable Maple return an explicit answer.

actucallyA is, A=0.5+sqrt(3)/2*I .and all (x+y) can simplify from Numerator and denominator of your A and actually A is independent of x and y.

restart

A := (1/2)*(-x-y+sqrt(-3*x^2-6*x*y-3*y^2))/(x+y);

A := (1/2)*(-x-y+(-3*(x+y)^2)^(1/2))/(x+y)

 

x := 10+I;

x := 10+I

y := 10-I

 

A;

-1/2+(1/40)*(-1200)^(1/2)

-.5000000000+.8660254038*I

 

``

x := 10+10*I;

x := 10+10*I

y := 10-I
(10/481-(9/962)*I)*((-20-9*I)+(-957-1080*I)^(1/2))
-.5000000000-.8660254038*I

 

``

x := 10+10*sqrt(I); 1; y := 10-I; 1; A; 1; evalf(%)

x := 10+5*2^(1/2)+(5*I)*2^(1/2)

y := 10-I
(1/2)*((-20+I)-5*2^(1/2)-(5*I)*2^(1/2)+(-3*(20-I+5*2^(1/2)+(5*I)*2^(1/2))^2)^(1/2))/(20-I+5*2^(1/2)+(5*I)*2^(1/2))
-.5000000000-.8660254035*I

 

``


Download correct.mw

in printf u should write everyhting in string , "Ghana Chocolates" . and make local varibales in the procedure. good luck

restart; printf("Factory Simulation: %s\n\n", "Ghana Chocolates"); printf("Chocolate Factory Simulation Project .\n\n"); printf("%5a  %10a  %10a  %10a  %10a  %10a   \n", W, O(t, t+1), B(t), T(t), F(t), R(t)); printf(" ---------------------------------------------------------------------------\n"); initialise := proc (n) local i, t, a, T, R, F, B, O, Q; T := proc (t) options operator, arrow; 250 end proc; R := proc (t) options operator, arrow; 150 end proc; F := proc (t) options operator, arrow; 250 end proc; B := proc (t) options operator, arrow; 50 end proc; for i to n do t := i; if B(t) < F(t) then Ds(t, t+1) := B(t) else Ds(t, t+1) := F(t) end if; M(t, t+1) := 50; O(t, t+1) := 50; P(t, t+1) := 50; if t = 2 then O(t, t+1) := 100 elif t = 3 then O(t, t+1) := 0 end if; P(t, t+1) := T(t)-F(t)+Ds(t, t+1); if R(t) < P(t, t+1) then P(t, t+1) := R(t) elif R(t) < 0 then P(t, t+1) := 0 end if; R(t+1) := R(t)+M(t, t+1)-P(t, t+1); F(t+1) := F(t)+P(t, t+1)-Ds(t, t+1); B(t+1) := B(t)+O(t, t+1)-Ds(t, t+1); R(t) := R(t+1); F(t) := F(t+1); B(t) := B(t+1); for a to t do Q(t, t+1) := O(t, t+1)+O(t-t+a, t-t+a+1) end do; T(t+1) := (t+1)*Q(t, t+1)/t; printf("%5a  %10a  %10a  %10a  %10a  %10a   \n", i, evalf[3](O(t, t+1)), evalf[3](B(t)), evalf[3](T(t)), evalf[3](F(t)), evalf[3](R(t))) end do; printf(" ---------------------------------------------------------------------------\n\n\n"); printf("%5a  %10a  %10a  %10a     \n", W, M(t, t+1), P(t, t+1), Ds(t, t+1)); printf(" ---------------------------------------------------------------------------\n") end proc; initialise(10)

Factory Simulation: Ghana Chocolates


Chocolate Factory Simulation Project .

    W    O(t,t+1)        B(t)        T(t)        F(t)        R(t)   
 ---------------------------------------------------------------------------
    1         50.         50.        250.        250.        150.   
    2        100.        100.        200.        200.        200.   
    3          0.          0.        300.        300.         50.   
    4         50.         50.          0.          0.        400.   
    5         50.        100.        125.        125.        325.   
    6         50.         50.        120.        120.        280.   
    7         50.         50.        117.        117.        283.   
    8         50.         50.        114.        114.        286.   
    9         50.         50.        112.        112.        288.   
   10         50.         50.        111.        111.        289.   
 ---------------------------------------------------------------------------


    W          50      875/18          50     
 ---------------------------------------------------------------------------

 

``

``


Download suppress_warnins.mw

i write a procedure , which M is input for the procedure.


restart:

mat:=proc(M) local A,i,j;A:=Matrix(M,M):
for i to M do
for j to M do
A(i,j):=(psi||1||(i-1))((2*j-1)/(2*m));
od;od;end proc;

proc (M) local A, i, j; A := Matrix(M, M); for i to M do for j to M do A(i, j) := (psi || 1 || (i-1))((1/2)*(2*j-1)/m) end do end do end proc

(1)

mat(3);

Matrix(3, 3, {(1, 1) = psi10((1/2)/m), (1, 2) = psi10((3/2)/m), (1, 3) = psi10((5/2)/m), (2, 1) = psi11((1/2)/m), (2, 2) = psi11((3/2)/m), (2, 3) = psi11((5/2)/m), (3, 1) = psi12((1/2)/m), (3, 2) = psi12((3/2)/m), (3, 3) = psi12((5/2)/m)})

(2)

 

NULL



Download Mat.mw

http://www.mapleprimes.com/questions/201345-Geom3d-Seq-Of-Point--In-R3

NULL

restart:with(plots):

 

Tab := [[0, 0, 0], [1/5, 0, 0], [2/5, 0, 0], [0, 1/5, 0], [1/5, 1/5, 0], [2/5, 1/5, 0], [0, 2/5, 0], [1/5, 2/5, 0], [2/5, 2/5, 0], [0, 0, 1/5], [1/5, 0, 1/5], [2/5, 0, 1/5], [0, 1/5, 1/5], [1/5, 1/5, 1/5], [2/5, 1/5, 1/5], [0, 2/5, 1/5], [1/5, 2/5, 1/5], [2/5, 2/5, 1/5], [0, 0, 2/5], [1/5, 0, 2/5], [2/5, 0, 2/5], [0, 1/5, 2/5], [1/5, 1/5, 2/5], [2/5, 1/5, 2/5], [0, 2/5, 2/5], [1/5, 2/5, 2/5], [2/5, 2/5, 2/5]];

[[0, 0, 0], [1/5, 0, 0], [2/5, 0, 0], [0, 1/5, 0], [1/5, 1/5, 0], [2/5, 1/5, 0], [0, 2/5, 0], [1/5, 2/5, 0], [2/5, 2/5, 0], [0, 0, 1/5], [1/5, 0, 1/5], [2/5, 0, 1/5], [0, 1/5, 1/5], [1/5, 1/5, 1/5], [2/5, 1/5, 1/5], [0, 2/5, 1/5], [1/5, 2/5, 1/5], [2/5, 2/5, 1/5], [0, 0, 2/5], [1/5, 0, 2/5], [2/5, 0, 2/5], [0, 1/5, 2/5], [1/5, 1/5, 2/5], [2/5, 1/5, 2/5], [0, 2/5, 2/5], [1/5, 2/5, 2/5], [2/5, 2/5, 2/5]]

(1)

pointplot3d(Tab,color = magenta,axes = normal, symbol = box);

 

 

NULL


Download plot3d.mw


``

restart:with(plots):

x := [seq]( (1/5)*i,i=0..12);  #  x[i] the x-coordinate

y := [seq]( (1/5)*j,j=0..12); # y[j] the y-coordinate

t := [seq]( (1/5)*k,k=0..12);  #  t[k] the t-coordinate

 

[0, 1/5, 2/5, 3/5, 4/5, 1, 6/5, 7/5, 8/5, 9/5, 2, 11/5, 12/5]

 

[0, 1/5, 2/5, 3/5, 4/5, 1, 6/5, 7/5, 8/5, 9/5, 2, 11/5, 12/5]

 

[0, 1/5, 2/5, 3/5, 4/5, 1, 6/5, 7/5, 8/5, 9/5, 2, 11/5, 12/5]

(1)

listplot3d([x,y,t]);

 

pointplot3d([seq]([op(i,x),op(i,y),op(i,t)],i=1..nops(x)),color = magenta,axes = normal, symbol = box);

 

 

``


Download plot.mw

 

 

restart

Fun := proc (x) options operator, arrow; x^2 end proc;

Fun := proc (x) options operator, arrow; x^2 end proc

 

A := ([seq])(i, i = 1 .. 4);

A := [1, 2, 3, 4]

 

map(Fun, A); 1; op(%)

[1, 4, 9, 16]

1, 4, 9, 16

 

``


Download map.mw


it is for 15 number of data.

maple.mws   

testfile.txt

az u can see from the wroksheet i uploaded, u can solve your problem without your boundary conditions, but with them u can not .
i changed your way of typing , and also changed theta[p] to sigma .
u have write G(10)=-f(10) while you have note assigned f(10):=0 , so never use this . also u have written L:=[0.2]; and i do not know where u have used it in your equations.

dsolve without your boundary take alot of memory and time, so i terminated the process. but your problem,is with your boundary conditions,and actually i do not know ho to correct them. maybe preben alsholm can help. good luck

 

NULL

restart:

fixedparameter := {M = .5, B = .5, theta[r] = -10, L0 = 1, s = .1, Pr = 1}:

Eq1 := eval((1-theta(eta)/theta[r])*(diff(f(eta), eta, eta, eta))+(diff(f(eta), eta, eta))*(diff(theta(eta), eta))/theta[r]+(1-theta(eta)/theta[r])^2*(f(eta)*(diff(f(eta), eta, eta))-(diff(f(eta), eta))^2-M*(diff(f(eta), eta))+B*H(eta)*(F(eta)-(diff(f(eta), eta)))),fixedparameter);

(1+(1/10)*theta(eta))*(diff(diff(diff(f(eta), eta), eta), eta))-(1/10)*(diff(diff(f(eta), eta), eta))*(diff(theta(eta), eta))+(1+(1/10)*theta(eta))^2*(f(eta)*(diff(diff(f(eta), eta), eta))-(diff(f(eta), eta))^2-.5*(diff(f(eta), eta))+.5*H(eta)*(F(eta)-(diff(f(eta), eta))))

(1)

Eq2 := eval(G(eta)*(diff(F(eta), eta))+F(eta)^2+B*(F(eta)-(diff(f(eta), eta))) ,fixedparameter);

G(eta)*(diff(F(eta), eta))+F(eta)^2+.5*F(eta)-.5*(diff(f(eta), eta))

(2)

Eq3 := eval(G(eta)*(diff(G(eta), eta))+B*(f(eta)+G(eta)) ,fixedparameter);

G(eta)*(diff(G(eta), eta))+.5*f(eta)+.5*G(eta)

(3)

Eq4 := eval(G(eta)*(diff(H(eta), eta))+H(eta)*(diff(G(eta), eta))+F(eta)*H(eta),fixedparameter);

G(eta)*(diff(H(eta), eta))+H(eta)*(diff(G(eta), eta))+F(eta)*H(eta)

(4)

Eq5 := eval((1+s*theta(eta))*(diff(theta(eta), eta, eta))+(diff(theta(eta), eta))^2*s+Pr*(f(eta)*(diff(theta(eta), eta))-(diff(f(eta), eta))*theta(eta))+(2/3)*B*H(eta)*(sgima(eta)-theta(eta)),fixedparameter);

(1+.1*theta(eta))*(diff(diff(theta(eta), eta), eta))+.1*(diff(theta(eta), eta))^2+f(eta)*(diff(theta(eta), eta))-(diff(f(eta), eta))*theta(eta)+.3333333333*H(eta)*(sgima(eta)-theta(eta))

(5)

Eq6 := eval(2*F(eta)*sgima(eta)+G(eta)*(diff(sgima(eta), eta))+L0*B*(sgima(eta)-theta(eta)) ,fixedparameter);

2*F(eta)*sgima(eta)+G(eta)*(diff(sgima(eta), eta))+.5*sgima(eta)-.5*theta(eta)

(6)

bcs := {f(0) = 0, (D(f))(0) = 1, (D(f))(10) = 0,F(10) = 0,G(10) = 0,H(10) = n,theta(10) = 0,sgima(10) = 0};

{F(10) = 0, G(10) = 0, H(10) = n, f(0) = 0, sgima(10) = 0, theta(10) = 0, (D(f))(0) = 1, (D(f))(10) = 0}

(7)

L := [0.2]:

 

dsolve({seq(Eq||i,i=1..6)},bcs);dsolve({seq(Eq||i,i=1..6)},bcs,numeric);

Error, (in dsolve) too many arguments; some or all of the following are wrong: [{F(eta), G(eta), H(eta), f(eta), sgima(eta), theta(eta)}, {F(10) = 0, G(10) = 0, H(10) = n, f(0) = 0, sgima(10) = 0, theta(10) = 0, (D(f))(0) = 1, (D(f))(10) = 0}]

 

Error, (in dsolve/numeric/process_input) invalid argument: {F(10) = 0, G(10) = 0, H(10) = n, f(0) = 0, sgima(10) = 0, theta(10) = 0, (D(f))(0) = 1, (D(f))(10) = 0}

 

dsolve({seq(Eq||i,i=1..6)});

#for k to 1 do R := dsolve(eval({Eq10, Eq11, Eq4, Eq7, Eq8, Eq9, bcs1, bcs2, bcs3, bcs4, bcs5, bcs6}, n = L[k]), [f(eta), F(eta), G(eta), H(eta), theta(eta), sgima(eta)], numeric, output = listprocedure); Y || k := rhs(R[5]); YP || k := rhs(R[6]); YJ || k := rhs(R[7]); YS || k := rhs(R[2]) end do

 

NULL

 

Download dsolve.mw


``

Examples

 

with(DynamicSystems)

Example 1: Basic usage

sys1 := [diff(x[1](t), t) = x[2](t)^2-4, diff(x[2](t), t) = x[1](t)-1+u(t), y(t) = x[1](t)+x[2](t)]

sys1 := [diff(x[1](t), t) = x[2](t)^2-4, diff(x[2](t), t) = x[1](t)-1+u(t), y(t) = x[1](t)+x[2](t)]

(1.1)

eq_point1 := EquilibriumPoint(sys1, [u(t)], constraints = [0 < x[1](t)], initialpoint = [u(t) = 0, x[1](t) = 2, x[2](t) = 4])

eq_point1 := [x[1](t) = 1.49999999768708, x[2](t) = -2.00000001053627], [diff(x[1](t), t) = 0.421450963017378e-7, diff(x[2](t), t) = -0.462584648364128e-8], [u(t) = -.500000002312923], [y(t) = -.500000012849197]

(1.2)

lin_point1 := [op(eq_point1[1]), op(eq_point1[3])]

lin_point1 := [x[1](t) = 1.49999999768708, x[2](t) = -2.00000001053627, u(t) = -.500000002312923]

(1.3)

lin_model1a := Linearize(sys1, [u(t)], [y(t)], lin_point1)

"lin_model1a:=[[[`State Space`],[continuous],[`1 output(s); 1 input(s); 2 state(s)`],[inputvariable=[u[1](t)]],[outputvariable=[y[1](t)]],[statevariable=[x[1](t),x[2](t)]]],[[x[1]([t])=x[1]([t])-1.499999998,x[2]([t])=x[2]([t])+2.000000011]],[[u[1]([t])=u([t])+0.500000002312923]],[[y[1]([t])=y([t])+0.5000000130]]"

(1.4)

PrintSystem(lin_model1a[1])

"[[[`State Space`],[continuous],[`1 output(s); 1 input(s); 2 state(s)`],[inputvariable=[u[1](t)]],[outputvariable=[y[1](t)]],[statevariable=[x[1](t),x[2](t)]],[a=[[[0,-4.000000021],[1,0]]]],[b=[[[0],[1]]]],[c=[[[1,1]]]],[d=[[[0]]]]]"

(1.5)

The linearization point lin_point does not give exact zero. Compute linear model for a tighter tolerance

lin_model1b := Linearize(sys1, [u(t)], [y(t)], lin_point1, 'equilibriumtolerance' = 1.*10^(-10))

Warning, linpoint is not an equilibrium point

 

"lin_model1b:=[[[`Diff. Equation`],[continuous],[`1 output(s); 1 input(s)`],[inputvariable=[u[1](t)]],[outputvariable=[y[1](t)]]],[[x[1]([t])=x[1]([t]),x[2]([t])=x[2]([t])]],[[u[1]([t])=u([t])]],[[y[1]([t])=y([t])]]"

(1.6)

PrintSystem(lin_model1b[1])

"[[[`Diff. Equation`],[continuous],[`1 output(s); 1 input(s)`],[inputvariable=[u[1](t)]],[outputvariable=[y[1](t)]],[de={[[[(x[1])(t)=-8.000000042-4.000000021 x[2](t),],[  (x[2])(t)=x[1](t)-1+u[1](t),],[  y[1](t)=x[1](t)+x[2](t)]]]]]"

(1.7)

Disable the checkpoint option for the same setting of the tolerance

lin_model1c := Linearize(sys1, [u(t)], [y(t)], lin_point1, 'equilibriumtolerance' = 1.*10^(-10), 'checkpoint' = false)

"lin_model1c:=[[[`State Space`],[continuous],[`1 output(s); 1 input(s); 2 state(s)`],[inputvariable=[u[1](t)]],[outputvariable=[y[1](t)]],[statevariable=[x[1](t),x[2](t)]]],[[x[1]([t])=x[1]([t])-1.499999998,x[2]([t])=x[2]([t])+2.]],[[u[1]([t])=u([t])+0.499999998]],[[y[1]([t])=y([t])+0.500000002]]"

(1.8)

Example 2: Use of user-defined functions

sys2 := {piecewise(x[1](t)<0, x[1](t), x[2](t) + x[1](t)^2) * piecewise(u(t)<0, cos(y(t)), sin(y(t))) = sin(x[1](t)^2) + 5 * y(t) + diff(x[1](t), t, t), y(t) - x[1](t)^2 + u(t)*x[1](t), diff(x[2](t), t) = f(x[1](t), u(t))};
user_function := [
    f,
    [float, float],
    float,
    proc(x, y)
    local d1, d2;
        d1 := cos(x)+x^2;
        d2 := y*d1 + y^2;
        return d1*x+d2*y- exp(d1);
    end proc
    ];

 

user_function := [f, [float, float], float, proc (x, y) local d1, d2; d1 := cos(x)+x^2; d2 := y*d1+y^2; return d1*x+d2*y-exp(d1) end proc]

(1.9)

eq_point2 := EquilibriumPoint(sys2, [u(t)], functions = [user_function], initialpoint = [x[1](t) = 1, x[2](t) = 1, u(t) = 1])

eq_point2 := [x[1](t) = .853420831346895, x[2](t) = .687832129312234], [diff(x[1](t), `$`(t, 2)) = 0.243748043970982e-8, diff(x[1](t), t) = 0., diff(x[2](t), t) = -0.114152598484907e-8], [u(t) = 1.07055911392119], [y(t) = -.185310333631790]

(1.10)

lin_point2 := [op(eq_point2[1]), op(eq_point2[3])]

lin_point2 := [x[1](t) = .853420831346895, x[2](t) = .687832129312234, u(t) = 1.07055911392119]

(1.11)

lin_model2a := Linearize(sys2, [u(t)], [y(t)], lin_point2, functions = [user_function])

"lin_model2a:=[[[`State Space`],[continuous],[`1 output(s); 1 input(s); 3 state(s)`],[inputvariable=[u[1](t)]],[outputvariable=[y[1](t)]],[statevariable=[x[1](t),x[2](t),x[3](t)]]],[[x[1]([t])=x[1]([t])-0.8534208313,x[2]([t])=diff(x[1]([t])),x[3]([t])=x[2]([t])-0.6878321293]],[[u[1]([t])=u([t])-1.07055911392119]],[[y[1]([t])=y([t])+0.1853103334]]"

(1.12)

PrintSystem(lin_model2a[1])

"[[[`State Space`],[continuous],[`1 output(s); 1 input(s); 3 state(s)`],[inputvariable=[u[1](t)]],[outputvariable=[y[1](t)]],[statevariable=[x[1](t),x[2](t),x[3](t)]],[a=[[[0,1,0],[-3.88404789416651974,0,-0.184251562819176457],[-0.5192123250,0,0]]]],[b=[[[0],[3.07921630860619411],[6.405315917]]]],[c=[[[0.636282549078812876,0,0]]]],[d=[[[-0.8534208313]]]]]"

(1.13)

Example of the statevariable, inputvariable, and outputvariable options

lin_model2b := Linearize(sys2, [u(t)], [y(t)], lin_point2, functions = [user_function], statevariable = XX, inputvariable = UU, outputvariable = YY)

"lin_model2b:=[[[`State Space`],[continuous],[`1 output(s); 1 input(s); 3 state(s)`],[inputvariable=[UU[1](t)]],[outputvariable=[YY[1](t)]],[statevariable=[XX[1](t),XX[2](t),XX[3](t)]]],[[XX[1]([t])=x[1]([t])-0.8534208313,XX[2]([t])=diff(x[1]([t])),XX[3]([t])=x[2]([t])-0.6878321293]],[[UU[1]([t])=u([t])-1.07055911392119]],[[YY[1]([t])=y([t])+0.1853103334]]"

(1.14)

PrintSystem(lin_model2b[1])

"[[[`State Space`],[continuous],[`1 output(s); 1 input(s); 3 state(s)`],[inputvariable=[UU[1](t)]],[outputvariable=[YY[1](t)]],[statevariable=[XX[1](t),XX[2](t),XX[3](t)]],[a=[[[0,1,0],[-3.88404789416651974,0,-0.184251562819176457],[-0.5192123250,0,0]]]],[b=[[[0],[3.07921630860619411],[6.405315917]]]],[c=[[[0.636282549078812876,0,0]]]],[d=[[[-0.8534208313]]]]]"

(1.15)

Example 3: Inverted pendulum on a moving cart

Variables

`#mi("&theta;")`(t)

counter-clockwise angular displacement of the pendulum from the upright position

`#mi("&phi;")`(t)

angular velocity of the pendulum, `#mi("&phi;")`(t) = diff(`#mi("&theta;")`(t), t)

x(t)

position of the cart

y(t)

velocity of the cart, y(t) = diff(x(t), t)

u(t)

horizontal force applied to the cart

 

Parameters

L

half-length of pendulum

m

mass of the pendulum

M

mass of the cart

g

gravitational constant (9.8 m/s^2)

 

sys3 := [diff(x(t), t) = y(t), diff(theta(t), t) = phi(t), diff(y(t), t) = -(-3*cos(theta(t))*sin(theta(t))*g-2*u(t)+2*m*L*sin(theta(t))*phi(t)^2)/(-3*cos(theta(t))*m+2*M+2*m), diff(phi(t), t) = -(3*(-sin(theta(t))*g*M-sin(theta(t))*g*m-m*u(t)+m^2*L*sin(theta(t))*phi(t)^2))/((-3*cos(theta(t))*m+2*M+2*m)*m*L)]

sys3 := [diff(x(t), t) = y(t), diff(theta(t), t) = phi(t), diff(y(t), t) = -(-3*cos(theta(t))*sin(theta(t))*g-2*u(t)+2*m*L*sin(theta(t))*phi(t)^2)/(-3*cos(theta(t))*m+2*M+2*m), diff(phi(t), t) = -3*(-sin(theta(t))*g*M-sin(theta(t))*g*m-m*u(t)+m^2*L*sin(theta(t))*phi(t)^2)/((-3*cos(theta(t))*m+2*M+2*m)*m*L)]

(1.16)

Linearization point is given by:

lin_point3 := [phi(t) = 0, x(t) = 0, y(t) = 0, theta(t) = 0, u(t) = 0]

lin_point3 := [phi(t) = 0, x(t) = 0, y(t) = 0, theta(t) = 0, u(t) = 0]

(1.17)

lin_model3 := Linearize(sys3, [u(t)], [phi(t), x(t), y(t), theta(t)], lin_point3)

"lin_model3:=[[[`State Space`],[continuous],[`4 output(s); 1 input(s); 4 state(s)`],[inputvariable=[u[1](t)]],[outputvariable=[y[1](t),y[2](t),y[3](t),y[4](t)]],[statevariable=[x[1](t),x[2](t),x[3](t),x[4](t)]]],[[x[1]([t])=phi([t]),x[2]([t])=theta([t]),x[3]([t])=x([t]),x[4]([t])=y([t])]],[[u[1]([t])=u([t])]],[[y[1]([t])=phi([t]),y[2]([t])=theta([t]),y[3]([t])=x([t]),y[4]([t])=y([t])]]"

(1.18)

The state-space object given by lin_model3[1] can be used to construct a stabilizing controller using linear control theory.

PrintSystem(lin_model3[1])

"[[[`State Space`],[continuous],[`4 output(s); 1 input(s); 4 state(s)`],[inputvariable=[u[1](t)]],[outputvariable=[y[1](t),y[2](t),y[3](t),y[4](t)]],[statevariable=[x[1](t),x[2](t),x[3](t),x[4](t)]],[a=[[[0,-(3. (-g M-g m))/((-m+2. M) m L),0,0],[1,0,0,0],[0,0,0,1],[0,(3. g)/(-m+2. M),0,0]]]],[b=[[[3./((-m+2. M) L)],[0],[0],[2./(-m+2. M)]]]],[c=[[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]]],[d=[[[0],[0],[0],[0]]]]]"

(1.19)

 

``


Download linearize.mw


restart:

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))};

{diff(A(x, t), t) = exp(-2*x*b)*(Y(x, t)-A(x, t)), diff(diff(Y(x, t), x), x) = exp(-2*x*b)*(A(x, t)-Y(x, t))}

(1)

ans:=pdsolve(sys);

{A(x, t) = -(9/4)*_C3*exp(_c[2]*t)*((8/3)*(((2/3)*I)*b*((exp(x*b))^2*b^2+1)*_c[2]^(5/2)+((2/3)*I)*_c[2]^(3/2)*b^3+(I*_c[2]^(7/2)*b-2*b^4*_c[2]^2-(3/2)*_c[2]^3*b^2+(1/6)*_c[2]^4)*(exp(x*b))^2-(2/3)*(b^2-(1/4)*_c[2])*(b^2+_c[2])*_c[2])*_C2*exp(2*x*b)*hypergeom([(1/2)*(-I*_c[2]^(1/2)+4*b)/b, (1/2)*(-I*_c[2]^(1/2)+4*b)/b], [(2*b-I*_c[2]^(1/2))/b], -_c[2]*exp(2*x*b))-_C2*((I*_c[2]^(9/2)*b-(32/9)*b^4*_c[2]^3-(22/9)*_c[2]^4*b^2+(1/9)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-(1/2)*(I*_c[2]^(1/2)-2*b)/b], [(b-I*_c[2]^(1/2))/b], -_c[2]*exp(2*x*b))+(16/9)*(exp(I*_c[2]^(1/2)*x))^2*_C1*((1/4)*(_c[2]*(exp(x*b))^2+1)*(b^2+_c[2])*exp(-2*x*b)+I*_c[2]^(5/2)*(exp(x*b))^2*b+I*_c[2]^(3/2)*(exp(x*b))^2*b^3+(b^2+_c[2])*_c[2]*(-1/4+(b^2-(1/4)*_c[2])*(exp(x*b))^2))*hypergeom([(1/2)*(2*b+I*_c[2]^(1/2))/b, (1/2)*(2*b+I*_c[2]^(1/2))/b], [(b+I*_c[2]^(1/2))/b], -_c[2]*exp(2*x*b)))/(exp(I*_c[2]^(1/2)*x)*(b+I*_c[2]^(1/2))*(I*_c[2]^(1/2)-b)*exp(-2*x*b)), Y(x, t) = _C3*exp(_c[2]*t)*_C1*hypergeom([(1/2)*(2*b+I*_c[2]^(1/2))/b, (1/2)*(2*b+I*_c[2]^(1/2))/b], [(b+I*_c[2]^(1/2))/b], -_c[2]*exp(2*x*b))*_c[2]*exp(I*_c[2]^(1/2)*x)*(exp(x*b))^2+_C3*exp(_c[2]*t)*_C2*hypergeom([-(1/2)*(I*_c[2]^(1/2)-2*b)/b, -(1/2)*(I*_c[2]^(1/2)-2*b)/b], [-(I*_c[2]^(1/2)-b)/b], -_c[2]*exp(2*x*b))*_c[2]*(exp(x*b))^2/exp(I*_c[2]^(1/2)*x)+_C3*exp(_c[2]*t)*_C1*hypergeom([(1/2)*(2*b+I*_c[2]^(1/2))/b, (1/2)*(2*b+I*_c[2]^(1/2))/b], [(b+I*_c[2]^(1/2))/b], -_c[2]*exp(2*x*b))*exp(I*_c[2]^(1/2)*x)+_C3*exp(_c[2]*t)*_C2*hypergeom([-(1/2)*(I*_c[2]^(1/2)-2*b)/b, -(1/2)*(I*_c[2]^(1/2)-2*b)/b], [-(I*_c[2]^(1/2)-b)/b], -_c[2]*exp(2*x*b))/exp(I*_c[2]^(1/2)*x)}

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1/9)*_c[2]^5)*(exp(x*b))^2+I*_c[2]^(7/2)*b-(1/9)*_c[2]^4+(22/9)*_c[2]^3*b^2+(32/9)*b^4*_c[2]^2)*_C1*(exp(2*x*b))^2*hypergeom([(1/2)*(I*_c[2]^(1/2)+6*b)/b, (1/2)*(I*_c[2]^(1/2)+6*b)/b], [(I*_c[2]^(1/2)+3*b)/b], -_c[2]*exp(2*x*b))-(16/9)*_C2*(-(1/4)*(_c[2]*(exp(x*b))^2+1)*(b^2+_c[2])*exp(-2*x*b)+I*_c[2]^(5/2)*(exp(x*b))^2*b+I*_c[2]^(3/2)*(exp(x*b))^2*b^3-(b^2+_c[2])*_c[2]*(-1/4+(b^2-(1/4)*_c[2])*(exp(x*b))^2))*hypergeom([-(1/2)*(I*_c[2]^(1/2)-2*b)/b, -(1/2)*(I*_c[2]^(1/2)-2*b)/b], [(b-I*_c[2]^(1/2))/b], -_c[2]*exp(2*x*b))+(16/9)*(exp(I*_c[2]^(1/2)*x))^2*_C1*((1/4)*(_c[2]*(exp(x*b))^2+1)*(b^2+_c[2])*exp(-2*x*b)+I*_c[2]^(5/2)*(exp(x*b))^2*b+I*_c[2]^(3/2)*(exp(x*b))^2*b^3+(b^2+_c[2])*_c[2]*(-1/4+(b^2-(1/4)*_c[2])*(exp(x*b))^2))*hypergeom([(1/2)*(2*b+I*_c[2]^(1/2))/b, (1/2)*(2*b+I*_c[2]^(1/2))/b], [(b+I*_c[2]^(1/2))/b], -_c[2]*exp(2*x*b)))/(exp(I*_c[2]^(1/2)*x)*(b+I*_c[2]^(1/2))*(I*_c[2]^(1/2)-b)*exp(-2*x*b))

(3)

# up to here,the answer witouht inital conditons and boundaries #

 

 

 

SYS:={isolate(op(1,sys),Y(x,t)),isolate(op(2,sys),A(x,t))};

{A(x, t) = (diff(diff(Y(x, t), x), x))/exp(-2*x*b)+Y(x, t), Y(x, t) = (diff(A(x, t), t))/exp(-2*x*b)+A(x, t)}

(4)

ibc:={A(x, 0) = 0, Y(0, t) = 0.1, D[1](Y)(0, t) =0};

{A(x, 0) = 0, Y(0, t) = .1, (D[1](Y))(0, t) = 0}

(5)

 

Y(x,t):=(rhs(op(2,SYS)));

(diff(A(x, t), t))/exp(-1.0*x)+A(x, t)

(6)

PDE:=diff(Y(x, t), x$2) = exp(-2*x*b)*(A(x, t)-Y(x, t));pdsolve(PDE);PDEtools[build](op(%));

(diff(diff(diff(A(x, t), t), x), x))/exp(-1.0*x)+2.0*(diff(diff(A(x, t), t), x))/exp(-1.0*x)+1.00*(diff(A(x, t), t))/exp(-1.0*x)+diff(diff(A(x, t), x), x) = -(diff(A(x, t), t))

 

PDESolStruc(A(x, t) = _F1(x)*_F2(t), [{diff(_F2(t), t) = _c[2]*_F2(t), diff(diff(_F1(x), x), x) = (-2.0*(diff(_F1(x), x))*exp(1.0*x)-1.00*_F1(x)*exp(1.0*x)-1.*_F1(x))*_c[2]/(1+exp(1.0*x)*_c[2])}])

 

A(x, t) = _F1(x)*_F2(t)

(7)

# this PDE actually is implification of system of PDEs, i think if u can convert your boundary like this, u can solve numerically your system, but actually i do not know how #

 

 

 


Download pdsolve.mw

 

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); evalr(Phi)

`&plusmn;`(.314, 0.401e-3)

 

NominalValue(%);

(1/2)*arctan(((1/5000+sin((13/30)*Pi)+sin((1/10)*Pi))*tan(1/10000+(1/3)*Pi)-tan(1/10000)*(-1/5000+sin((7/30)*Pi)+sin((13/30)*Pi)-tan(1/10000+(1/3)*Pi)*(1/5000+cos((1/10)*Pi)+cos((7/30)*Pi)))+tan(1/10000+(1/3)*Pi)*(1/5000+sin((1/10)*Pi)-sin((7/30)*Pi)-tan(1/10000+(1/3)*Pi)*(-1/5000-cos((7/30)*Pi)+cos((13/30)*Pi))-tan(1/10000)*(-1/5000-cos((1/10)*Pi)-cos((13/30)*Pi))))/((-1/5000+cos((13/30)*Pi)+cos((1/10)*Pi))*tan(-1/10000+(1/3)*Pi)+tan(1/10000)*(-1/5000-cos((7/30)*Pi)+cos((13/30)*Pi)-tan(1/10000+(1/3)*Pi)*(1/5000-sin((1/10)*Pi)+sin((7/30)*Pi)))+tan(-1/10000+(1/3)*Pi)*(-1/5000+cos((1/10)*Pi)+cos((7/30)*Pi)-tan(-1/10000+(1/3)*Pi)*(1/5000-sin((7/30)*Pi)-sin((13/30)*Pi))-tan(1/10000)*(1/5000+sin((13/30)*Pi)+sin((1/10)*Pi)))))+(1/2)*arctan(((-1/5000+sin((13/30)*Pi)+sin((1/10)*Pi))*tan(-1/10000+(1/3)*Pi)+tan(1/10000)*(-1/5000+sin((7/30)*Pi)+sin((13/30)*Pi)-tan(1/10000+(1/3)*Pi)*(1/5000+cos((1/10)*Pi)+cos((7/30)*Pi)))+tan(-1/10000+(1/3)*Pi)*(-1/5000+sin((1/10)*Pi)-sin((7/30)*Pi)-tan(-1/10000+(1/3)*Pi)*(1/5000-cos((7/30)*Pi)+cos((13/30)*Pi))+tan(1/10000)*(-1/5000-cos((1/10)*Pi)-cos((13/30)*Pi))))/((1/5000+cos((13/30)*Pi)+cos((1/10)*Pi))*tan(1/10000+(1/3)*Pi)-tan(1/10000)*(-1/5000-cos((7/30)*Pi)+cos((13/30)*Pi)-tan(1/10000+(1/3)*Pi)*(1/5000-sin((1/10)*Pi)+sin((7/30)*Pi)))+tan(1/10000+(1/3)*Pi)*(1/5000+cos((1/10)*Pi)+cos((7/30)*Pi)-tan(1/10000+(1/3)*Pi)*(-1/5000-sin((7/30)*Pi)-sin((13/30)*Pi))+tan(1/10000)*(1/5000+sin((13/30)*Pi)+sin((1/10)*Pi)))))

.3141594479

 

ToleranceValue(`%%%`);

(1/2)*arctan(((-1/5000+sin((13/30)*Pi)+sin((1/10)*Pi))*tan(-1/10000+(1/3)*Pi)+tan(1/10000)*(-1/5000+sin((7/30)*Pi)+sin((13/30)*Pi)-tan(1/10000+(1/3)*Pi)*(1/5000+cos((1/10)*Pi)+cos((7/30)*Pi)))+tan(-1/10000+(1/3)*Pi)*(-1/5000+sin((1/10)*Pi)-sin((7/30)*Pi)-tan(-1/10000+(1/3)*Pi)*(1/5000-cos((7/30)*Pi)+cos((13/30)*Pi))+tan(1/10000)*(-1/5000-cos((1/10)*Pi)-cos((13/30)*Pi))))/((1/5000+cos((13/30)*Pi)+cos((1/10)*Pi))*tan(1/10000+(1/3)*Pi)-tan(1/10000)*(-1/5000-cos((7/30)*Pi)+cos((13/30)*Pi)-tan(1/10000+(1/3)*Pi)*(1/5000-sin((1/10)*Pi)+sin((7/30)*Pi)))+tan(1/10000+(1/3)*Pi)*(1/5000+cos((1/10)*Pi)+cos((7/30)*Pi)-tan(1/10000+(1/3)*Pi)*(-1/5000-sin((7/30)*Pi)-sin((13/30)*Pi))+tan(1/10000)*(1/5000+sin((13/30)*Pi)+sin((1/10)*Pi)))))-(1/2)*arctan(((1/5000+sin((13/30)*Pi)+sin((1/10)*Pi))*tan(1/10000+(1/3)*Pi)-tan(1/10000)*(-1/5000+sin((7/30)*Pi)+sin((13/30)*Pi)-tan(1/10000+(1/3)*Pi)*(1/5000+cos((1/10)*Pi)+cos((7/30)*Pi)))+tan(1/10000+(1/3)*Pi)*(1/5000+sin((1/10)*Pi)-sin((7/30)*Pi)-tan(1/10000+(1/3)*Pi)*(-1/5000-cos((7/30)*Pi)+cos((13/30)*Pi))-tan(1/10000)*(-1/5000-cos((1/10)*Pi)-cos((13/30)*Pi))))/((-1/5000+cos((13/30)*Pi)+cos((1/10)*Pi))*tan(-1/10000+(1/3)*Pi)+tan(1/10000)*(-1/5000-cos((7/30)*Pi)+cos((13/30)*Pi)-tan(1/10000+(1/3)*Pi)*(1/5000-sin((1/10)*Pi)+sin((7/30)*Pi)))+tan(-1/10000+(1/3)*Pi)*(-1/5000+cos((1/10)*Pi)+cos((7/30)*Pi)-tan(-1/10000+(1/3)*Pi)*(1/5000-sin((7/30)*Pi)-sin((13/30)*Pi))-tan(1/10000)*(1/5000+sin((13/30)*Pi)+sin((1/10)*Pi)))))

-0.4006133e-3

 

``


Download evalr.mw

4 5 6 7 8 9 Page 6 of 9