MA1MPRNU: Mathematical Programming Assignment 1: Ideal gas la, the van der Waals equatio, The Fourier series
MA1MPRNU: Mathematical Programming
Assignment 1
This assignment counts for 25% of the total marks of this module. Full marks for this assignment can be gained from complete answers to ALL questions and submitting the
Write a MATLAB program that can perform the following actions:
1. The ideal gas law provides one way to estimate the pressure exerted by a gas in a container. The law is
? = ??? ?
More accurate estimates can be made with the van der Waals equation
??? ??2 ?=−
? − ?? ?2
where the term ?? is a correction for the volume of the molecules and the term ??2/?2 is a correction for molecular attractions. The values of ? and ? depend on the type of gas. The gas constant is ?, the absolute temperature is ?, the gas volume is ?, and the number of gas molecules is indicated by ?. If ? = 1 mol of an ideal gas were confined to a volume of ? = 22.41 L at 0∘C(273.2 K), it would exert a pressure of 1 atm. In these units, ? = 0.08206.
For chlorine (Cl2), ? = 6.49 and ? = 0.0562. Compare the pressure estimates given by the ideal gas law and the van der Waals equation for 1 mol of Cl2 in 22.41 L at 273.2 K. What is the main cause of the difference in the two pressure estimates, the molecular volume or the molecular attractions?
[6 Marks]
2. The Fourier series is a series representation of a periodic function in terms of sines and cosines.. The Fourier series representation of the function
is ?(?)={ 1 0<?<? −1 −?<?<0
4 (sin? + sin3? + sin5? + sin7? + ⋯ ) ?1357
Plot on the same graph the function ?(?) and it's series representation, using the four terms shown.
On the same graph plot the allocated function as a solid red curve, with Linewidth 2, over the same interval and in the same figure. Label the x and y axes appropriately and use the appropriate title for the plot. Do not forget to save the plot as a jpg file and submit it along with your script.
[6 Marks]
3. Type this matrix into a MATLAB Script File to carry out the following instructions:
[1 mark]
- Use MATLAB command to create a 4 × 3 array ? consisting of all elements in the second through fourth columns of A (1 Mark).
- Use MATLAB command to create a 3 × 4 array ? consisting of all elements in the second through fourth rows of ? (1 Mark).
- Use MATLAB command to create a 2 × 3 array ? consisting of all elements in the first two rows and the last three columns of ? (1 Mark).
- Use MATLAB command to find the array product ? = ? ∗ ? (1 Mark).
4. Create a MATLAB Script File to plot Cayley's Sectic on the ?? plane over the
parametric interval −2? ≤ ? ≤ 2?, where ? = 3 : 1−3?2
? = 4? [?(3 − ?2)] (1 + ?2)3
Also, plot a Doppler Spiral on the same plot for ? = 2.2, ? = 0.5, and −2? ≤ ? ≤ 2? : ? = ?[? ⋅ cos(?) + ??],
? = ?? ⋅ sin(?)
Make sure to use enough points to create smooth curves. Provide a plot title, labels for the axes, and a legend for the two curves.
[Marks 8]
3 7 −4 12 −5 9 10 2
?=[613 811] 15 5 4 1
? = 4? [(1 + ?2)3]