[SOLVED] 5DV005-Lab 4 MySinh, MyNewtonSqrt and MyLog

20.99 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

Rate this product

Problem 1

  1. Develop a function MySinh which computes the function

.

You may use the built-in function exp to evaluate ex when |x| is sufficiently large, but you must rewrite f to avoid the subtractive cancellation at when x ≈ 0.

  1. Develop a minimal working example MySinhMWE which compares your implementation to the built-in function sinh. It is possible to reduce the relative error below 10−15 on the interval [−3,3].

Problem 2

  1. Develop a function MyNewtonSqrt which uses Newton’s method for computing square roots subject. Your function must use the initial guess

for       s when s ∈ [1,4].

  1. Develop a minimal working example MyNewtonSqrtMWE1 which compares your implementation to the built in function sqrt. It is possible to reduce the relative error to 2u on the interval [10

Problem 3

  1. Develop a function MyLog which uses Newton’s method to solve the non-linear equation f(x) = 0 where f(x) = exp(x) − α and α > Your function must exploit the fact that if α = f · 2e, then

log(α) = log(f) + elog(2)

Your are free to use the special function log2 to determine f and e. You are free to use the built-in value of log(2). Your function must use the initial guess

for log(s) when s ∈ [1,2].

  1. Develop a minimal working example MyLogMWE which compares your implementation to the built-in function log. It is possible to reduce the relative error below 2u on the interval [2,10].

Problem 4

  1. Copy the script scripts/l4p4.m into the function work/MyRobustSecant.m and complete the function according to the specification.

Develop a minimal working example MyRobustSecantMWE which solves the your favorite non-linear equation. I recommend computing a firing solution

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.