ECOR 1606 Practice Lab Final
The Sine Integral is defined as
( )
( )
∫
=
x
dt
t
t
x
Si
0
sin
GaussLegendre quadrature can be used to accurately approximate
Si
(
x
). The approximation is:
(
)
∑
=
≅
4
0
sin
)
(
n
n
n
x
A
x
Si
τ
where
A
0
= 2.5253303767
τ
0
= 0.0469100770
A
1
= 1.0370462484
τ
1
= 0.2307653450
A
2
= 0.5688888889
τ
2
= 0.5000000000
A
3
= 0.3111070642
τ
3
= 0.7692346550
A
4
= 0.1242940878
τ
4
= 0.9530899230
examples:
Si
(1) = 0.946083
Si
(2)
= 1.60541
Si
(3)
= 1.84865
Write a C++ function that, given
x
, approximates
Si
(
x
) and returns the result. Note that it is NOT
necessary to convert from degrees from radians when using function
sin
because the argument is already
in radians.
Then write a C++ program that finds the largest and smallest values of
Si
(
x
) for
b
x
a
≤
≤
. The largest
and smallest values are to be found by evaluating
Si
(
x
)
at
N
equally spaced values for
x
, starting with
x
=
a
and ending with
x
=
b
. Your program must make use of the function required above.
Your program should repeatedly read in values for
a
,
b
, and
N
until 0 0 0 is entered.
Note that
N
is an
integer.
For each set of values entered your program should either i) output an error message (if the
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '11
 duke
 Approximation, const const const

Click to edit the document details