Chemical Engineering Computations

Problem #1 – Central finite difference JacobianYou learned how to use the Newton-Raphson method to find the solutions (roots) of a 2Dsystem of equations using the forward finite difference to approximate the partial derivatives inthe Jacobian matrix. Your job is to modify the function to use the central finite difference toapproximate the Jacobian matrix. I have supplied the script(yourLastName_3854_HW7_P1_Newt_Raph.m) and function(yourLastName_3854_HW7_P1_Forward_J.m) files necessary to solve the system of equationsbelow:�!(�!, �”) = ‘c#,% + x! + x”+‘c&,% − 2x! − x”+’c’,% − x!+− 4 × 10()�”(�!, �”) = ‘c#,% + x! + x”+‘c&,% − 2x! − x”+“‘c*,% − x”+− 3.7 × 10(“Your tasks:• Modify the provided function to do the following:o Use the central finite difference instead of the forward finite difference toapproximate the Jacobian matrixo Save as (yourLastName_3854_HW7_P1_Central_J.m).• Modify the provided script to do the following:o Solve the system twice: once using a forward finite difference Jacobian and onceusing the central finite difference Jacobian.o Use true error instead of approximate error to determine when to terminateyour while loop.o Output the number of iterations and the true error using both methods.o Save as (yourLastName_3854_HW7_P1_Newt_Raph.m)• Turn in both the function that I provided (yourLastName_3854_HW7_P1_Forward_J.m)and your modified version (yourLastName_3854_HW7_P1_Central_J.m).Hints:• Use the specified initial conditions, error tolerance, and maximum iterations alreadydefined• No need to modify the inputs or outputs of the function• To calculate true error, you will need the true solutions to the system. Use MATLAB’sbuilt in fsolve function to obtain the “true” solutions before your while loop. I say“true” solutions because technically this is still a numerical approximation, but it is veryaccurate.• It may be easiest to just use two separate while loops separately calling each Jacobianfunction.HW 7 Chemical Engineering Computations Fall 2020ECH 3854 Dr. Thourson2• If you use two separate while loops, make sure you reset your iterations, approximateerror, and initial guess if you reuse your variable names.Bonus #1 – True error limit (1 point)• What happens when you try to improve the error (i.e. decrease specError)?• Why is it that there’s a limit on the true error that can be achieved? (Hint: what happensto dx?)• Answer these questions in the assignment comments.Problem #2 – Simpson’s 3/8 RuleUsing Simpson’s 3/8 Rule for multiple segments over an interval can be generally expressed as:5 �(�)��+,= 3ℎ8 [(�% + �-) + 3(�! + �” + �) + �. + ⋯ + �-(!) + 2(�/ + �0 + �1 … + �-(/)]Your tasks:• Write a script (yourLastName_3854_HW7_P2_Simp38.m) that uses Simpson’s 3/8 Ruleto approximate the integral of:�(�) = 5 + 12� − 150�” + 370�/ − 100�) + 300�.from � = 0 to � = 1 using � = 7 segments.Bonus #2 – Simpson’s 1/3 Rule (1 point)• Estimate the same integral in Problem #2 using Simpson’s 1/3 rule (just add to yourscript)• Find the true value of the integral using built-in MATLAB functions such asvpaintegral(func,x,xi,xf)and compare the true error of Simpson’s 3/8 vs. 1/3rules.Hints:• Simpson’s 3/8 Rule needs an odd number of segments.• Use MATLAB’s mod function to determine if � is divisible by 3 in your for loop• For Bonus #2:o Simpson’s 1/3 Rule needs an even number of segments.o Remember if you try to do both methods in the same script and reuse variables,that can cause issues. Either write a new script, rename the variables, or makesure you reset the variables before using the other method.

Sample Solution
Chemical Engineering Computations

Image result for Order Now images


Leave a Reply

Your email address will not be published. Required fields are marked *