Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@Jak Okay, that's better, but your question is unclear.

You say "I have two curves" but what you have shown are two expressions (not equations) which you have called eq1 and eq2.

One way I can think of making sense of "I have two curves", is to assume that your curves are given as eq1=0 and eq2=0.  Is that what you mean?

But in that case, eq1 < eq2 makes no sense since both eq1 and eq2 are zero.  I don't know where to go from here.

Perhaps you mean something else.  If so, then clarify.

 

 

 

In eq2 you have x[e(holling)].  What is it?

@vv That works better than what I could have imagined.   Thanks!.

@Test007 I did haven't changed any settings.  What I have shown is based on the version of OrthogonalExpansions dated May 27, 2016 from the site that you have noted, and run on Maple 2020.  How is your result different from mine?

 

@Neel 

The key to get you moving forward is the calculation shown in section
titled Orthogonal expansion in my worksheet.  I see that you have not
carried over that section into your worksheet, hence the disconnect.

 

Let me summarize that content of that section.  It says that any function f(x) may be
expressed as f(x) = sum(`&alpha;__n`*X__n(x), n = 1 .. infinity), and that the coefficients `&alpha;__n` are given by
`&alpha;__n` = 2*(int(f(x)*X__n(x), x = 0 .. L))/L.

In particular, when alpha*(1-x/L) = sum(k__n*X__n(x), n = 1 .. infinity), then we have: 
k__n = 2*(int(alpha*(1-x/L)*sin(n*Pi*x/L), x = 0 .. L))/L.

Maple can compute that integral easily:

k[n] = 2/L*int( alpha*(1-x/L)*sin(n*Pi/L*x), x=0..L) assuming n::integer;

k[n] = 2*alpha/(n*Pi)

There you have it.  Scroll all the way down to the very bottom of my

worksheet and insert that value of k__n in the final formula and you are done.

 

@Carl Love A very nice construction.  Vote up!

 

@Carl Love Not related to the programming language per se, but to the worksheet interface: High on my wish list is some construct that would limit the scope of identifiers to a specified region of a worksheet.  Something like

scope
x := 12;
...
one or more execution groups here

end scope;

where the assignment x:=12 is effective only within that scope.

Admittedly, something like this can be accomplished through a proc, but that would hide the output of the individual statements within the scope.

 


 

@acer In the usual eigenvalue problem in linear algebra, finding the eigenvalues of a matrix M amounts to finding the values of λ so that the matrix M − λ I is singular.  His is a nonlinear eigenvalue problem where we have a matrix M(λ) which is a nonlinear function of the parameter λ, and we want to find λ so that M(λ) is singular.  That's beyond the scope of LinearAlgebra:-Eigenvalues.

 

@PhD_Wallyson Look at the equation just before the implicitplot command.  Call that equation Eq. It involves only rho and lambda.  Given rho=4.3, you want to calculate the corresponding lambda values.  So we do:

eval(Eq, rho=4.3):
fsolve(%, lambda=0.001..5, maxsols=5);

and that produces

0.4074182340, 1.033338698, 1.741806657, 2.444688425, 3.111634975

The reason for the 0.001 in the call to fsolve is to avoid the lambda=0 solution.

 

@PhD_Wallyson In the worksheet that you have posted, note paragraph just above where the plot_mode( ) proc is defined.  It says that in principle the determinant of M is zero, but in practice is may be not quite zero due to floating point roundoffs.  It also says that you need to keep an eye on the value of the determinant and take corrective action is if it too far from zero.

Also note the message, printed in blue, just before each of your three plots.  We have things like this:

Determinant is -2.99856e+025.  Increase Digits if not near zero!

Certainly 10^25 is not close to zero, therefore the result is pretty much nonsense.

As the message suggests, one way around this is to increase the number of digits that Maple carries in its floating point calculations.  The default is 10 digits.  If you increase the digits of accuracy to 30, then the determinants will be almost zero.

The digits of accuracy is specified by the Digits variable.  Therefore near the beginning of your worksheet you need to insert:

Digits := 30;

Although that will work, I strongly advise against doing that  because that's the wrong approach to solving the problem.  Consider, for instance, that you want to carry out the equivalent calculations in Matlab instead of Maple.  Matlab's precision is something like Digits = 16, and that's not adjustable.  Therefore your program won't work at all in Matlab. As you have seen, if you use centimeters instead of meters, Maple works just fine with the default of 10 digits.  In engineering calculations it is quite common (and often absolutely necessary) to use sensible units in order to scale the computational ranges of variables into what the machine can handle.

 

@vv I had not expected the maxsols option to work in this case since according to the documentation, "this option is valid only for a single univariate polynomial equation" [my emphasis].  Perhaps the documentation needs to be updated.

@Neel Your hand-written notes on solving the forced wave equation are on the right track.  I have written my take on your notes and have completed the calculations in the following worksheet.  Perhaps this can be of some help.

I must point out that very little of Maple's computational power is used in this worksheet.  These calculations could have been easily done by hand.  Don't get distracted by some of the obscure Maple commands that you may encounter in the worksheet..  Instead, focus on what they are meant to do.

Series solution of the periodically forced wave equation

Here I go step-by-step through the process of obtaining a series solution of the periodically

forced wave equation.

 

Rouben Rostamian

2020-07-08

restart;

Here is the periodically forced wave equation:

pde := diff(w(x,t),t,t) = c^2*diff(w(x,t),x,x) + kappa(x)*cos(Omega*t);

diff(diff(w(x, t), t), t) = c^2*(diff(diff(w(x, t), x), x))+kappa(x)*cos(Omega*t)

We solve it subject to the boundary conditions u(0, t) = 0, u(L, t) = 0 and initial conditions u(x, 0) = phi(x)
and u__t(x, 0) = psi(x).

Following the traditional approach, first we solve the force-free problem and obtain the so-called

homogeneous solution w__h, and then find a particular solution w__p to the forced problem.  Then the

solution will be w = w__h+w__p.

 

The homogeneous problem

 

The homogeneous PDE is

pde_h := diff(w(x,t),t,t) = c^2*diff(w(x,t),x,x);

diff(diff(w(x, t), t), t) = c^2*(diff(diff(w(x, t), x), x))

We look for separable solutions of the form w(x, t) = X(x)*T(t).  Plugging that

into the PDE we get

eval(pde_h, w(x,t)=X(x)*T(t));
pde_separated := % / (X(x)*T(t));   # separate the variables

X(x)*(diff(diff(T(t), t), t)) = c^2*(diff(diff(X(x), x), x))*T(t)

(diff(diff(T(t), t), t))/T(t) = c^2*(diff(diff(X(x), x), x))/X(x)

One side of that equation is a function of t, the other side is a function of x.

But x and t are independent variables, therefore each side has better be a constant.

Thus, we arrive at two differential equations

eq_T := lhs(pde_separated) = -omega^2;
eq_X := rhs(pde_separated) = -omega^2;

(diff(diff(T(t), t), t))/T(t) = -omega^2

c^2*(diff(diff(X(x), x), x))/X(x) = -omega^2

We solve the two ODEs:

sol_T := dsolve(eq_T);

T(t) = _C1*sin(omega*t)+_C2*cos(omega*t)

sol_X_temporary1 := dsolve(eq_X);

X(x) = _C1*sin(omega*x/c)+_C2*cos(omega*x/c)

The expression omega*x/c that occurs above is not very convenient.  We would much rather

have lambda*x instead.  For that, we define lambda in terms of omega through the equation omega*x/c = lambda*x,

whence lambda = omega/c, or equivalently, omega = lambda*c.  In terms of lambda,  sol_X_temporary1 takes the form

sol_X_temporary2 := eval(sol_X_temporary1, omega=lambda*c);

