Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public void store(String filename) { try { ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filename)); oos.writeObject(this); oos.close(); } catch (Exception e) { public void load(String filename) {

public void store(String filename) { try { ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filename)); oos.writeObject(this); oos.close(); } catch (Exception e) {

public void load(String filename) { try { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename)); College c = (College) ois.readObject(); ois.close(); this.collegeName = c.collegeName; this.count = c.count; this.persons = c.persons; } catch (Exception e) { System.out.println(e.getMessage());

give answers to all questions

image text in transcribedimage text in transcribedimage text in transcribed
The following two functions are algorithms for exponentiatron where r is a single- precision floating-point value and n is an integer, fun powerl (x, n) = if n=0 then 1.0 else x * power1(x, n-1) fun power2(x, n) = if n=0 then 1.0 else if even n then power2 (x * x, n div 2) else x * power2(x, n-1) (a) What is, roughly, the largest value of n that can be used without overflow when T is 10.0? [1 mark] (b) Suppose r is close to 1.0. (i) What is the worst possible relative error to expect in the answer from power1 when n = 100? [3 marks] (#) Can we say anything useful about the absolute error in part (b)()? [1 mark](a) Let f be a single variable real function that has at least one root a, and that admits a Taylor expansion everywhere. (i) Starting from the truncated form of the Taylor expansion of /(r) about In, derive the recursive expression for the Newton-Raphson (NR) estimate In of the root at the (n + 1) th step. [1 mark] (#) Consider the general Taylor expansion of f(o) about I,. Using big O notation for an appropriate Taylor remainder and denoting the NR error at the nth step by en, prove that the NR method has quadratic convergence rate. That is, show that ent is proportional to e, plus a bounded remainder. State the required conditions for this to hold, paying attention to the interval spanned during convergence. [6 marks] (ni) Briefly explain two of the known problems of the NR method from an implementation standpoint or otherwise. [2 marks] (b) Let /(x) - ' - 1. Suppose we wish to find the positive root of f using the Newton-Raphson (NR) method starting from an initial guess zo 2 1. (i) Show that if ro 2 1 then In 2 1 for all n 2 1. (3 marks]\f

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions