Question
Arc Length This problem asks you to write a c++ program that calculates the arclength of a 3D curve using the simpson numerical integration techniques
Arc Length
This problem asks you to write a c++ program that calculates the arclength of a 3D curve using
the simpson numerical integration techniques discussed in class on Wednesday, June 27. 3D curves are often represented parametrically as a triple (x(t), y(t), z(t)) where the parameter t is over an interval [a, b]. For example,
x(t) = cos(t)
y(t) = sin(t)
z(t) = t
is a helix. As a second example,
x(t) = sqrt(100-t2)
y(t) = t sin(t)
z(t) = t cos(t)
for t on the interval[0, 8] is a spiral-type curve on the surface of a sphere. The arclength of a 3D parametric curve over [a, b] is given by the formula
A =
Remember than here x, y, and z are all functions of t.
Write a C++ program that uses Simpsons method to estimate this integral for the second curve above (the spiral-type curve on the sphere) over t [0, 8]. Specifically, your program should consist of the following:
Your main program. This program should first estimate the arclength using Simpsons method with 2 intervals, then with 4 intervals, then with 8, and so on each time doubling the number of intervals until two successive estimates of the integral differ by less than 10^4.
The function simpson. You should copy this from the class Canvas page exactly as it appears there.
A function f(t) that takes in a double t and returns the value of
It should do this by calling the functions dx, dy, and dz (see the next item).
Three functions dx, dy, and dz. The function dx should take in a double t and return the derivate x'(t). Similarly, dy and dz should take in t and return the derivates y'(t) and z'(t), respectively.
Additional notes:
You should copy the simpson function from the class webpage and use it exactly as it is. This assignment does not ask you to write or modify this function, only to use it.
The functions dx, dy, and dz must contain the formulas for x'(t),y'(t), and z'(t), respectively. You will need to derive these formulas manually.
As usual, make sure your input and output follow the format shown in the example below, including showing 8 digits to the right of the decimal point.
Your program should find the arclength of the second curve mentioned in this problem. The first curve, the helix, is given only as a example.
This program involves a number of functions (main, f, etc.) None should be long. However, you need to make sure you get each part correct, and you need to make sure you have the relations among these different functions correct as well. Develop your program incrementally write one part, test and correct it until you are satisfied it is correct, then go to the next part rather than trying to write the entire program at once.
When developing your program, begin with simpler functions such as
x(t) = t y(t) = cos(t)
z(t) = t^2
for t [0, 8]. The output for this example is given below.
Intervals: 2 Intervals: 4 Intervals: 8
Approximation: 65.93669408 Approximation: 65.55012815 Approximation: 65.42387072
2
Intervals: 16 Intervals: 32 Intervals: 64 Intervals: 128
Approximation: 65.37289678 Approximation: 65.36773814 Approximation: 65.36762352 Approximation: 65.36762330
(Note that this is just a test case. Make sure the program you turn in uses the actual function for this part, not this test case function.)
Part of this problem is also for you to figure out how to determine when your output is correct. Think about ways to assess this when you dont know the actual answer in advance.
dt dtStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started