X(x) = _C1*sin(lambda*x)+_C2*cos(lambda*x)

The X solution should satisfy the boundary conditions, that is, X(0) = 0.  Plugging x = 0 in

the solution, we get

eval(sol_X_temporary2, x=0);

X(0) = _C2

and therefore _C2 = 0 and the solution reduces to _C1*sin(lambda*x).  The _C1 factor is

immaterial since any constant multiple of a solution of pde__h is also a solution.
Thus, we see that X(x) is given by

sol_X := subs(_C1=1, _C2=0, sol_X_temporary2);

X(x) = sin(lambda*x)

The solution should also satisfy the boundary conditions X(L) = 0.  Plugging x = L in

the expression for solution we get

eval(sol_X, x=L);

X(L) = sin(lambda*L)

whence lambda*L = n*Pi for any integer "n."  Let's write the resulting lambda as `&lambda;__n` = n*Pi/L, and, recalling

the definition of "lambda,"also set `&omega;__n` = `&lambda;__n`*c and `&lambda;__n`*c = n*Pi*c/L.

We conclude that there are infinitely many solution for "X ."`` Call them X__n(x) = sin(`&lambda;__n`*x), n = 1, 2, () .. ()

We don't care for non-positive values of n since replacing n by -n is equivalent to multiplying X__n by -1.

 

The functions X__n form a complete orthogonal set under the usual inner product on the

space of square-integrable functions on the interval 0, L.   Let's verify the orthogonality:

Int(sin(lambda[i]*x)*sin(lambda[j]*x), x=0..L);
eval(%, {lambda[i]=i*Pi/L, lambda[j]=j*Pi/L}):
value(%) assuming i::integer, j::integer;

Int(sin(lambda[i]*x)*sin(lambda[j]*x), x = 0 .. L)

0

The functions don't have unit norm.  We could insert a factor of sqrt(2/L) in the definition

of X__n to make them into an orthonormal family, but we won't bother.

Int(sin(lambda[i]*x)^2, x=0..L);
eval(%, lambda[i]=i*Pi/L):
value(%) assuming i::integer;

Int(sin(lambda[i]*x)^2, x = 0 .. L)

(1/2)*L

In view of the solution for T obtained earlier in sol_T, we express the general solution of the homogeneous problem as an infinite sum, where the coefficients a__n and b__n are arbitrary constants.

w__h := Sum((a[n]*cos(omega[n]*t) + b[n]*sin(omega[n]*t))*X[n](x), n=1..infinity);

Sum((a[n]*cos(omega[n]*t)+b[n]*sin(omega[n]*t))*X[n](x), n = 1 .. infinity)

 

 

Orthogonal expansion

 

As has already been noted, the family of functions X__n, n = 1, 2, () .. () form a complete orthogonal set on the space

square-integrable functions.  Any such function, say "f(x)," may be written as an infinite linear combination

of the X__ns, as in
"f(x)=(&sum;)`alpha__n`*`X__n`(x)."

The coefficients `&alpha;__n` are easily determined due to the orthogonality property.  To see that,

multiply the expression above by X__m(x) for an unspecified index m, and integrate the

result over the interval
0, L; int(f(x)*X__m(x), x = 0 .. L) = int(sum(`&alpha;__n`*X__n(x)*X__m(x), n = 1 .. infinity), x = 0 .. L) and int(sum(`&alpha;__n`*X__n(x)*X__m(x), n = 1 .. infinity), x = 0 .. L) = sum(`&alpha;__n`*(int(X__n(x)*X__m(x), x = 0 .. L)), n = 1 .. infinity)
.

Each of the infinitely many integrals on the right-hand side is zero, except for the one
corresponding to n = m which equals "L/(2)."  Therefore the expression above reduces to
"(&int;)[0]^(L)f(x)*`X__m`(x) &DifferentialD;x=(L)/(2)*`alpha__m` ,"
whence
`&alpha;__m` = 2*(int(f(x)*X__m(x), x = 0 .. L))/L

 

