1. Introduction
In the previous article [1], we considered a one-dimensional nonhomogeneous wave equation. Mandating a string of a finite length,
, to be subject to the wave Equation (1),
(1)
The c is the constant non-dispersive wave speed. For the sake of simplicity and algebraic transparency, we concentrate on only coordinate-dependent nonhomogeneous functions,
. E.g., a polynomial of the form
,
. The report embodied a solution to (1) subject to the boundary conditions,
,
, i.e., a horizontal massless string with both ends pinned with its free initial shape, subject to the initial condition,
. It was suggested to investigate the impact of the extended, fresh additional Initial & Boundary (IB) conditions on the solution of (1). Here we address the issues.
In general.
a)
and b)
(2)
The a) means, the string’s initial shape is controlled by a desired meaningful function
, and b) the initial string’s speed is given by
.
Therefore, the overview of the problem at hand branches off to three cases. The case with
has already been addressed [1]. The other three fresh cases are.
I)
; II)
; and III)
.
Noting that all three cases share the common feature,
. The forthcoming sections address the scenarios one at a time.
2. Analysis
Reanalyzing [1] adds additional insights to the report. Equation (1) describes one-dimensional forced wave equation describing vibrating modes of a massless, finite length,
, a string. Its vibrating modes are influenced by the imposed boundary and initial conditions. A case is considered where string ends are motionless,
and initially its static and dynamic configurations are subject to,
, and
, respectively.
Namely, as noted, irrespective of the utilized individual terms of the polynomial, the associated standing wave always vibrates in the first quadrant, i.e., the amplitude is always positive, and it never crosses the horizontal axis. This was compared with the features of traditional standing waves, where the vibrations occur in the first and fourth quadrants, with positive and negative amplitudes. The cause of the former was overlooked. To highlight an insight, here, we replace the mentioned polynomial with three fresh functions,
. E.g.,
,(3)
The 1st and 2nd functions for 0 ≤ x ≤ 1 run in the first and fourth quadrants, respectively. The 3rd one spreads within the first and the fourth. The previously applied polynomial terms, xm, all reside in the 1st quadrant.
Because the strategy is to deploy the Fourier bases [2] [3], solving (1) is likewise compatible with the boundary conditions.
. The sine bases are utilized to express
,
(4)
yields the coefficients,
(5)
For the sake of simplicity, the numeric values of the relevant parameters are set to unity,
values={c->1,l->1};
We consider three cases of (3) one at a time.
f1[x_]:=1-x3
Its plot for 0 ≤ x ≤ 1 is shown in Figure 1,
Figure 1. Display of f1[x] vs. x. The function spreads only in the first quadrant.
Plot[f1[x],{x,0,1},PlotStyle->Black,GridLines->Automatic,AxesLabel->{“x”,“f1(x)”}]
Since one of the goals of this report is to deploy a Computer Algebra System (CAS) we label the Fourier [2] coefficients of f1[x], f11[n], and (5) yields,
The graph of its numerical values for the first 40 terms is shown in Figure 2.
Figure 2. Graph of the Fourier coefficient of f11[n] vs. the number of terms, n.
The tabulated numeric values for the first twenty terms and the associated graph are,
tab1=Table[{n,f11[n]},{n,1,40}]/.{\[ScriptL]->1}//N;
listplottab1=ListPlot[tab1,PlotStyle->Black,GridLines->Automatic,AxesLabel->{“n”,“f11[n]”},PlotRange->All]
Figure 2 shows that the coefficient values decrease as the order increases. This justifies limiting the number of contributing terms in the Fourier expansion. The Fourier equivalent function of f1[x] is,
f11Fourier[x_]=
;
plotf1=Plot[Evaluate[{f1[x],f11Fourier[x]}/.{\[ScriptL]->1}],{x,0,1},PlotStyle->{{Thickness[0.004],Black},{Thickness[0.004],Red}},PlotLegends->{“f1[x]”,“f11Fourier”},GridLines->Automatic,AxesLabel->{“x”,“f1[x],f11Fourier[x]”}]
As shown in Figure 3, these two functions are sufficiently compatible and interchangeable.
Figure 3. The function f1[x] (the black) curve and its Fourier-based function f11Fourier[x] (the red) curve are compared.
The next function f2[x] is shown in Figure 4.
Figure 4. Display of f2[x] vs. x. The function spreads only in the fourth quadrant.
f2[x_]:=−1+x3
Plot[f2[x],{x,0,1},PlotStyle->Black,GridLines->Automatic,AxesLabel->{“x”,“f2(x)”}]
n=.
f22[n_]=
/.values
(2(n3π3(−1+Cos[nπ])-nπ(−6+n2π2)Cos[nπ]+3(−2+n2π2)Sin[nπ]))/(n4π4)
Its tabulated output is given by,
tab2=Table[{n,f22[n]},{n,1,40}]/.{\[ScriptL]->1}//N;
listplottab2=ListPlot[tab2,PlotStyle->Black,GridLines->Automatic,AxesLabel->{“n”,“f22[n]”},PlotRange->All]
And it has been displayed in Figure 5.
Figure 5. Graph of the Fourier coefficients f22[n] vs. the number term, n.
Figure 5 shows that the contribution of the Fourier coefficients (5) diminishes with the higher ordered n.
f22Fourier[x_]=
;
plotf2=Plot[Evaluate[{f2[x],f22Fourier[x]}/.{\[ScriptL]->1}],{x,0,1},PlotStyle->{{Thickness[0.004],Black},{Thickness[0.004],Red}},PlotLegends->{“f2[x]”,“f22Fourier”},GridLines->Automatic,AxesLabel->{“x”,“f2[x],f22Fourier[x]”}]
As shown in Figure 6, these two functions are sufficiently compatible and interchangeable.
Figure 6. The function f2[x] (the black) curve and its Fourier-based function f22Fourier[x] (the red) curve are compared.
And for the third choice, f3[x], we have,
f3[x_]:=−1+2x
n=.
f33[n_]=
/.values
−2(nπ+nπCos[nπ]−2Sin[nπ])/(n2π2)
tab3=Table[{n,f33[n]},{n,1,40}]/.{\[ScriptL]->1}//N;
listplottab3=ListPlot[tab3,PlotStyle->Black,GridLines->Automatic,AxesLabel->{“n”,“f33[n]”},PlotRange->All]
Its tabular values are shown in Figure 7.
Figure 7. Display of the Fourier coefficients f33[n] vs. the number term, n.
f33Fourier[x_]=
;
plotf3=Plot[Evaluate[{f3[x],f33Fourier[x]}/.{\[ScriptL]->1}],{x,0,1},PlotStyle->{{Thickness[0.004],Black},{Thickness[0.004],Red}},PlotLegends->{“f3[x]”,“f33Fourier”},GridLines->Automatic,AxesLabel->{“x”,“f3[x],f33Fourier[x]”}]
Figure 8 displays the replaced f3[x] and its Fourier version.
Figure 8. The function f3[x] (the black) curve and its Fourier-based function f33Fourier[x] (the red) curve are compared.
As shown in Figure 8, these two functions are sufficiently compatible and interchangeable.
GraphicsGrid[{{listplottab1,listplottab2,listplottab3}},ImageSize->700]
As shown in Figure 9, the general common feature of the graphs shown is that the strength of the coefficients diminishes for the larger valued n.
Figure 9. The Fourier coefficients for three functions, f1[x], f2[x], and f3[x] vs. n.
Therefore, for all three cases, irrespective of the domain of validity, a limited number of terms can be used, substituting the actual functions with their equivalent Fourier function.
Putting the results in perspective yields,
plotf1f2f3=GraphicsGrid[{{plotf1,plotf2,plotf3}},ImageSize->600]
These satisfactory results justify the accuracy of the deployed method.
Labeling the solution of (1) referencing case f1[x], by uf11[x,t], where u11[n,t] is,
n=.
u11[n_,t_]=
(Integrate[
/.values,{ξ,0,t},Assumptions->n∈Integers])/.values;
Further analysis reveals that limiting the number of terms to only three terms suffice for accuracy, which yields
uf11[x_,t_]=
/.values//N;
Its time-based vibrations, standing waves (manipulation), are given in Figure 10.
Figure 10. Time-based animation to the solution to (1) for f1[x].
Manipulate[Plot[uf11[x,t],{x,0,1},PlotRange->{−0.1,0.2},GridLines->Automatic,AxesLabel->{“x”,“uf11[x,t]”},PlotStyle->Black,PlotLabel->StringJoin[“t=”,ToString[t]]],{t,0,2,0.01}]
Activating the animation shows the oscillation of the shown standing wave; it oscillates only in the first quadrant. It never crosses the horizontal axis. The string’s configuration progresses through a transitional stage and eventually settles into the final stable shape. The reason is illustrated in Figure 11(a). i.e., the original function, f1[x], resides in the 1st quadrant, therefore it vibrates only in the same quadrant. The precise shape of the string at different times intuitively is not predictable because f1[x] is a variable function and different positions of the string act according to their corresponding f1[x]. This insight was overlooked in [1].
Figure 11. Collective graphs of the actual functions (in Black) are compared with the Fourier-based approximated functions (in Red).
This explanation also applies to the other two forthcoming cases. Following the same practiced procedure for f2[x], we display the result in Figure 12.
Figure 12. Time-based animation to the solution to (1) for f2[x].
n=.
u12[n_,t_]=\[ScriptL]/(nπc)f22[n](Integrate[Sin[nπc/\[ScriptL](t-ξ)]/.values,{ξ,0,t},Assumptions->n\[Element]Integers])/.values
(2(1-Cos[nπt])(n3π3(−1+Cos[nπ])-nπ(−6+n2π2)Cos[nπ]+3(−2+n2π2)Sin[nπ]))/(n6π6)
uf12[x_,t_]=
/.values//N;
Manipulate[Plot[uf12[x,t],{x,0,1},PlotRange->{−0.2,0.2},GridLines->Automatic,AxesLabel->{“x”,“uf12[x,t]”},PlotStyle->Black,PlotLabel->StringJoin[“t=”,ToString[t]]],{t,0,2,0.01}]
Activating the animation shows the standing wave oscillating only in the fourth quadrant. It never crosses the horizontal axis. The string’s configuration progresses through a transitional stage and eventually settles into the final stable shape. The reason is illustrated in Figure 11(b).
Here, f2[x] resides in the 4th quadrant, so the string only oscillates in the same quadrant. This emphasizes the same previous observation.
Following the practiced procedure for the two previous cases, for the f3[x] we have,
n=.
u13[n_,t_]=\[ScriptL]/(nπc)f33[n](Integrate[Sin[nπc/\[ScriptL](t-ξ)]/.values,{ξ,0,t},Assumptions->n\[Element]Integers])/.values
((2(1-Cos[nπt])(nπ+nπCos[nπ]−2Sin[nπ]))/(n4π4))
uf13[x_,t_]=
/.values//N;
Manipulate[Plot[uf13[x,t],{x,0,1},PlotRange->{−0.05,0.05},GridLines->Automatic,AxesLabel->{“x”,“uf13[x,t]”},PlotStyle->Black,
PlotLabel->StringJoin[“t=”,ToString[t]]],{t,0,2,0.01}]
Activating the animation shows the standing wave oscillating in both the first and fourth quadrants. It crosses the horizontal axis. The string’s configuration progresses through a transitional stage and eventually settles into the final stable shape. The reason is illustrated in Figure 11(c). Note that the first half of f3[x] is negative, residing in the fourth quadrant, and its second half resides in the first quadrant. Accordingly, the animation in Figure 13 shows that the first half of the string oscillates only in the fourth quadrant, and the second half oscillates only in the first quadrant. Unlike the two previous cases, the chosen original function doesn’t exhibit severe transitional turbulence; it maintains a stable configuration during the transition to the final state.
Figure 13. Time-based animation to the solution to (1) for f3[x].
Putting all these graphs in perspective, we display them in Figure 14.
Figure 14. The first graphic column shows the animation of the string’s standing-wave vibrations. The second column displays the associated original functions.
GraphicsGrid[
{{Manipulate[Plot[uf11[x,t],{x,0,1},PlotRange->{−0.22,0.22},GridLines->Automatic,PlotLabel->StringJoin[“t=”,ToString[t]],PlotStyle->Black],{t,0,2,0.01}],plotf1},
{Manipulate[Plot[uf12[x,t],{x,0,1},PlotRange->{−0.22,0.22},GridLines->Automatic,PlotLabel->StringJoin[“t=”,ToString[t]],PlotStyle->Black],{t,0,2,0.01}],plotf2},
{Manipulate[Plot[uf13[x,t],{x,0,1},PlotRange->{−0.05,0.05},GridLines->Automatic,PlotLabel->StringJoin[“t=”,ToString[t]],PlotStyle->Black],{t,0,2,0.01}],plotf3}}]
Case I.
Following the previous practiced routine, hovering about (4), (5), we report Figure 15. Now we consider two rational functions, g(x) and h(x).
Figure 15. The activated standing wave associated with solution (1) influenced by the initial condition Case I.
g1[x_]:=
n=.
g11[n_]=
/.values;
Noticing that, because of the chosen g[x], the integration output is complicated, leading to high CPU usage. A potential user may choose a rational function to shorten the CPU time.
Including g[x] as an initial condition modifies the solution to (1). Labeling the solution u2g[x,t] the solution to (1) is labeled ufg[x,t] these are coded,
tabg11=Table[{n,g11[n]},{n,1,20}]/.{ℓ->1}//N;
g11Fourier[x_]:=
n=.
u2g[n_,t_]=
/.values;
ufg[x_,t_]=
/.values;
As noted, the coded solution to (1), ufg[x,t], is composed of two terms; uf11[n,t], and u2g[n,t] both are composed of three additive terms. The ufg[x,t] is insensitive to many terms. Via practice the number of terms is optimized.
Manipulate[Plot[ufg[x,t],{x,0,1},PlotRange->{−1.5,1.5},PlotStyle->Black,GridLines->Automatic,AxesLabel->{“x”,“ufg”},PlotLabel->StringJoin[“t=”,ToString[t]]],{t,0,2}]
The influence of the imposed initial condition, Case I, class a, is shown in Figure 15. Activation of its associated animation shows the vibration status of the string under the initial condition, Case I, class a, i.e.,
.
Following the exercised procedure, now consider Class II, whose initial condition is
E.g. taking h(x) a rational function, h(x) = x + 1/(1 + x), yields,
Case II.
h1[x_]:=
Plot[h1[x],{x,0,1},PlotRange->All,GridLines->Automatic,AxesLabel->{“x”,“h[x]”}];
And including h[x] as another initial condition modifies the solution to (1). Labeling the solution u2h[x,t] the solution to (1) is labeled ufh[x,t] these are coded,
n=.
h11[n_]=
/.values
2(CosIntegral[nπ]Sin[nπ]-CosIntegral[2nπ]Sin[nπ]+(-nπCos[nπ]+Sin[nπ])/(n2π2)+Cos[nπ](-SinIntegral[nπ]+SinIntegral[2nπ]))
As in the g[x] case, the integration output is complicated and CPU-intensive. A rational h[x] function reduces CPU usage.
tabh11=Table[{n,h11[n]},{n,1,20}]/.{ℓ->1}//N;
ListPlot[tabh11,GridLines->Automatic,AxesLabel->{“n”,“h11[n]”},PlotRange->All];
h11Fourier[x_]:=
;
Plot[Evaluate[{h1[x],h11Fourier[x]}/.{ℓ->1}],{x,0,1},PlotStyle->{Black,Red},PlotLegends->{“h1[x]”,“h11Fourier”},GridLines->Automatic,AxesLabel->{“x”,“h1[x]”}];
n=.
u2h[n_,t_]=
/.values;
Including h[x] as an initial condition modifies the solution to (1). Labeling the solution u2h[x,t] the solution to (1) is labeled ufh[x,t] these are coded,
ufh[x_,t_]=
/.values;
As noted, the coded solution to (1), ufh[x,t], is composed of two terms; uf11[n,t], and u2h[n,t] both are composed of three additive terms. The ufh[x,t] is insensitive to many terms. Via practice the number of terms is optimized.
Manipulate[Plot[ufh[x,t],{x,0,1},PlotRange->{−0.8,0.8},GridLines->Automatic,AxesLabel->{“x”,“ufh”},PlotLabel->StringJoin[“t=”,ToString[t]],PlotStyle->Black],{t,0,2}]
The influence of the imposed initial condition Case I is shown in Figure 16. Activation of its associated animation shows the string’s vibration status under the initial condition in Case II.
Figure 16. Time-based animation to the solution to (1) for ufh[x,t] vs. x influenced by initial Case II.
Case III
And, finally, for Case III, the solution of (1) including all initial conditions,
is labeled ufgh[x,t], including its associated animation, which is shown in Figure 17.
Figure 17. Time-based animation to the solution to (1) for ufgh[x,t].
ufgh[x_,t_]=
/.values;
Manipulate[Plot[ufgh[x,t],{x,0,1},PlotRange->{−2,2},GridLines->Automatic,AxesLabel->{“x”,“ufgh”},PlotLabel->StringJoin[“t=”,ToString[t]],PlotStyle->Black],{t,0,2}]
All discussed cases are collectively shown in Figure 18.
Figure 18. Time-based animation to the solution to (1) for collective ufgh[x,t], ufg[x,t], ufh[x,t], uf11[x,t].
Manipulate[Plot[{ufgh[x,t],ufg[x,t],ufh[x,t],uf11[x,t]},{x,0,1},PlotRange->{−1.2,1.2},AxesLabel->{“x”,None},PlotLegends->“Expressions”,GridLines->Automatic,PlotLabel->StringJoin[“t=”,ToString[t]]],{t,0,2,0.1}]
Manipulate[{Plot[ufgh[x,t],{x,0,1},GridLines->Automatic,PlotLabel->StringJoin[“t=”,ToString[t]],AxesLabel->{“x”,“ufgh”},PlotStyle->{Red}],Plot[ufg[x,t],{x,0,1},GridLines->Automatic,PlotLabel->StringJoin[“t=”,ToString[t]],AxesLabel->{“x”,“ufg”},PlotStyle->{Orange}],Plot[ufh[x,t],{x,0,1},GridLines->Automatic,PlotLabel->StringJoin[“t=”,ToString[t]],AxesLabel->{“x”,“ufh”},PlotStyle->{Magenta}],Plot[uf11[x,t],{x,0,1},GridLines->Automatic,PlotRange->{0,0.2},PlotLabel->StringJoin[“t=”,ToString[t]],AxesLabel->{“x”,“uf”},PlotStyle->{Blue}]},{t,0,2,0.05}]
Figure 19 displays the profile of the solutions to (1) at a specific time instant. This figure graphically displays the impact of a specific IB on the solution. As shown in Figure 19, the time instance may be chosen differently to display the profiles, as in Figure 20.
Figure 19. Profile of the four cases at a specific time.
Figure 20. A snapshot of Figure 19 at a specific time.
Table16=Table[{Plot[ufgh[x,t],{x,0,1},GridLines->Automatic,PlotLabel->StringJoin[“t=”,ToString[t]],AxesLabel->{“x”,“ufgh”},PlotStyle->{Red}],Plot[ufg[x,t],{x,0,1},GridLines->Automatic,PlotLabel->StringJoin[“t=”,ToString[t]],AxesLabel->{“x”,“ufg”},PlotStyle->{Orange}],Plot[ufh[x,t],{x,0,1},GridLines->Automatic,PlotLabel->StringJoin[“t=”,ToString[t]],AxesLabel->{“x”,“ufh”},PlotStyle->{Magenta}],Plot[uf11[x,t],{x,0,1},GridLines->Automatic,PlotRange->{0,0.2},PlotLabel->StringJoin[“t=”,ToString[t]],AxesLabel->{“x”,“uf”},PlotStyle->{Blue}]},{t,0.75,0.75}]
3. Conclusions and Remarks
The main trust of the current version II report is to study the impact of the various initial and boundary (IB) conditions on the solution of a nonhomogeneous one-dimensional wave equation. The one-dimensional homogeneous wave equation is a textbook exercise; its nonhomogeneous version with an IB condition is being analyzed [1]. However, even with a time-independent nonhomogeneous term, imposing different IBVs yields distinct solutions to the wave equation. This article addressed this issue. The method has been to adapt the Fourier bases to solve the wave equation. Three Cases have been considered. For the selected Class and the Case, the associated Wave equation has been solved. The analytic formal solution is coded, and the result is graphically depicted and animated. For the sake of comprehensive understanding, all cases are collectively graphed and animated together. For instance, by turning off the contributing IBVs in the solution’s composed feature one at a time, the impact of each specific IB has been shown both graphically and in animation. The computational features of the Computer Algebra System used have been vital to completing this report.
Individuals interested in Mathematica might find [4]-[6] resourceful.