Sie sind auf Seite 1von 3

Numerical Analysis Fall 2016

Deadline October 4, 2016


Problem 1: Implement the function
( )=

1
+
Try to evaluate this function for x=10, 100, 1000. Please explain the result. Find a way to
increase accuracy of the evaluation.
Verify results in MATLAB.
Problem 2: Implement the following procedure in MATLAB
Let c=0.1
for x from 1 to 15
= 10(
display r
end do

10(

Please explain the obtained results.


Problem 3: Compute the integral =
for k=0,1,2. Using integration by parts
show that =

, =1
.
Using your favorite programming system compute Ik for k=0,1,2,3,,25. Do you notice
anything wrong with your answers? To analyze this suppose that the only error is in : =
+ . Then if all calculations are exact, what is the error in Ik?
Problem 4:
Let eps = finfo(float).epsin in Python.
1. What is the value of log(exp(1000)) both analytically and in Python? Why do these differ?
2. Is eps/10 different from 0? If x = 1 + eps/10 - 1, is x different from 0?
3. Is 1-eps/ 10-1 difference from 0? What about 1-1-eps/ 10?
4. Is .1 different from .1+eps/10?
5. Is x = 10.0**120 (1 10^120) different from y = 10.0**120 + 10.0**102? (Hint: Test with
x == y)
6. Explain the results from Python:
In [1]: 0.1==0.10000000000000001
Out[1]: True
In [2]: 0.1==0.1000000000000001
Out[2]: False
7. Calculate the function
f(x)=(exp(2*x)-10)/1.5+x^2
x=0..15
Present the result as fixed point value and in the scientific notation.
9. What is the IEEE 754 standard?

Problem 5: On October 14, 2010 Benout B. Mandelbrot, a famous mathematician have died.
Mandelbrot is known as the inventor of fractals and this problem is dedicated to him. In this
problem you will generate the so-called quadratic Julia Sets, a well-known fractal example.
Given two complex numbers, c and z0, the following recursion is defined
=
+
For an arbitrary given choice of c and z0 , this recursion leads to a sequence of complex numbers
z1, z2, z3 . called the orbit of z0. Depending on the exact choice of c and z0, a large range of orbit
patterns are possible. For a given fixed c, most choices of z0 yield orbits that tend towards
infinity.
(That is, | | as
). For some values of certain choices of z0 yield orbits that
eventually will go into a periodic loop. Finally, some starting values yield orbits that appear to
dance around the complex plane, apparently at random (an example of chaos).These initial
values of z0 make up the Julia set of this recursion, denoted by Jc. Write a script that visualizes a
slightly different set, called the filled-in Julia set denoted by Kc, which is the set of all z0 with
orbits which do not tend towards infinity. The "normal" Julia set Jc is the edge of the filled-in
Julia set. The figure below illustrates a filled-in Julia Set for one particular value of c.
a) It has been shown that if | | > 2 for some n then it is guaranteed that the orbit will tend to
infinity. The value of n for which this becomes true is called the escape velocity of a particular z0.
Write a function that returns the escape velocity of a given z0 and c. The function declaration
should be:
n = EscVel(z0, c, N), where N is the maximum allowed escape velocity (i.e. if | | > 2 for
n < N, return N as the escape velocity, so you will prevent infinite loops).
b) To generate the filled-in Julia Set, write the following function
M = JuliaSet(zMax, c, N)
where zMax will be the maximum of the real and imaginary parts of the various of z0 for which we
will compute esape velocities, c and N are the same as defined above, and M is the matrix that
contains the escape velocity of various z0.
1. In this function, you first want to make a 500 500 matrix that contains complex numbers
with real part between - zMax and zMax, and imaginary part between -zMax and zMax. Call this matrix Z.
Make the imaginary part vary along the y-axis of this matrix. You can most easily do this by
using linspace and meshgrid commands, but you can also do it with a loop.
2. For each element of Z, compute the escape velocity (by calling your EscVel function) and
store it in the same location in a matrix M. When done, the matrix M should be the same size as
Z and contain escape velocities with values between 1 and N.
3. Run your JuliaSet function with various zMax, c, and N values to generate various fractals. To
display the fractal nicely, use imagesc command to visualize arctan(0.1*M), (taking the
arctangent of M makes the image look nicer, you also can use axisxy command so that y values
aren't flipped).
Below are some examples of figures obtained using different values of c:
M = JuliaSet(1,-0.297491 + i * 0.641051, 100)
and
M = JuliaSet(1,-0.491 + i*0.74, 100)

Das könnte Ihnen auch gefallen