The particular solution

 

We have taken the forcing term to be kappa(x)*cos(Omega*t).   We expand the coefficient kappa(x)

in terms of the eigenfunctions X__n  as described in the previous section.  We get
kappa(x) = sum(k__n*X__n(x), n = 1 .. infinity),  where  "`k__n`=2/(L)*(&int;)[0]^(L)kappa(x)*`X__n`(x) &DifferentialD;x." 

While we are at it, we also expand the initial conditions phi(x) and psi(x) in the same way:

phi(x) = sum(A__n*X__n(x), n = 1 .. infinity),  where  
"`A__n`=2/(L)*(&int;)[0]^(L)phi(x)*`X__n`(x) &DifferentialD;x,  "
psi(x) = sum(B__n*X__n(x), n = 1 .. infinity),  where  
"`B__n`=2/(L)*(&int;)[0]^(L)psi(x)*`X__n`(x) &DifferentialD;x.  "

We look for a particular solution of the form W(x)*cos(Omega*t).  Express the yet unknown function
W(x) also as an infinite sum of the eigenfunctions, that is
W(x) = sum(h__n*X__n(x), n = 1 .. infinity),
where h__n are to be determined.

 

Now let us compute.  Form of the sought after solution is:

w_form := w(x,t) = Sum(h[n]*X[n](x), n=1..infinity)*cos(Omega*t);

w(x, t) = (Sum(h[n]*X[n](x), n = 1 .. infinity))*cos(Omega*t)

and the form of the forcing term is (Recall that that the coefficients k__n are known/computable)

force_form := kappa(x) = Sum(k[n]*X[n](x), n=1..infinity);

kappa(x) = Sum(k[n]*X[n](x), n = 1 .. infinity)

eval(pde, [w_form, force_form]);    # plug the above into the PDE
lhs(%) - rhs(%) = 0;                # bring all terms to the left
tmp1 := simplify(%/cos(Omega*t));    # divide through by the common factor cos(Omega*t)

-(Sum(h[n]*X[n](x), n = 1 .. infinity))*Omega^2*cos(Omega*t) = c^2*(Sum(h[n]*(diff(diff(X[n](x), x), x)), n = 1 .. infinity))*cos(Omega*t)+(Sum(k[n]*X[n](x), n = 1 .. infinity))*cos(Omega*t)

-(Sum(h[n]*X[n](x), n = 1 .. infinity))*Omega^2*cos(Omega*t)-c^2*(Sum(h[n]*(diff(diff(X[n](x), x), x)), n = 1 .. infinity))*cos(Omega*t)-(Sum(k[n]*X[n](x), n = 1 .. infinity))*cos(Omega*t) = 0

-(Sum(h[n]*X[n](x), n = 1 .. infinity))*Omega^2-c^2*(Sum(h[n]*(diff(diff(X[n](x), x), x)), n = 1 .. infinity))-(Sum(k[n]*X[n](x), n = 1 .. infinity)) = 0

Recall, however, that X__n is defined as the solution of the differential equation diff(X__n(x), x, x) = -`&omega;__n`^2*X__n(x)/c^2, therefore

we substitute for it in the previous equation, and simplify:

eval(tmp1, diff(X[n](x),x,x) = -omega[n]^2/c^2*X[n](x) );
combine(%);NULL
tmp2 := factor(%);

-(Sum(h[n]*X[n](x), n = 1 .. infinity))*Omega^2-c^2*(Sum(-h[n]*omega[n]^2*X[n](x)/c^2, n = 1 .. infinity))-(Sum(k[n]*X[n](x), n = 1 .. infinity)) = 0

Sum(h[n]*X[n](x)*omega[n]^2-Omega^2*h[n]*X[n](x)-k[n]*X[n](x), n = 1 .. infinity) = 0

Sum(-X[n](x)*(Omega^2*h[n]-h[n]*omega[n]^2+k[n]), n = 1 .. infinity) = 0

