Advertisement
Nikitka_36

Untitled

Apr 23rd, 2015
2,513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. > restart;
  2. > eq := diff(u(x, t), x, x)-(diff(u(x, t), t, t))/v^2 = 0;
  3. print(`output redirected...`); # input placeholder
  4.                                  d  / d         \    
  5.                                 --- |--- u(x, t)|    
  6.           / d  / d         \\    dt \ dt        /    
  7.           |--- |--- u(x, t)|| - ----------------- = 0
  8.           \ dx \ dx        //           2            
  9.                                        v            
  10. > phi1(x) := piecewise(0<=x and x<l-epsilon, 0, l-epsilon  <=x and x<=l, P/rho/epsilon/S);  ;
  11. print(`output redirected...`); # input placeholder
  12.                        /                              
  13.          x -> piecewise|0 <= x and x < l - epsilon, 0,
  14.                        \                              
  15.  
  16.                                               P      \
  17.            l - epsilon <= x and x <= l, -------------|
  18.                                         rho epsilon S/
  19. > phi2(x) := 2*P/rho/S*Dirac(l-x);
  20. print(`output redirected...`); # input placeholder
  21.      2 P Dirac(l - x)
  22. x -> ----------------
  23.           rho S      
  24. > subs(u(x, t) = X(x)*T(t), eq); expand(lhs(%)/(X(x)*T(t))) = 0;
  25. print(`output redirected...`); # input placeholder
  26.                d  / d      \    d  / d      \    
  27.               --- |--- X(x)|   --- |--- T(t)|    
  28.                dx \ dx     /    dt \ dt     /    
  29.               -------------- - -------------- = 0
  30.                    X(x)                 2        
  31.                                   T(t) v        
  32. > s1 := op(1, lhs(%)) = -lambda^2; s2 := op(2, lhs(`%%`)) = lambda^2;
  33. print(`output redirected...`); # input placeholder
  34.                     d  / d      \          
  35.                    --- |--- X(x)|          
  36.                     dx \ dx     /          2
  37.                    -------------- = -lambda
  38.                         X(x)                
  39.                       d  / d      \          
  40.                      --- |--- T(t)|          
  41.                       dt \ dt     /         2
  42.                    - -------------- = lambda
  43.                               2              
  44.                         T(t) v              
  45. > dsolve(s1, X(x));
  46. print(`output redirected...`); # input placeholder
  47.           X(x) = _C1 sin(lambda x) + _C2 cos(lambda x)
  48. > subs(coeff(rhs(%), sin(lambda*x)) = A, coeff(rhs(%), cos(lambda*x)) = B, %);
  49. print(`output redirected...`); # input placeholder
  50.             X(x) = A sin(lambda x) + B cos(lambda x)
  51. > X := unapply(rhs(%), x);
  52. > {X(0) = 0, (D(X))(l) = 0};
  53. print(`output redirected...`); # input placeholder
  54.   {B = 0, A cos(lambda l) lambda - B sin(lambda l) lambda = 0}
  55. > M := linalg[genmatrix](%, {A, B});
  56. print(`output redirected...`); # input placeholder
  57.  
  58. > Delta := linalg[det](M);
  59. print(`output redirected...`); # input placeholder
  60.                      -cos(lambda l) lambda
  61. > _EnvAllSolutions := true; solve(Delta = 0, lambda);
  62. print(`output redirected...`); # input placeholder
  63.                           Pi (1 + 2 _Z1)
  64.                        0, --------------
  65.                                2 l      
  66. > `minus`(indets(%[2]), {l});
  67. %;
  68.                              {_Z1}
  69. > subs(%[1] = 'k', `%%`[2]); lambda := unapply(%, k);
  70. print(`output redirected...`); # input placeholder
  71.      Pi (1 + 2 k)
  72. k -> ------------
  73.          2 l    
  74. > X[k](x) := subs({lambda=lambda(k), B=0}, X(x));  ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement