Please answer the following questions in complete sentences in submit the solution on Blackboard Sept. 2nd, 2016.
Please complete parts (a) and (b) of G & C, Chapter 1, Problem 2
(From Matries with Applications (Hugh G. Campbell))
Suppose we construct a simple model economy in which there are three industries -- the crude oil industry, the refining industry that produces gasoline, and the utility industry which supplies electricity. Then suppose there are six types of consumers -- the general public, the government, the export firms, and the three industries. Both the industries and the consumers exercise certain consumptive demands on each of the industries. For instance, suppose that the crude oil industry needs to use 4 units of gasoline and 2 units of electricity. The demand vector, then for the crude oil industry, is expressed as Likewise, we specify the other demand vectors. In each case we list the goods demanded in the form: The demand vectors are:
Write a mathematical expression for the total demands on all three industries in terms of the demand vectors and evaluate the total demands.
Now suppose that the price of crude oil is 4-dollars per unit, the price of gasoline is 3-dollars per unit, and the price of electricity is 2-dollars per unit. We can express this with the vector . Assuming that the industries produce exactly what is demanded of them determine the profit of the crude oil industry.
In our in-class model for the xkcd raptor problem, we ignored the impact of acceleration. Wired did a long post about acceleration of sprinters. See the url
http://www.wired.com/wiredscience/2012/08/maximum-acceleration-in-the-100-m-dash/
(10 points) Using information from this post, construct a mathematical model of the position of sprinter on a line. Document and justify your assumptions
Determine difference in the distance traveled by the "idealized" sprinter that immediately begins running at 12 meters-per-second to the "real" sprinter that must accelerate to 12 meters-per-second after six second.
Write down the matrix for G&C, Chapter 1, Problem 5. You do not have to evalute the similarity
Write down the adjacency matrix for the graph in Figure 1.12
Evaluate the probability in G&C, Chapter 1, Problem 6a.
For this problem, we'll use Julia instead of Matlab.
Please complete all parts of G & C, Chapter 2, Problem 7 The hint for Julia would be
Updates based on plotly()
errors
(And also one correction! Note that the coordinates typed
from the book were wrong. The new coordinates are included
in the update.)
Original code (This no longer works for me :( )
using Plots
plotly(size=(500,500)) # use plotly for zooming and 500-by-500 for equal size
theta = linspace(0, 2*pi, 10000)
r = sqrt(2)
x = 2. + r*cos(theta)
y = 2. + r*sin(theta)
plot(x,y)
PlotlyJS code (This one works for me, but others have had issues with it.)
Pkg.add("PlotlyJS")
using Plots
plotlyjs(size=(500,500))
theta = linspace(0, 2*pi, 10000)
r = sqrt(2)
x = 2. + r*cos(theta)
y = 1. + r*sin(theta)
plot(x,y)
PlotlyJS code (This one works for me, but others have had issues with it.)
using Plots
pyplot(size=(500,500)) # this won't give you interactivity unless you are running from the command line
theta = linspace(0, 2*pi, 10000)
r = sqrt(2)
x = 2. + r*cos(theta)
y = 1. + r*sin(theta)
plot(x,y)
In this set of steps, you will write a Julia program to evaluate and draw the mandelbrot set.
The Julia set is a fractal. https://en.wikipedia.org/wiki/Julia_set#/media/File:Julia_set_(ice).png Read about the Julia set, either in the textbook or on Wikipedia, or in another reference and answer the following question. The best description I found was here
http://paulbourke.net/fractals/juliaset/
from Wikipedia. Describe how the coordinate of this pixel relates to the function .
A key step in building the julia set fractal is checking when
the sequence
remains bounded. Implement the following Julia function
"""
`julia_check` is a subroutine useful for working with the Julia
set fract. The function
returns the number of steps that we can iterate the sequence
z = zinput (from input)
znext = z*z + c
until the maginitude of the value z becomes larger than two or
until we hit 256 steps.
"""
function julia_check(z,c)
# fill this part in
end
and report the values of
julia_check(-1, 0.5+0.5im)
julia_check(0, 0.5+0.5im)
julia_check(-1, 0.5+0.25im)
julia_check(0, 0.5+0.25im)
We are now going to look at images of the complex plane spanned by and . (This is the region where the julia fractal is usually drawn.) Suppose we have pixels representing 20 equally spaced points on the real axis and pixels representing 20 equally spaced points on the imaginary axis, fill in the following code
nxpts =
nypts =
Z = zeros(nypts, nxpts)
for jj=1:nypts
for ii=1:nxpts
Z(jj,ii) =
end
end
such that Z(jj,ii) =
the magnitude of the point represented
by in the complex plane. Show the result
using the command
grayim(Z/maximum(Z))
Hint To include the output in your homework, note that you can save an image using
using FileIO
using ImageMagick
save("juliaset.png", Z/maximum(Z))
and then looking for the file juliaset in the juliabox file browser.
Now update your code and
let the value of Z(jj,ii)
be the number of iterations
taken by the mandelbrot iteration to escape when
that point is input to your julia_check
function
with
Improve the resolution of your mandelbrot picture as much as you can. (For full credit, you'll need to use at least 1,000,000 pixels (1000-by-1000).)
Change the value of to and show your new picture.
Which one do you like better?
Describe what you see or hear after the following commands.
1:100 |> sum
, what does this do? ?hi
"2 plus 2 is $(2+2)."