In that last equation we have an infinite linear combination of the basis functions X__n , equaled to zero.

It follows (from orthogonality) that each of the coefficients is zero.  So we set the coefficients equal

to zero and from there compute `h__n:`

op(1, lhs(tmp2)):
coeff(%, X[n](x)) = 0;
h_form := isolate(%, h[n]);

-Omega^2*h[n]+h[n]*omega[n]^2-k[n] = 0

h[n] = k[n]/(-Omega^2+omega[n]^2)

Finally, we substitute the value of h__n computed above in the w_form to obtain the

sought-after particular solution:

w__p := subs(h_form, rhs(w_form));

(Sum(k[n]*X[n](x)/(-Omega^2+omega[n]^2), n = 1 .. infinity))*cos(Omega*t)

This is good provided that the forcing frequency Omega avoids the natural frequencies `&omega;__n`.

 

The solution

 

The solution of the original initial value is the sum of the homogeneous and particular solutions

calculated in the previous sections:

w_sol_general := w__h + w__p;

Sum((a[n]*cos(omega[n]*t)+b[n]*sin(omega[n]*t))*X[n](x), n = 1 .. infinity)+(Sum(k[n]*X[n](x)/(-Omega^2+omega[n]^2), n = 1 .. infinity))*cos(Omega*t)

Our next task is to determine the coefficients a__n and b__n so that the initial conditions are satisfied.

Here we will appeal to the infinite series expansions of the initial conditions phi(x) and psi(x) obtained

earlier.  We want w(x, 0) = phi(x), therefore

eval(w_sol_general, t=0) = Sum(A[n]*X[n](x), n=1..infinity);
lhs(%) - rhs(%) = 0;
tmp2 := combine(%);

Sum(a[n]*X[n](x), n = 1 .. infinity)+Sum(k[n]*X[n](x)/(-Omega^2+omega[n]^2), n = 1 .. infinity) = Sum(A[n]*X[n](x), n = 1 .. infinity)

Sum(a[n]*X[n](x), n = 1 .. infinity)+Sum(k[n]*X[n](x)/(-Omega^2+omega[n]^2), n = 1 .. infinity)-(Sum(A[n]*X[n](x), n = 1 .. infinity)) = 0

Sum(k[n]*X[n](x)/(-Omega^2+omega[n]^2)-A[n]*X[n](x)+a[n]*X[n](x), n = 1 .. infinity) = 0

From the orthogonality of the X__n it follows that each of the terms in the sum is zero,

whence we calculate a__n:

op(1, lhs(tmp2));
isolate(%, a[n]);
a_form := expand(%);

k[n]*X[n](x)/(-Omega^2+omega[n]^2)-A[n]*X[n](x)+a[n]*X[n](x)

a[n] = (-k[n]*X[n](x)/(-Omega^2+omega[n]^2)+A[n]*X[n](x))/X[n](x)

a[n] = -k[n]/(-Omega^2+omega[n]^2)+A[n]

Furthermore, we want w__t(x, 0) = psi(x), therefore

diff(w_sol_general, t);
eval(%, t=0) = Sum(B[n]*X[n](x), n=1..infinity);
lhs(%) - rhs(%) = 0;
tmp3 := combine(%);

Sum((-a[n]*omega[n]*sin(omega[n]*t)+b[n]*omega[n]*cos(omega[n]*t))*X[n](x), n = 1 .. infinity)-(Sum(k[n]*X[n](x)/(-Omega^2+omega[n]^2), n = 1 .. infinity))*Omega*sin(Omega*t)

Sum(b[n]*omega[n]*X[n](x), n = 1 .. infinity) = Sum(B[n]*X[n](x), n = 1 .. infinity)

Sum(b[n]*omega[n]*X[n](x), n = 1 .. infinity)-(Sum(B[n]*X[n](x), n = 1 .. infinity)) = 0

Sum(b[n]*omega[n]*X[n](x)-B[n]*X[n](x), n = 1 .. infinity) = 0

