16 basic concepts
Exercise 2: Variables and arrays (continued)
- continued
b)
5x+3y−z= 10
3x+2y+z= 4
4x−y+3z= 12
c)
x 1 −2x 2 −x 3 +3x 4 = 10
2x 1 +3x 2 +x 4 = 8
x 1 −4x 3 −2x 4 = 3
−x 2 +3x 3 +x 4 = − 7
- Create a vectortthat ranges from 1 to 10 in steps of 1, and a vector
thetathat ranges from 0 toπand contains 32 elements. Now compute
the following:
x=2sin(θ)
y=t−^1
t+ 1
z=sin(θ
(^2) )
θ^2
- A discharge factor is a ratio which compares the mass flow rate at the
end of a channel or nozzle to an ideal channel or nozzle. The discharge
factor for flow through an open channel of parabolic cross-section is:
K=1.2x
[√
16x^2 + 1 +4x^1 ln
(√
16x^2 + 1 +4x
)]−^23
,
wherexis the ratio of the maximum water depth to breadth of the
channel at the top of the water. Determine the discharge factors forxin
the range 0.45 to 0.90 in steps of 0.05.
- Points on a circle
All points with coordinatesx=rcos(θ)andy=rsin(θ), whereris
a constant, lie on a circle with radiusr, i. e. they satisfy the equation
x^2 +y^2 =r^2. Create a column vector forθwith the values 0 ,π/4,π/2,
3π/4,π, and5π/4. Taker= 2 and compute the column vectorsxand
y. Now check thatxandyindeed satisfy the equation of a circle, by
computing the radiusr=
√
(x^2 +y^2 ).