You are on page 1of 1

Assignment 1

Due: 10:30am Wednesday 12th of September Please submit at the start of class or email to geoffrey.wilde@ubc.ca before 10:30am.

1. Write and submit the code for a function which evaluates the real-valued Lambert W0 function using the NewtonRaphson method. That is, the function should nd the greatest root of the function fz (W ) = WeW z for given values of z 1 . As input arguments the function should take z and an integer, n, e which is the number of iterations of the NewtonRaphson method to apply. The initial guess used in the rst iteration should be ln (z + 1). The function should return the value of W found after completing n iterations. The behaviour of the function for invalid values of z or n need not be considered (but it is often a good idea to check). Note that fz has two roots for z < 0, however the above choice for the initial guess should ensure that the NewtonRaphson method will converge to the greater of the two roots. The function corresponding to the lower of the two is usually denoted W1 . 2. Use the function from (1) to compile a table of approximations to W0 for the following values of z and n: z = n = 1 , 0.1, 0, 0.1, 1, 10 e 1, 2, 3, 4, 10 .

The table should give the values to at least 5 decimal places.


3. Estimate the Darcy friction factor, f , for roughness factor D = 0.001 and Reynolds number Re = 6000 from the Lambert W0 form of the Colebrooke equation

f = AW0 where A = 2 ln(10), B = W0 .


3.7D ,

1 B exp AC AC
2.51 Re .

B C

and C =

Use the function from (1) with n = 4 to evaluate

You might also like