Indian Institute of Technology Kharagpur Department of Mathematics MA39110-Advanced Numerical Techniques Lab End Sem Exam * Date: 16.04.2022 * Mode: Online Spring 2022 Time-duration: 30 minutes Total Marks = 40 Instructions: • Complete the codes in each question by editing the MATLAB codes provided to you in the zipped folder. • Do not alter the rest of the codes, only write your line of codes in the blank space provided after every question, written as a comment. • Marks will be deducted if the code fails to run and shows any kind of unacceptable error. Try to use MATLAB versions R2016b and above. • While submitting, rename the zipped folder as Rollno ANTLAB. • Write your name and roll number on the top of all 3 MATLAB Codes. • Your video shall be ON and audio shall be OFF. Failure of this will lead to cancellation of your exam. • Only MOODLE SUBMISSION is allowed – link will be open between 10:15 and 10:40 am. The submission time will not be extended under any circumstances. • 5 marks will be deducted if not submitted by 10:40 am. • No outputs are required for any question. Only code has to be submitted. 1. Solve the non-linear boundary value problem using Newton-Raphson method with the help of a MATLAB code. y ′′ − 3y − 10y 3 = x2 , y(0) = 0 y(1) = 0 with step size h = 0.5. Find the following 4 questions in the MATLAB Code named Q1: (a) Write a command here to call the NRM function and store its value in the variable y1 val. (b) Write a three line code here for Newton Raphson Method. (c) Calculate error here and save it to err variable. (d) Write a print statement to display the number of iterations executed. [12 marks] 1 2. Solve the following linear boundary value problem using spline interpolation method with the help of a MATLAB code: y ′′ + Ay ′ + By = C, y(0) = α, y(1) = β, where A = −2, B = 1, C = 1, α = 2 and β = e + 1 with the step size h = 0.1. Find the following question in the MATLAB code named Q2: (a) Write the equations for k = n − 1. [12 marks] 3. Consider a thin metal wire of length two meters with no heat exchange with its surroundings such that the heat conductivity of wire is 0.3. Initially the wire is heated with a temperature distribution x2 (L2 − x2 ) at time t = 0 while both ends of the wire are kept at a fixed temperature of 0 c for all times t. Then solve the one-dimensional heat equation to obtain the temperature distribution at a later time t using Crank Nicolson method by solving a triadiagonal system of linear equations with the help of a MATLAB code. Find the following 4 questions in the MATLAB code named Q3: (a) Write down a three line code for entering initial temperature distribution. (b) Write down a three line code which includes a time loop and call the function Tridiag(r, RHS) (See at the end of code) to write the Crank Nicolson iteration scheme. (c) Write down a small code to plot u vs x at specific time points t = 100, 300, 500, 1500. (d) Write down a small code using a for loop (Back substitution loop) for returning the value of u to the function Tridiag. [16 marks] 2