Designing Physics Problems with Mathematica

Abstract

We envision utilizing the versatility of a Computer Algebra System, specifically Mathematica to explore designing physics problems. As a focused project, we consider for instance a thermo-mechanical-physics problem showing its development from the ground up. Following the objectives of this investigation first by applying the fundamentals of physics principles we solve the problem symbolically. Applying the solution we investigate the sensitivities of the quantities of interest for various scenarios generating feasible numeric parameters. Although a physics problem is investigated, the proposed methodology may as well be applied to other scientific fields. The codes needed for this particular project are included enabling the interested reader to duplicate the results, extend and modify them as needed to explore various extended scenarios.

Share and Cite:

Sarafian, H. (2022) Designing Physics Problems with Mathematica. American Journal of Computational Mathematics, 12, 191-196. doi: 10.4236/ajcm.2022.122010.

1. Introduction

The problem poses as a thermo-mechanical. It inherits both features; the thermodynamic side embodies a confined gas in a cylindrical vessel with a mobile piston; the mechanical side is a flexible spring. For the sake of simplicity, the gas and the spring both are considered ideal. Figure 1 shows the setup of the problem.

A μ mole of the gas within the vessel of base area A and initial height of y at temperature T1 generates pressure P1. In this version, we consider a massless piston. The alternate version may include a massive piston. The named parameters may be adjusted to counterbalance the atmospheric pressure P0. The piston is connected to a spring. The other end of the spring is tied to the stationary red rod shown in Figure 1. The gas and the spring are subject to the ideal gas equation of state, Boyle’s law, and a linear spring, Hooke’s law, respectively [1].

This report is composed of three sections. In addition to the Introduction, Section 2 is the Procedure. Applying fundamental physics laws we craft the needed description of the proposed thermo-mechanical problem. Manipulating the needed equations we arrive at the final symbolic result. Instead of utilizing a “given” set of parameters, by applying Mathematica’s [2] numeric capabilities we explore the range of numeric parameters conducive to practical reasonable output. Utilizing one such set we objectively interpret the output. Whenever needed the results are accompanied by plots assisting to the insightfulness of the problem [3] [4]. We also embedded an animation code such that the interested reader readily may produce the results graphically. Section 3 is the Conclusions. Here we discuss the achieved goals and propose a modification to extend the future projects.

2. Procedure

We begin by utilizing the fundamental physics principle applicable to the proposed problem. For an ideal gas, the equation of state is [1],

P 1 V 1 = μ R T 1 , (1)

we consider a cylindrical canister of equal diameter and height of 10.0 cm. The corresponding volume is 7.8 × 10−3 m3; this is about the volume of a one-liter plastic soda bottle. Assuming the room temperature is about ~27° i.e. T1 = 300.0 K. At one atmospheric pressure ~100 KPa (1) yields the number of moles, μ = 0.03. The corresponding number of the air molecules is ~0.18 × 1023. Having this many molecules as schematically shown with the red dots in Figure 1 we may apply the principle of Classical Mechanics in the Kinetic Theory of Gases [1] and/or the Maxwell-Boltzmann speed distribution [5] assisting to envision the mobile molecules producing the gas pressure, respectfully. The typical speed of

these molecules i.e. the Root-Mean-Square speed is v r m s = 3 R T m m o l . Applying

to air assuming being an ideal gas with a molar mass of 28.8 g/mol at mentioned temperature this gives ~510 m/s. For additional detailed C.F. [6].

Figure 1. A cylindrical vessel with a mobile piston embodies an ideal gas, the mobile piston is connected to an ideal flexible spring.

Increasing the initial temperature to T2 increases the molecular speeds and the interior pressure causing the spring to compress as shown in Figure 1 by Δy. Assuming the piston at the end of each incremented temperature is in equilibrium the zero net force yields,

F s + A P 1 A P 2 = 0 , (2)

where Fs is the spring force, subject to Hooke’s law Fs = kΔy and P1, P2 are the initial and secondary gas pressures at initial and secondary temperatures.

Applying Boyle’s law for the second stage (1) yields,

P 2 ( V 1 + A Δ y ) = μ R T 2 , (3)

substituting P2 from (3) andP1 from (1) into (2) after simplification yields,

k Δ y 2 + ( μ R P 0 k A T 1 + A P 0 ) Δ y μ R ( T 2 T 1 ) = 0 . (4)

The first and second coefficients of the quadratic Equation (4) are always positive. Since we are considering increasing the temperature i.e. T2 > T1 the 3rd term also always stays positive as well. In short, the discriminant of the quadratic (4) is always positive and larger than the 2nd term so that one of the roots of (4) is positive and the other negative. This observation leads to only one unique positive acceptable positive Δy> 0. To set the parameters yielding to a reasonable compression Δy first we solve (4) symbolically and then explore values for the stiffness, k.

{ a , b , c } = { k , μ R P 0 k A T 1 + A P 0 , μ R ( t 2 T 1 ) }

solΔy = Solve[(a Δy2+b Δy-c) = = 0,Δy];

Δy/.solΔy

{ A P 0 k R T 1 μ A P 0 ( A P 0 + k R T 1 μ A P 0 ) 2 4 k ( R T 1 μ R t 2 μ ) 2 k , A P 0 k R T 1 μ A P 0 + ( A P 0 + k R T 1 μ A P 0 ) 2 4 k ( R T 1 μ R t 2 μ ) 2 k } (5)

