The natural logarithm can be computed using the series expansion
(1-1) 0<2≤2.
To extend the range of possible values, we may write
where k is an integer, and then
Copyright By PowCoder代写 加微信 powcoder
In(y) = klm(2) + In(x).
Write a Maple procedure which takes as its argument an arbitrary positive number y, and
computes In(y) as follows.
• If 0.5 < y < 1.5 then put k = 0. Otherwise, use do loops to find the unique integer k
such that 2k-1
Compute r using (+) and then In(2) using (*).
• Finally, compute In(y) using (‡).
Test your procedure for at least three input values.
The idea here is that all logarithms can be computed efficiently provided In 2 is known; hence
you must not use a logarithm to find k. However you can use the built in logarithm function
to find In(2).
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com