MAE 3403 Computer Methods in Analysis and Design Assignment

Assignment Help Python Programming
Reference no: EM132784762

MAE 3403 Computer Methods in Analysis and Design - Oklahoma State University

You will write four Python programs named hw2a.py, hw2b.py, hw2c.py and hw2d.py. Those programs will fulfill all of the requirements given in parts a, b, c, and d below. You will place those four python files into a single compressed file named hw2.zip. You will upload hw2.zip to the Homework 2 dropbox.

You will test your functions and using the particular numerical values and functions given.When we grade your assignment, we will run your program with those given numerical values, looking for correct answers. Then we will change the numerical values (including changing the SIZES of the arrays) and look for correct answers for those modified values as well. We will only use numerical values, array sizes and functions that make sense. We will not be testing your program to see how it handles bad data.

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 two exceptions: you may import functions from the math module and the copy module.

You must include reasonable comments in your code.

See your MAE 3013 textbook and 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 1/3 rule for numerical integration
The Gauss-Jordanelimination method for finding an inverse matrix.

a) Write a function defined as: defProbability(PDF,args,c, GT=True):

PDF: is the Gaussian/normal probability density function f(x) = (1/(σ√2Π)).e-1/2(x-μ/σ)2, which takes 1 argument containing values for x, μ (population mean), and σ (population standard deviation).
args: is a tuple containing μ and σ
c: is a floating point value
GT: is a boolean indicating if we want the probability of x being greater than c (GT=True) or less than c (GT=False)

To find the probability of x<c you should use the Simpson's 1/3 rule to integrate PDF between the limits of x=-5⋅σ to c.

Write and call a main() function that uses your Probability function to find:
P(x<1|N(0,1)): probability x<1 given a normal distribution of x with μ=0, σ=1
P(x>μ+2σ|N(175, 3))
Print you findings to the console in the following format:
P(x<1.00|N(0,1))=Y.YY
P(x>181.00|N(175,3))=Z.ZZ

b) Write a function defined as: def Secant(fcn, x0, x1, maxiter=10, xtol=1e-5):

Purpose: use the Secant Method to find the root of fcn(x), in the neighborhood of x0 and x1.

fcn: the function for which we want to find the root
x0 and x1: two x values in the neighborhood of the root
xtol: exit if the |xnewest- xprevious| <xtol
maxiter: exit if the number of iterations (new x values) equals this number
return value: the final estimate of the root (most recent new x value)

Write and call a main() function that uses your Secant function to estimate and print the solution of:
x-3cos(x)=0; with x0=1, x1= 2, maxiter = 5 and xtol = 1e-4
cos(2x).x3; with x0=1, x1= 2, maxiter = 15 and xtol = 1e-8
cos(2x).x3 with x0=1, x1= 2, maxiter = 3 and xtol = 1e-8

c) Write a function defined as: def GaussSeidel(Aaug, x, Niter = 15):

Purpose: use the Gauss-Seidel method to estimate the solution to a set of N linear equations expressed in matrix form as Ax = b. Both A and b are contained in the function argument - Aaug.

Aaug: an augmented matrix containing [A | b ] having N rows and N+1 columns, where N is the number of equations in the set.
x: a vector (array) contain the values of the initial guess
Niter: the number of iterations (new x vectors) to compute
return value: the final new x vector.

Write and call a main() function that uses your GaussSeidel function to estimate and print the solutions to the following sets of linear equations:

843_matrix.jpg

d) Write a function defined as: def Inverse(A):
Purpose of Inverse(A): use the Gauss-Jordan Elimination*to find the inverse of the A matrix.

A: is a square matrix of n-rows by n-cols.
return value: A-1 is the inverse of matrix A

Write and call a main() function that uses your Inverse function to calculate and print the solution A-1 matrix for the A matrices of part c). Also, verify that A-1 is in fact the inverse of A by performing the operation A-1A and obtaining the proper identity matrix. Use the inverse matricies to solve the equations in part c) and output the result to the console. Output statements should be informative and nicely formatted.

*note: you may use my code Gauss_Elim.py as a starting point for part d.

Attachment:- Computer Methods in Analysis and Design.rar

Verified Expert

The zip contains four python programs based on the document received. The first program is Gaussian probability density implementation using python language. We use the PDF(Normal Probability Distribution Function) which takes two arguments. The other program is an implementation of the Secant Method in finding the root of a function, f(x). Here we concentrated on the first function provided in the document description. The third program is based on Guass-Seidel solving of matrix problems. The fourth python program focuses on Gauss-Jordan method of solving Inverse of a matrix. It allows user to input the matrix using the Inverse function in python.

Reference no: EM132784762

Questions Cloud

Which methods has the smallest depreciation expense : Which methods has the smallest depreciation expense with no residual value? Sum-of-the-years'-digits. / Declining-balance. / Straight-line.
Explain diagnostic criteria for assigned sleep-wake disorder : The power of sleep to heal the body cannot be underestimated. Most research indicates that 7-8 hours of sleep are a minimum that people need to stay healthy.
What is the net present value and profitability index : Initial cost Option A $189,000 Option B $277,000. What is the (1) net present value, (2) profitability index, and (3) internal rate of return for each option
Breakdown of the project tasks : ABC Autoparts (producing automotive parts) they finally chose option B for a new production facility
MAE 3403 Computer Methods in Analysis and Design Assignment : MAE 3403 Computer Methods in Analysis and Design Assignment Help and Solution, Oklahoma State University - Assessment Writing Service
Why to determine whether or not a loans officer : Operations management describe which ratios would be used and why to determine whether or not a loans officer at the bank would loan a business money.
Explain what external stressors are associated with issue : Describe the contemporary issue and explain what external stressors are associated with this issue. Outline assessment strategies to screen for this issue.
Explain four purposes that an investigation report : Distinguish between a board meeting and a management meeting Explain four purposes that an investigation report may serve in a business enterprise
Identify three control weaknesses at bazaar : Identify three control weaknesses at Bazaar. For each weakness, indicate the implication and make a specific recommendation how Bazaar can fix it.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd