MaplePrimes Questions

Is there a way to specify different colors for different output variables? For example, if x,y, and z appear in the entire document as variables, I want x to be red, y to be blue, and z to be green whenever an output is displayed.

Thanks

hi..how i can rewrite section of this code as another form i,e ''for section''

I have a lot of line as this and runnig cise is time consuming.

is there another way to write this section in order to the runtime of the program is reduced??

thanks

for.mw
 

restart;

with(LinearAlgebra):

with(VectorCalculus):

#Digits:=5:
k:=6:

l:=0:

h:=1:

m:=4:

n:=4:

l1:=2*h:

l2:=2*h:

N:=0.5:

nu:=.3:

E_m:=70e9:

E_c:=380e9:

rho_m:=2702:

rho_c:=3800:

lambda_m:=nu*E_m/((1+nu)*(1-2*nu)):

lambda_c:=nu*E_c/((1+nu)*(1-2*nu)):

mu_m:=E_m/(2*(1+nu)):

mu_c:=E_c/(2*(1+nu)):

with(orthopoly):

for i from 0 to 5 do:
L(i):=sqrt((2*i+1)/2)*P(i,z):
end do:

Z:=rho_m+(rho_c-rho_m)*((1/2)+(z/h))^N;

2702+1098*(1/2+z)^.5

(1)

U:=lambda_m+(lambda_c-lambda_m)*((1/2)+(z/h))^N;

0.4038461538e11+0.1788461538e12*(1/2+z)^.5

(2)

S:=mu_m+(mu_c-mu_m)*((1/2)+(z/h))^N;

0.2692307692e11+0.1192307692e12*(1/2+z)^.5

(3)

d:=Matrix([[0,0,0,0,0,0,0,0],[sqrt(3),0,0,0,0,0,0,0],[0,sqrt(15),0,0,0,0,0,0],[sqrt(7),0,sqrt(35),0,0,0,0,0],[0,sqrt(27),0,sqrt(63),0,0,0,0],[sqrt(11),0,sqrt(55),0,sqrt(99),0,0,0],[0,sqrt(39),0,sqrt(91),0,sqrt(143),0,0],[sqrt(15),0,sqrt(75),0,sqrt(135),0,sqrt(195),0]]);

d := Matrix(8, 8, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (1, 7) = 0, (1, 8) = 0, (2, 1) = 3^(1/2), (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (3, 1) = 0, (3, 2) = 15^(1/2), (3, 3) = 0, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (3, 7) = 0, (3, 8) = 0, (4, 1) = 7^(1/2), (4, 2) = 0, (4, 3) = 35^(1/2), (4, 4) = 0, (4, 5) = 0, (4, 6) = 0, (4, 7) = 0, (4, 8) = 0, (5, 1) = 0, (5, 2) = 3*3^(1/2), (5, 3) = 0, (5, 4) = 3*7^(1/2), (5, 5) = 0, (5, 6) = 0, (5, 7) = 0, (5, 8) = 0, (6, 1) = 11^(1/2), (6, 2) = 0, (6, 3) = 55^(1/2), (6, 4) = 0, (6, 5) = 3*11^(1/2), (6, 6) = 0, (6, 7) = 0, (6, 8) = 0, (7, 1) = 0, (7, 2) = 39^(1/2), (7, 3) = 0, (7, 4) = 91^(1/2), (7, 5) = 0, (7, 6) = 143^(1/2), (7, 7) = 0, (7, 8) = 0, (8, 1) = 15^(1/2), (8, 2) = 0, (8, 3) = 5*3^(1/2), (8, 4) = 0, (8, 5) = 3*15^(1/2), (8, 6) = 0, (8, 7) = 195^(1/2), (8, 8) = 0})

(4)

``

``

e2 := 0;

0

 

-0.3192307692e12*W(1)+0.4396880662e12*W(3)-0.1474586301e12*W(5)-0.9235575669e11*W(2)+0.1979090105e12*W(4)

(5)

``


 

Download for.mw

 

hi...

how I can dsolve this differential equations. parameter p is unkown.

I want to gain w(x) and u(x) and psi(x) and p.

thanks

