Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a single Python program named Homework 2.py, that fulfills all of the requirements given below. You will upload that single Python file to the
Write a single Python program named Homework 2.py, that fulfills all of the requirements given below. You will upload that single Python file to the BrightSpace Dropbox labeled- Homework 2 Upload. The description below requires that you write five different functions. All five functions and the function named main0 which is used to call and test the five functions, must be placed in that single Homeworik 2py Python file. There is a file on Brightspace named Homework 2 main.py. This file contains the main0 function required to test the five functions that you will wite. You must copy that code into your program. When yoru upload your program to the dropbox, it must include this exact main function, with no changes to this main0 function. You will test your functions using the particular numerical values and functions given in the main function below. When we grade your assignment, we will run your program with those given numerical values, looking for coimect answers. Then we will change the numerical values (including changing the SIZES of the arays) and look for correct answers for those modified values as well. We will only use numerical values, ay sizes and functions that make sense. We will not be testing your program to see how it handles bad data (except for the Simpson function). In this assignment, you must use variables, loops, if statements, your own function definitions and function calls to write the required functions. For now, you may not use any of the powerful functions available in python modules, with one exception: you may import functions from the math module and the copy See the MAE 3013 Equation Sheet for a reminder of: The Secant Method for finding the solution (root or zero) or a nonlinear equation The Simpson's 13 rule for numerical integration The Gauss-Seidel method for solving a set of linear equations The Binomial and HyperGeometric functions from Probability and Statistics a) Write a function defined as: Pupose: use the Secant Method to find the root of fen(x), in the neighborhood of x def Secant(fen. x0.xl. xtol-le-5, maxiter=10): and fen: the function for which we want to find the root x0 andxl: two x values in the neighborhood of the root xtol: exit if the axtol maxiter exit if the number of iterations (new x values) equals this number retum value: the final estimate of the root (most recent new x value) and the number of actual iterations. Write a single Python program named Homework 2.py, that fulfills all of the requirements given below. You will upload that single Python file to the BrightSpace Dropbox labeled- Homework 2 Upload. The description below requires that you write five different functions. All five functions and the function named main0 which is used to call and test the five functions, must be placed in that single Homeworik 2py Python file. There is a file on Brightspace named Homework 2 main.py. This file contains the main0 function required to test the five functions that you will wite. You must copy that code into your program. When yoru upload your program to the dropbox, it must include this exact main function, with no changes to this main0 function. You will test your functions using the particular numerical values and functions given in the main function below. When we grade your assignment, we will run your program with those given numerical values, looking for coimect answers. Then we will change the numerical values (including changing the SIZES of the arays) and look for correct answers for those modified values as well. We will only use numerical values, ay sizes and functions that make sense. We will not be testing your program to see how it handles bad data (except for the Simpson function). In this assignment, you must use variables, loops, if statements, your own function definitions and function calls to write the required functions. For now, you may not use any of the powerful functions available in python modules, with one exception: you may import functions from the math module and the copy See the MAE 3013 Equation Sheet for a reminder of: The Secant Method for finding the solution (root or zero) or a nonlinear equation The Simpson's 13 rule for numerical integration The Gauss-Seidel method for solving a set of linear equations The Binomial and HyperGeometric functions from Probability and Statistics a) Write a function defined as: Pupose: use the Secant Method to find the root of fen(x), in the neighborhood of x def Secant(fen. x0.xl. xtol-le-5, maxiter=10): and fen: the function for which we want to find the root x0 andxl: two x values in the neighborhood of the root xtol: exit if the axtol maxiter exit if the number of iterations (new x values) equals this number retum value: the final estimate of the root (most recent new x value) and the number of actual iterations
Step 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