Question
Consider the formula that describes the variation in displacement with time. The goal of this exercise is develop a program that evaluates y for the
Consider the formula
that describes the variation in displacement with time. The goal of this exercise is develop a program that evaluates y for the range of t values found in file1.txt and file2.txt.
The format for file1.txt and file2.txt are similar. As an example, the first four lines of file1.txt are shown below:
v0: 3.00 t: 0.15592 0.28075 0.36807889 0.35 0.57681501876 0.21342619 0.0519085 0.042 0.27 0.50620017 0.528 ...
where the first two lines are always present, while the next lines contain an arbitrary number of t values on each line, separated by one or more spaces. The program will be made up of two primary components:
(a) A function that reads the input file and returns v0 and a list with the t values.
(b) A function that outputs to the screen two formatted columns containing the t value to the left and the corresponding y value to the right. The data output to screen should begin with a header 't y 'and then return all t-y pairs in increasing order of t. When outputting data, please return results to three decimal places. Note that the example output for the first four t-y pairs for file file1.txt are provided below.
t y 0.042 0.117 0.052 0.143 0.103 0.256 0.112 0.274 ...
Please write in Python.
y(t) = vot-0.5gt2 Consider the formula y(t)ot 0.5gt2 that describes the variation in displacement with time. The goal of this exercise is develop a program that evaluates y for the range of t values found in file1.txt and file2.txt. The format for filel.txt and file2.txt are similar. As an example, the first four lines of file1.txt are shown below: ve: 3.00 t: 0.15592 .28075.36807889 0.35 0.57681501876 0.21342619 0.0519085 0.042 0.27 0.50620017 0.528 where the first two lines are always present, while the next lines contain an arbitrary number of t values on each line, separated by one or more spaces. The program will be made up of two primary components: (a) A function that reads the input file and returns ve and a list with the t values. (b) A function that outputs to the screen two formatted columns containing the t value to the left and the corresponding y value to the right. The data output to screen should begin with a header 't y 'and then return all t-y pairs in increasing order of t. When outputting data, please return results to three decimal places. Note that the example output for the first four t-y pairs for file file1.txt are provided below t y 9.842 0.117 9.852 0.143 9.103 0.256 .112 .274Step 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