sade.mw
 

restart; eq1 := (diff(psi(x), x))^2+(diff(u(x), x)+(8*(1/2))*(diff(w(x), x))^2)((diff(psi(x), x))^2)+3*(diff(w(x), x, x))+5*(diff(w(x), x, x))*(diff(psi(x), x))-7*(diff(u(x), x, x, x)+(8*(1/2))*(diff(w(x), x, x))^2+(3/2)*(diff(w(x), x, x, x))*(diff(w(x), x)))+3 = p

(diff(psi(x), x))^2+(diff(u(x), x))((diff(psi(x), x))^2)+4*(diff(w(x), x))((diff(psi(x), x))^2)^2+3*(diff(diff(w(x), x), x))+5*(diff(diff(w(x), x), x))*(diff(psi(x), x))-7*(diff(diff(diff(u(x), x), x), x))-28*(diff(diff(w(x), x), x))^2-(21/2)*(diff(diff(diff(w(x), x), x), x))*(diff(w(x), x))+3 = p

(1)

eq2 := (51-31)(diff(psi(x), x, x))+(52-2)(diff(w(x), x, x, x))+8*(diff(psi(x), x, x, x, x))-7*(diff(w(x), x)-psi(x)) = 0

70+8*(diff(diff(diff(diff(psi(x), x), x), x), x))-7*(diff(w(x), x))+7*psi(x) = 0

(2)

eq3 := 4*(diff(w(x), x, x)-(diff(psi(x), x)))+(23+11)(diff(psi(x), x, x, x))+(14+12)*(diff(w(x), x, x, x, x)) = 0

4*(diff(diff(w(x), x), x))-4*(diff(psi(x), x))+34+26*(diff(diff(diff(diff(w(x), x), x), x), x)) = 0

(3)

dsys3 := {eq1, eq2, eq3, psi(0) = 0, psi(1) = 0, u(0) = 0, u(1) = 0, w(0) = 0, w(1) = 0, ((D@@1)(psi))(0) = 0, ((D@@1)(psi))(1) = 0, ((D@@1)(w))(0) = 0, ((D@@1)(w))(1) = 0}; dsol5 := dsolve(dsys3, 'maxmesh' = 1200, numeric, abserr = .1, output = array([.5]))

Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 12, got 10

 

dsolve({eq2, eq3}, {psi(x), w(x)}):

with(PDEtools, casesplit, declare);

[casesplit, declare]

(4)

 


 

Download sade.mw

 

hi...

how i can dsolve this differential equations and obtain w(x) and U(x) and phi(x) analytical or numerically?

thanks

zah.mw
 

``

restart; L := 100; h := 1; eq1 := 1130*(diff(U(x), x, x))+1130*(diff(W(x), x))*(diff(W(x), x, x))+1130*(diff(U(x), x, x, x, x))

1130*(diff(diff(U(x), x), x))+1130*(diff(W(x), x))*(diff(diff(W(x), x), x))+1130*(diff(diff(diff(diff(U(x), x), x), x), x))

(1)

eq2 := 1130*(diff(W(x), x))*(diff(U(x), x, x)+(diff(W(x), x))*(diff(W(x), x, x)))+(diff(W(x), x, x))*(1130*(diff(U(x), x))+565*(diff(W(x), x))^2-2.2*(int(diff(varphi(z), z), z = -5/2 .. 5/2)))+(14125/6)*(diff(W(x), x, x, x, x, x, x))+(10405/6)*(diff(W(x), x, x, x, x))+10

1130*(diff(W(x), x))*(diff(diff(U(x), x), x)+(diff(W(x), x))*(diff(diff(W(x), x), x)))+(diff(diff(W(x), x), x))*(1130*(diff(U(x), x))+565*(diff(W(x), x))^2-2.2*(int(diff(varphi(z), z), z = -5/2 .. 5/2)))+(14125/6)*(diff(diff(diff(diff(diff(diff(W(x), x), x), x), x), x), x))+(10405/6)*(diff(diff(diff(diff(W(x), x), x), x), x))+10

(2)

eq3 := diff(varphi(z), z, z)-.35*(diff(W(x), x, x))