It follows that

op(1, lhs(tmp3));
b_form := isolate(%, b[n]);

b[n]*omega[n]*X[n](x)-B[n]*X[n](x)

b[n] = B[n]/omega[n]

Finally, we substitute the expressions for a__n and b__n  in w_sol_general and arrive

at the solution of the problem:

w(x,t) = subs(a_form, b_form, w_sol_general);

w(x, t) = Sum(((-k[n]/(-Omega^2+omega[n]^2)+A[n])*cos(omega[n]*t)+B[n]*sin(omega[n]*t)/omega[n])*X[n](x), n = 1 .. infinity)+(Sum(k[n]*X[n](x)/(-Omega^2+omega[n]^2), n = 1 .. infinity))*cos(Omega*t)

The two summations above may be combined into one (although that's not strictly necessary).  It's difficult

doing that in Maple, so here I will do it by hand:

w(x,t) = Sum(((-k[n]/(-Omega^2 + omega[n]^2) + A[n])*cos(omega[n]*t) + B[n]*sin(omega[n]*t)/omega[n] + k[n]*cos(Omega*t)/(-Omega^2 + omega[n]^2))*X[n](x), n=1..infinity);

w(x, t) = Sum(((-k[n]/(-Omega^2+omega[n]^2)+A[n])*cos(omega[n]*t)+B[n]*sin(omega[n]*t)/omega[n]+k[n]*cos(Omega*t)/(-Omega^2+omega[n]^2))*X[n](x), n = 1 .. infinity)

 

 


 

Download wave-equation-forced-vibration.mw

 

After deriving equation (22), the authors identify three special cases for which solutions are available in the literature.  Let's look at their Case 1, that is, a/L=0 and mass_ratio=0.  The equation then should reduce, and they assert that it does, to the classical clamped-free cantilever model.  But I don't see that.

Setting a/L=0 and mass_ratio=0 in equation (22), I get 0=0.  (I did that by hand; no need for Maple for that.)  But that's not correct.  The equation should reduce to cos(βL) cosh(βL) = −1.

Can you verify my calculation?  If I am correct, then there must be a typo in equation (22).  That needs to be fixed before going ahead with the rest of the calculations.

 

@Neel What you have here is so far removed from what would be the right approach to the solution of the problem, that it leaves little to salvage.  In my earlier message I provided a general outline for solving the forced vibration problem.  What you have in your worksheet does not follow that outline at all.  The entire worksheet needs to be discarded and started over again.

But you should not feel bad about that.  My outline assumes some familiarity with orthogonal basis functions generated by solutions of boundary value problems, and how to expand an arbitrary function in such a basis.  It appears that you have not seen that material, so I wouldn't blame you for that.

I can provide the somewhat long and messy solution to the problem which you are attempting to solve, but without the proper mathematical background it won't be understandable.

Why are you interested in this problem?  If it is a student project, you should really begin with learning the basic mathematical ideas behind what is called eigenfunction expansions. Furthermore, the beam problem is one or two steps more advanced than a beginner problem in this subject, which would be:

First: The heat equation:
w_t= w_xx + f(x,t),
w(0,t)=0,   w(L,t)=0,
w(x,0) = g(x),

Second: The wave equation:
w_tt = w_xx + f(x,t),
w(0,t)=0,   w(L,t)=0,
w(x,0) = g(x),   w_t(x,0) = h(x).

You need to be able to confortably handle these before attempting the beam equation.  Do you have a textbook that shows how to solve these problems?  Learning that will be the first in your progression.  By the way, notice the initial conditions g(x), and h(x).  You will need to specify initial conditions to solve your beam problem as well.  I didn't see initial conditions in your worksheet.
 

@panke Specify the version of your Maple when you ask a question.  There is a pull-down menu just before you submit your question in which you enter the version.  Please don't ignore it.

First 34 35 36 37 38 39 40 Last Page 36 of 99