Numerical Methods Final Requirements Shshsiwzb
Numerical Methods Final Requirements Shshsiwzb
1.) The arc length s of the parabolic segment BOC is given by s = ½(√𝑏 2 + 16𝑎2 ) +
𝑏2 4𝑎+√𝑏2+16𝑎2
(8𝑎) 𝑙𝑛 ( 𝑏
):
1 𝑅12 𝐶−𝐿
2.) 2. The resonant frequency f (in Hz) for the circuit shown is given by: 𝑠= 2𝜋
√𝐿𝐶 𝑅22 𝐶−𝐿
Calculate the resonant frequency when L = 0.2 henrys, R1 = 1500 ohms, R2 = 1500 ohms and C =
2 X 10^-6 farads.
3.) 3. Radioactive decay of carbon-14 is used for estimating the age of organic material. They decay
is modeled with the exponential function f(t) = f(0)ekt where t is time, f(0) is the amount of
material at t = 0, f(t) is the amount of material at time t, and k is a constant. Carbon-14 has a
half-life of approximately 5730 years. A sample of paper taken from the Dead Sea Scrolls shows
that 78.8% of the initial (t = 0) carbon-14 is present. Determine the estimated age of the scrolls.
Solve the problem by writing the program in a script file. The program first determines the
constant k, then calculates t for f(t) = 0.788 f(0), and then finally rounds the answer to the
nearest year.
4.) 4. The balance B of a savings account after t years when the principal P is invested at annual
interest rate r and the interest is compounded yearly is given by B = P(1+r)t. if the interest is
compounded continuously, the balance is given by B = Pert. An amount of $40000 is invested for
20 years in an account that pays 5.5% interest and the interest is compounded yearly. Use
MATLAB to determine how many fewer days it will take to earn the same if the money is
invested in an account where the interest is compounded continuously.
5.) 5. A projectile is launched at an angle θ and a speed Vo. the projectile’s travel time ttravel ,
maximum travel distance xmax, and maximum height hmax are given by: 𝑡𝑡𝑟𝑎𝑣𝑒𝑙 =
𝑉𝑜 𝑉𝑜2
2 𝑔
𝑠𝑖𝑛𝜃, 𝑥𝑚𝑎𝑥 = 2( 𝑔
) 𝑠𝑖𝑛𝜃𝑐𝑜𝑠𝜃 ,
𝑉𝑜2
ℎ𝑚𝑎𝑥 = 2 ( 𝑔
) 𝑠𝑖𝑛2 𝜃 . Consider the case where Vo = 600 ft/s and θ = 54°. Define Vo and θ as
MATLAB variables and calculate ttravel, , xmax and hmax . g = 32.2 ft/s2.
ACTIVITY #4: OPERATIONS ON ARRAY
1. A ball that is dropped on the floor bounces back up many times, reaching a lower height after
each bounce. When the ball impacts the floor, its rebound velocity is 0.85 times the impact
velocity. The velocity (v) with which a ball hits the floor after being dropped from a height (h) is
given by (V) = √2𝑔ℎ, where g = 9.81 m/s2. The time between successive bounces is given by t =
v/g, where (v) is the upward velocity after the last impact. Consider a ball that is dropped from a
height of 2m. Determine the times at which the ball hits the floor for the first 8 bounces. Set t =
0 when the ball hits the floor for the first time (Calculate the velocity of the ball when it hits the
floor for the first time. Derive a formula for the time of the following hits as a function of the
bounce number. Then create a vector n = 1, 2, ….8 and use the formula (Use element-by-
element operations) to calculate a vector with the values of t for each n). Display the results in a
column table where the values of n and t are displayed in the first and second columns
respectively.
2. An aluminum sphere (r = 0.2 cm) is dropped in a glass cylinder filled with glycerin. The velocity
of the sphere as a function of time v(t) can be modeled by the equation 𝑣(𝑡) =
𝑉(𝑝𝑎𝑙−𝑝𝑔𝑙)𝑔 𝑉(𝑝𝑎𝑙−𝑝𝑔𝑙)𝑔𝑘
√
𝑘
and tanh(√ 𝑉𝑝𝑎𝑙
𝑡)where v is the volume of the sphere, g = 9.81 m/s2 is
the gravitational acceleration, k = 0.0018 is a constant, and pal = 2700 kg/m 3 and pgl = 1260
kg/m3 are the densities of aluminum glycerin, respectively. Determine the velocity of the sphere
for t = 0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, and 0.35 s. Note that initially the velocity increases
rapidly, but then, due to the resistance of the glycerin, the velocity increases more gradually.
Eventually the velocity approaches a limit that is called the terminal velocity.
3. The position as a function of time (x(t),y(t)) of a projectile fired with a speed of Vo at angle 𝛼 is
given by x(t) = Vocos(𝛼𝑡) y(t) = Vosin(𝛼𝑡) - ½(gt2) where g = 9.81m/s2. The polar coordinates
𝑦(𝑡)
of the projectile at time t are (r(t),θ(t)), where r(t) = √𝑥(𝑡)2 + 𝑦(𝑡)2 𝑎𝑛𝑑 tan 𝜃 = . Consider
𝑥(𝑡)
the case where Vo = 162 m/s and θ = 70°. Determine r(t) and θ(t) for t = 1, 6, 11 ….31s.
6. The electrical circuit shown consists of resistors and voltage sources. Determine the current in
each resistor, using the mesh current method based on the Kirchhoff’s voltage law. V1 = 12V, V2
= 24V, R1 = 20Ω, R2 = 12Ω, R3 = 8Ω, R4 = 6Ω, R5 = 10Ω.
7. The electrical circuit shown consists of resistors and voltage sources. Determine the current in
each resistor, using the mesh current method based on the Kirchhoff’s voltage law. V1 = 12V, V2
= 24V, V3 =6V, R1 = 20Ω, R2 = 12Ω, R3 = 8Ω, R4 = 6Ω, R5 = 10Ω, R6 = 25Ω, R7 = 25Ω, R8 = 25Ω.
ACTIVITY#5: SCRIPT
1. The wind chill temperature Twc, is the air temperature felt on exposed skin due to wind.
In US customary units, it is calculated by Twc=35.74+0.6215t-35.75v0.16+0.4275tv0.16
where t is the temperature in degrees F and v is the wind speed in miles/hr. Write a
MATLAB program in a script file that calculates Twc. For input, the program asks the user
to enter values for T and v. For output, the programs displays the message: “The wind
chill temperature is: XX,” where XX is the value of the wind chill temperature rounded to
the nearest integer. Execute the program entering T=30 degrees Fahrenheit and v=42
miles/hour.
2. The monthly payment M of a loan amount of P for y years and with interest rate of r can
𝑃(𝑟/12)
be calculated by the formula: 𝑀 = 𝑟 Calculate the monthly payment and
1−(1+ )−12𝑦
12
the total payment for 100000$ loan for 10, 11, 12 …, 29, 30 years with an interest rate
of 4.85%. Display the results in three-column table where the first column is the number
of years, the second is the monthly payment and the third is the total payment.
3. When several resistors are connected in an electrical circuit in parallel, the current
through each of them is given by In =vs/(Rn) where In and Rn are the current through
resistor n in each resistance, respectively, and vs is the source voltage. The equivalent
resistance, Req, can be determined from the equation 1/Req = 1/R1+1/R2+1/R3+…+1/Rn.
The source current is given by is=vs/Req, and the power Pn, dissipated in each resistor is
given by Pn=vsIn. Write a program in a script file that calculates the current through each
resistor and the power dissipated in a circuit that has resistors connected in parallel.
When the script file runs, it asks the user to first enter the source voltage and then enter
the resistors’ resistance in a vector. The program displays the table with the resistance
shown in the first column, the current through the resistor in the second column, and
the power dissipated in the resistor in the third column. Following the table, the
program displays the source current and the total power. Use the script file to solve the
following circuit.
4. The graph of the function f(x) =aX4+bx3+cx2+dx+e passes through the points (-4, -7.6), (-
2, -17.2), (0.2, 9.2), (1, -1.6), and (4, -36.4). Determine the constants a, b, c, d and e.
(Write a system of five equations with five unknowns and use MATLAB to solve the
equations.)
ACTIVITY#6: PLOTTING
(𝑥+5)2
1. Plot the function 𝑓(𝑡) = 4+3𝑥 2
for -3 x 5.
5 sin(𝑥) 3𝑥
2. Plot the function 𝑓(𝑡) = 𝑥+𝑒 −0.75𝑥 − 5
for -5 x 10.
4. For many gases, the temperature dependence of the heat capacity Cp of can be
described in terms of a cubic equation:
𝐶𝑝 = 𝑎 + 𝑏𝑇 + 𝑐𝑇 2 + 𝑑𝑇 3
The following table gives the coefficient of the cubic equation for four gases Cp is in
joules/(g mol)(°C).
Gas a b c d
SO2 38.91 3.904𝑥10−2 −3.105𝑥10−5 8.606𝑥10−9
Calculate the heat capacity for each gas at temperatures ranging from 200° and 400°C at
20°C increments. To present the results, create an 11x5 matrix where the first column is
the temperature, and the second through fifth columns are the heat capacities of SO2,
SO3, O2, N2, respectively.
5. The wind chill temperature, Twc, is the air temperature felt on exposed skin due to
wind. In U.S. customary units, it is calculated by:
Where T is the temperature in degrees F, and v is the wind speed in mi/h. Write a
MATLAB program in a script file that displays the following chart of wind chill
temperature for given air temperature and wind speed in the Command Window:
Temperature (F)
40 30 20 10 0 -10 -20 -30 -40
Speed
mi/h
10 34 21 9 -4 -16 -28 -41 -53 -66
20 30 17 4 -9 -22 -35 -48 -61 -74
30 28 15 1 -12 -26 -39 -53 -67 -80
40 27 13 -1 -15 -29 -43 -57 -71 -84
50 26 12 -3 -17 -31 -45 -60 -74 -88
60 25 10 -4 -19 -33 -48 -62 -76 -91
8. A large TV screen of height H=50ft is placed on the side of the wall of a tall building.
The height from the street to the bottom of the screen is h=130ft. The best view of
the screen is when θ is maximum. Write a MATLAB program that determines the
distance x which θ is maximum. Define a vector x with elements ranging from 30 to
300 with spacing of 0.5. Use this vector to calculate the corresponding values of θ.
Then use MATLAB’s built-in function min to find the value of x that corresponds to
the largest value of θ.
1. Evaluate the following expresions without using MATLAB. Check the answer with
MATLAB.
a. 5+3>32/4
b. Y=2x3>10/5+1>22
c. Y=2x(3>10/5)+(1>2)2
d. 5x3-4x4<=~2x4-2+~0
2. Given a=6, b=2, c=-5. Evaluate the following expressions without using MATLAB. Check
the answer with MATLAB.
a. y=a+b>a-b<c
b. y=-6<c<-2
c. y=b+c>=c>a/b
d. y=a+c==~(c+a~=a/b-b)
3. Given v=[4 -2 -1 5 0 1 -3 8 2] and w=[0 2 1 -1 0 -2 4 3 2]. Evaluate the following
expressions without using MATLAB. Check the answer with MATLAB.
a. ~(~w)
b. w==v
c. w-v<w
d. w-(v<u\w)
4. Use the vectors v and w from Problem 3. Use relational operators to create a vector y
that is made up of the elements of w that are larger than or equal to the elements of v.
5. Evaluate the following expressions without using MATLAB. Check the answer with
MATLAB.
a. 0&21
b. ~-2>-1&11>=~0
c. 4-7/2&6<5|-3
d. 3|-1&~2*-3|0
6. The maximum daily temeperature (in degree F) for Chicago and San Francisco during the
month of August 2009 are given in the vectors below (data from the U.S. National
Oceanic and Atmospheric Administration).
TCH=[75 79 86 86 79 81 73 89 91 86 81 82 86 88 89 90 82 84 81 79 73 69 73 79 82 72 66
71 69 66 66]
TSF=[69 68 70 73 72 71 69 76 85 87 74 84 76 68 79 75 68 68 73 72 79 68 68 69 71 70 89
95 90 66 69]
Write a program in a script file to answer the following:
a) Calculate the average temperature for the month in each city.
b) How many days was the temperature above the average in each city?
c) How many days, and on which dates in the month, was the temperature in San
Francisco lower than the temperature in Chicago?
d) How many days, and on which dates in the month, was the temperature the same in
both cities?
7. Fibonacci numbers are the numbers in a sequence in which the first two elements are 0
and 1, and the value of each subsequent element is the sum of the previuos two
elements: 0 1 1 2 3 5 8 13 … Write a MATLAB program in a script file that determines
and displays the first 20 Fibonacci numbers.
8. Write a program in a script file that determines the real roots of a quadratic equation
ax2+bx+c=0. Name the file quadroots. When then file runs, it asks the user to enter the
values of a constants a, b, and c. To calculate the roots of the equation, the program
calculates the determinants D, given by:
D=b2-4ac
If D>0, the program displays message “The equation has two roots.” And the roots are
displayed in the next line.
If D=0, the program displays messgae “the equation has one root.” And the root is
displayed in the next line.
Run the script file in the Command Window three times to obtain solutions to the
following three equations:
a) 2x2+8x+8=0
b) -5x2+3x-4=0
c) -2x2+7x+4=0
10. Write a program script file that converts measure of volume given in units of either
m3,L,ft3, or gal (US gallons) to the equivalent quantity in different units specified by the
user. The program asks the user to enter the amount of volume, its current units, and
the desired new units. The output is the specification of volume in the new units. Use
the program to:
a) Convert 3.5m3 to gal
b) Convert 200L to ft3
c) Convert 480ft3 to m3
The speed of a race car during the first seven seconds of a race is given by:
t(s) 0 1 2 3 4 5 6 7
v(mi/h 0 1 3 6 9 11 12 13
r) 4 9 9 5 4 9 9
Determine the distance the car traveled during the first six seconds.