diff(diff(varphi(z), z), z)-.35*(diff(diff(W(x), x), x))

(3)

dsys3 := {eq1, eq2, eq3, U(0) = 0, U(L) = 0, W(0) = 0, W(L) = 0, `ϕ`(-(1/2)*h) = 0, `ϕ`(-(1/2)*h) = 2, ((D@@1)(W))(0) = 0, ((D@@1)(W))(L) = 0, ((D@@2)(W))(0) = 0, ((D@@2)(W))(L) = 0}; dsol5 := dsolve(dsys3, 'maxmesh' = 1200, numeric, abserr = .1, output = array([.5]))

Error, (in dsolve/numeric/process_input) input system must be an ODE system, got independent variables {x, z}

 

``


 

Download zah.mw

 

> {w = -4*mu, a[-1] = -12*mu/(a+b), a[0] = a[0], a[1] = 0, b[-1] = 0, b[0] = 0, b[1] = 0};
  /                     12 mu                                              
 { w = -4 mu, a[-1] = - -----, a[0] = a[0], a[1] = 0, b[-1] = 0, b[0] = 0,
  \                     a + b                                              

           \
   b[1] = 0 }
           /
> restart;
>
> w := -4*mu;
                                    -4 mu
> a[-1] := -12*mu/(a+b);
                                     12 mu
                                   - -----
                                     a + b
> a[0] := a[0];
                                    a[0]
> a[1] := 0;
                                      0
> b[-1] := 0;
                                      0
> b[0] := 0;
                                      0
> b[1] := 0;
                                      0
> xi := x+w*t;
                                 x - 4 mu t
> P := sqrt(mu)*tan(A-sqrt(mu)*xi);
                      (1/2)    /      (1/2)             \
                    mu      tan\A - mu      (x - 4 mu t)/
> u := a[0]+a[1]*P/(1+lambda*P)+a[-1]*(1+lambda*P)/P+b[0]*sqrt(sigma*(1+P^2/mu))/P+b[1]*sqrt(sigma*(1+P^2/mu))+b[-1]*sqrt(sigma*(1+P^2/mu))/P^2;
                (1/2) /             (1/2)    /      (1/2)             \\
           12 mu      \1 + lambda mu      tan\A - mu      (x - 4 mu t)//
    a[0] - -------------------------------------------------------------
                                  /      (1/2)             \            
                       (a + b) tan\A - mu      (x - 4 mu t)/            
> Diff(u, x, t)+a*(Diff(u, x))*(Diff(u, x, y))+b*(Diff(u, `$`(x, 2)))*(Diff(u, y))+Diff(u, `$`(x, 3), y);
/   2   /            (1/2) /             (1/2)    /      (1/2)             \\\
|  d    |       12 mu      \1 + lambda mu      tan\A - mu      (x - 4 mu t)//|
|------ |a[0] - -------------------------------------------------------------|
| dt dx |                              /      (1/2)             \            |
\       \                   (a + b) tan\A - mu      (x - 4 mu t)/            /

  \     /    /    
  |     | d  |    
  | + a |--- |a[0]
  |     | dx |    
  /     \    \    

          (1/2) /             (1/2)    /      (1/2)             \\\\ /   2   /
     12 mu      \1 + lambda mu      tan\A - mu      (x - 4 mu t)//|| |  d    |
   - -------------------------------------------------------------|| |------ |
                            /      (1/2)             \            || | dy dx |
                 (a + b) tan\A - mu      (x - 4 mu t)/            // \       \

              (1/2) /             (1/2)    /      (1/2)             \\\\     /
         12 mu      \1 + lambda mu      tan\A - mu      (x - 4 mu t)//||     |
  a[0] - -------------------------------------------------------------|| + b |
                                /      (1/2)             \            ||     |
                     (a + b) tan\A - mu      (x - 4 mu t)/            //     \

   2 /            (1/2) /             (1/2)    /      (1/2)             \\\\ /
  d  |       12 mu      \1 + lambda mu      tan\A - mu      (x - 4 mu t)//|| |
  -- |a[0] - -------------------------------------------------------------|| |
     |                              /      (1/2)             \            || |
     \                   (a + b) tan\A - mu      (x - 4 mu t)/            // \

      /            (1/2) /             (1/2)    /      (1/2)             \\\\
   d  |       12 mu      \1 + lambda mu      tan\A - mu      (x - 4 mu t)//||
  --- |a[0] - -------------------------------------------------------------||
   dy |                              /      (1/2)             \            ||
      \                   (a + b) tan\A - mu      (x - 4 mu t)/            //

     / 4 /            (1/2) /             (1/2)    /      (1/2)             \\
     |d  |       12 mu      \1 + lambda mu      tan\A - mu      (x - 4 mu t)//
   + |-- |a[0] - -------------------------------------------------------------
     |   |                              /      (1/2)             \            
     \   \                   (a + b) tan\A - mu      (x - 4 mu t)/            

  \\
  ||
  ||
  ||
  //
> value(%);
                       /                                 2\
              3        |       /      (1/2)             \ |
         96 mu  lambda \1 + tan\A - mu      (x - 4 mu t)/ /
         --------------------------------------------------
                               a + b                       

                                                                2   
                            /                                 2\    
                   3        |       /      (1/2)             \ |    
              96 mu  lambda \1 + tan\A - mu      (x - 4 mu t)/ /    
            - --------------------------------------------------- +
                                                         2          
                               /      (1/2)             \           
                    (a + b) tan\A - mu      (x - 4 mu t)/           

                                                  /             
                                                  |             
                             1                    |     (5/2) /
           -------------------------------------- \96 mu      \1
                                                3               
                      /      (1/2)             \                
           (a + b) tan\A - mu      (x - 4 mu t)/                

                       (1/2)    /      (1/2)             \\
            + lambda mu      tan\A - mu      (x - 4 mu t)//

                                               2\   
           /                                 2\ |   
           |       /      (1/2)             \ | |   
           \1 + tan\A - mu      (x - 4 mu t)/ / / -

                                                 /             
                             1                   |     (5/2) /
           ------------------------------------- \96 mu      \1
                      /      (1/2)             \               
           (a + b) tan\A - mu      (x - 4 mu t)/               

                                                            /
                       (1/2)    /      (1/2)             \\ |
            + lambda mu      tan\A - mu      (x - 4 mu t)// \1

                                           2\\
                 /      (1/2)             \ ||
            + tan\A - mu      (x - 4 mu t)/ //
> simplify(%);
Error, (in simplify/tools/_zn) too many levels of recursion
>

 

hi every one, i want to plot an indefinite integral  , it is some what complex and maple can not compute the answer, ( but numeric integration can be computed) , but we want to plot the output, what should we do ? tnx for help in advance

corrected.mw

how can we compute wighted norm of a matrix or a vector in maple? 


``

How can I convert the result (2) to equal to the trigonometric identity (kw/s^2)*tanh(a*s/2)?

``

g := kw*piecewise(t < a, t, t < 2*a, 2*a-t)

kw*piecewise(t < a, t, t < 2*a, 2*a-t)

(1)

simplify((int(exp(-s*t)*g, t = 0 .. a)+int(exp(-s*t)*g, t = a .. 2*a))/(1-exp(-2*a*s)))

-(exp(-a*s)-1)*kw/((exp(-a*s)+1)*s^2)

(2)

``


Download trigonometric_id.mw

 

this equation is complicated

how to dsolve for this equation for function f ?

f(t,x,diff(x,t)) - f(t,x,p) - (diff(x,t)-p)*diff(f(t,x,p), p) = tan(t)
 

how to find the contour of time series data? and how to find curvature function of this contour?

In this fuction the maximize is about at t=46 and x=46 but in the plot I look other max at other value, why?because is discontinus fuction?I need not the local max (it is potential energy but I think don't matter)optimization2enerpot.mws

updated:
P := evalm(p2 + c*vector([cos(q1+q2+q3), sin(q1+q2+q3)]));
 
restart:
with(Groebner):
p1 := vector([a*cos(q1), a*sin(q1)]);
p2 := evalm(p1 + b*vector([cos(q1+q2), sin(q1+q2)]));
P := evalm(p2 + c*vector([cos(q1+q2+q3), sin(q1+q2+q3)]));
Pe := map(expand, P);
A := {cos(q1) = c1, sin(q1) =s1, cos(q2)=c2, sin(q2)=s2, cos(q3)=c3, sin(q3)=s3};
P := subs(A, op(Pe));
F1 := [x - P[1], y - P[2], s1^2+c1^2-1, s2^2+c2^2-1, s3^2+c3^2-1 ];
F2 := subs({a=1, b=1, c=1}, F1);
 
g2 := Basis(F2, plex(c3, s3, c2, s2, c1, s1));
LeadingTerm(g2[1], plex(c3, s3, c2, s2, c1, s1));
LeadingTerm(g2[2], plex(c3, s3, c2, s2, c1, s1));
LeadingTerm(g2[3], plex(c3, s3, c2, s2, c1, s1));
LeadingTerm(g2[4], plex(c3, s3, c2, s2, c1, s1));
LeadingTerm(g2[5], plex(c3, s3, c2, s2, c1, s1));
LeadingTerm(g2[6], plex(c3, s3, c2, s2, c1, s1));
LeadingTerm(g2[7], plex(c3, s3, c2, s2, c1, s1));
LeadingTerm(g2[8], plex(c3, s3, c2, s2, c1, s1));
LeadingTerm(g2[9], plex(c3, s3, c2, s2, c1, s1));
 
                                   1, c1
                               2       2    2   2
                           16 y  + 16 x , s1  s2
                                           2
                                 8 x, c1 s2
                                2      2    2  
                             2 y  + 2 x , s1  c2
                                 2 x, c1 c2
                            3            2        
                         2 x  - 2 x + 2 y  x, s2 c2
                                        2
                                   1, c2
                                   2 x, s3
                                    2, c3
originally i think
g2[1], g2[7], g2[9] have single variables c1, c2, c3 respectively
can be used to solve system
 
but without x and y, these equations can not be used
if choose leading term has x and y , but there is no single variable s1 or c1.
 
originally expect solve as follows
g2spec := subs({x=1, y=1/2}, [g2[3],g2[5],g2[6]]);
S1 := [solve([g2spec[1]])];
q1a := evalf(arccos(S1[1]));
q1b := evalf(arccos(S1[2]));
S2 := [solve(subs(s1=S1[1], g2spec[2])), solve(subs(s1=S1[2], g2spec[2])) ];
q2a := evalf(arccos(S2[1]));
q2b := evalf(arccos(S2[2]));
S3 := [solve(subs(s1=S2[1], g2spec[2])), solve(subs(s1=S2[2], g2spec[2])) ];
q2a := evalf(arccos(S3[1]));
q2b := evalf(arccos(S3[2]));
 

I found from this forum that to plot a 2D array of points use can be made of the Maple procedure surfdata.
 

Does anyone have suggestions on how to plot contours in (preferrably) Maple 16 or Maple 17?

I tried the following

Output := Array(-10 .. 10, -10 .. 10, proc (i, j) options operator, arrow; i^2+j^2 end proc):
F := proc (x, y) -> x^2+y^2 end proc:
surfdata(Output, color = F, dimension = 2);

but "the option dimension = 2" is a Maple 18 addition.

Ideally, I would like also to be able to plot contours with options found in the procedure
contourplot

Please illustrate the answer on the example of a simple wave equation, for instance.

I'm wondering if there is an available command that can evaluate the number of terms required to produce a desired outcome.

Specifically, I am interested in determining the probability of a Poisson distribution, given the parameter (mean) value and the probability outcome. I can obtain the desired result using trial and error / brute force, but I am curious to know if there is a more efficient way. 

Suppose that, lambda = 2.6 and the cumulative sum of the probabilities is 95%. I know that I must add the first 6 terms for P(x) in the series (x=0,1, ..,5) to sum to 0.95. Each term ...  P(x=0)= 0.07, P(x=1)=0.19, and so on.

However, how can we know that desired 95% outcome can be determined from the first 5 terms without trial & error?

First 945 946 947 948 949 950 951 Last Page 947 of 2429