Graphics Programs Reference
In-Depth Information
11. The equation of an ellipse is x 2
a 2
y 2
b 2
/
+
/
=
1. Write aprogram thatcomputes
the length
2 a
1
S
=
+
( dy
/
dx ) 2 dx
a
of the circumference to four decimal places for given a and b . Test the program
with a
=
2 and b
=
1.
12.
The error function, which isofimportance in statistics, is definedas
x
2
π
e t 2 dt
erf( x )
=
0
Write aprogram that uses Gauss-Legendrequadraturetoevaluate erf( x )fora
given x to six decimal places. Note thaterf( x )
=
1
.
000 000 (correct to 6decimal
places) when x
>
5. Test the program by verifying thaterf(1
.
0)
=
0
.
842701.
13.
B
L
A
m
L
k
The sliding weight of mass m is attached to a spring of stiffness k thathas an
undeformed length L .When the mass is re leased fromrest at B , the time ittakes
to reach A can be shown to be t
C m
=
/
k , where
1
2
1 2 1 / 2
1 2
1
C
=
+
z 2
dz
0
Compute C to six decimal places. Hint: the integrand has a singularityat z
=
1
z 2 ) 1 / 2 .
that behaves as(1
14.
x
A
P
h
B
b
y
Search WWH ::




Custom Search