as shown (5) only the second root is positive. Figure 2 graphically justifies the observation.

Next, we store the relevant parameters in values,

values = {μ->0.03 moles,R->8.31 J/(mol. K), P0->1.01*105Pa,A->7.8.*10−3m^3 ,T1->300 K.}.

For a semi-stiff spring k = 500 N/m. Utilizing this we plot (4) vs its roots, see Figure 2.

Figure 2. Display of the left side of (4).

Plot[(aΔy2+bΔy − c)/.values/.k −> 500/.t2 −> T2/.T2 −>500,{Δy,−2.,0.2}, PlotStyle −> Black,GridLines → Automatic,AxesLabel] → {"Δy", "left side of (4)"}]

For a test drive, we run the positive root of (5) at a typical temperature T2 = 500 K for a range of stiffness-es, k. One of the objectives of this report is to investigate what is the reasonable range of the parameters conducive to a practical output. Assuming the final temperature is e.g., T2 = 500 K or any reasonable temperature we consider springs with stiffness 100 k 1000 N/m. The lower limit corresponds to a semi-soft and the upper limit to a hard spring. The search results are tabulated in Table 1.

Table 1 shows as expected the soft spring with the stiffness of k = 100 N/m is compressed more than a hard spring with the stiffness of k = 1000 N/m. Note, the entire calculation of this report is carried out in the MKS units, however, for practical purposes, the compressed lengths are in cm; as shown the compressions are practically reasonable.

For the rest of the computation, we select a stiffness of k = 500 N/m. To stress the thermodynamic aspect of the report we plot the compression length Δy vs. the secondary temperature, T2. See Figure 3.

Motivated by the linearity of the shown graph we looked into the functional behavior of (5). The root square of the discriminant is Δ = b 2 4 a c . Because

b 2 4 a c , we write Δ = b 1 4 a c b 2 ~ b 2 a c b . This simplifies the positive root of (5) i.e. Δ y ~ c b ~ T 2 . Indeed this justifies the linearity relationship shown in Figure 3.

And, finally putting all the information together we craft a code with a desired graphic output (Figure 4).

Plot[(aΔy2+bΔy-c)/.values/.k->500/.t2->T2,{Δy,-0.01,0.2},PlotRange->{{0,0.2}, {-5.,40}},AxesLabel→{“Δy(m)”,None},GridLines→Automatic,PlotLabel→StringJoin[“T2(k) = “,ToString[T2]]], Graphics[{Red,,PointSize[0.03],Point[{Δy/.solΔy 〚2〛/.values/.{k->500}/.t2->T2,0}]},PlotRange→{{0,0.1},{-5.,40}}]],{t2,Δy/.solΔy〚2〛}/.values/.k->500/.t2->T2},{T2,300,1000,5}]

Table 1. Stiffness vs. the compression length. These are calculated at temperature T2 = 500 K.

Figure 3. The plot of the compressions of the semi-stiff spring with k = 500 N/m vs. temperature T2 (K).

Figure 4. A collective snapshot of the animation. Temperature slider (left corner), the plot of the (4) vs. Δy (middle plate), and the automated counter of {Temp, Δy}.

Running this animation yields the plot of the solution of (4), vs. the compression Δy. The blue curve is the magnified black curve shown in the first quadrant of Figure 2. The positive root of (5) is shown with a red dot along the horizontal axis. The Plot Title is an automated counter showing the temperature variation, the far-right list is an automated contour displaying the temperature and its associated Δy in meters.

3. Conclusion

In this report, we show the steps for seeking feasible parameters designing a physics problem conducive to a meaningful outcome that has a mixture of two flavors from two areas of physics; thermodynamics and mechanics. The objective is merely not to solve the proposed problem per se but rather to deduce a systematic solution conducive to exploring the range of numeric parameters to a meaningful practical output. The interested reader may expand on the given problem by for instance considering scenarios such as a massive piston, a non-ideal spring, a non-ideal gas, etc. As such for instance replacing the massless piston with a heavy one (2) modifies as F s F s + m g , where the added term is the weight of the piston. All the needed codes to investigate the modified version are embedded in bold-face in the report.

Acknowledgements

The author acknowledges the John T. and Page S. Smith Professorship funds for completing and publishing this work.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

References

[1] Halliday, D., Resnick, R. and Walker, J. (2021) Fundamentals of Physics. 11th Edition, John Wiley & Sons, Inc., New Jersey.
[2] Mathematica® V13.0. (2021)
http://Wolfram.com
[3] Wolfram, S. (2003) Mathematica Book. 5th Edition, Cambridge University Press, New York.
[4] Sarafian, H. (2019) Mathematica Graphics Examples. 2nd Edition, Scientific Research Publishing, Wuhan.
[5] Longair, M.S. (1984) Theoretical Concepts in Physics. Cambridge University Press, New York.
[6] Sarafian, H. (2022) Maxwell-Boltzmann Distribution, Mathematica Based Practitioner’s Approach. American Journal of Computational Mathematics, 12, 79-86.
https://doi.org/10.4236/ajcm.2022.121006

Copyright © 2024 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.