dynamic interactivity in economic with mathematica filedynamic interactivity in economic modeling...

16

Upload: others

Post on 30-Oct-2019

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Page 2: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Dynamic Interactivity in Economic Modeling

with Mathematica 6:][: Motivation"A picture may be worth a thousand words, but a good animation is worth much more."

Selwyn Hollis, Professor of Mathematics, Armstrong Atlantic State University

by Jozef Baruník

Institute of Information Theory and AutomationAcademy of Sciences of the Czech Republic

2 Baruník.nb

Page 3: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Today's Talk

:] i [: Introduction to Dynamic Interactivity in Mathematica 6"Examples speaks for everything"

:] ii [: Capabilities of Mathematica That Defines Dynamic Interactivity

:] iii [: Examples of Economic Modeling Application

Baruník.nb 3

Page 4: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Motivation Examples"A picture may be worth a thousand words, but a good animation is worth much more." ...

Ever wanted to explore Chaotic systems in real-time? In Mathematica 6, it is possible with onesingle command...

:][: Lorenz Attractor

3-dimensional chaotic structure used as prime example of an chaotic system, is governed byfollowing equations:

d xd t

= s Hy - xLd y

d t= x Hr - zL- y

d zd t

= x y - b z,

where s is Prandtl number, r is Rayleigh number, s, r, b > 0. System exhibits chaotic behaviorfor r = 28

4 Baruník.nb

Page 5: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Motivation Examples cont.

:][: Lorenz Attractor

Drag the graphics with mouse to rotate, drag while holding Shift to move, drag while holding Altto zoom, use "+" to Show Animation Controls !!!

time 10

parameters

b8

3

s 10

r 67.5

initial conditions

x0 1

y0 5

z0 10

Set Initial Values

Baruník.nb 5

Page 6: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Motivation Example cont.

:][: Fractal Trees

Immediately Create Complex Dynamic Graphics

horizontal offset

vertical offset

number of steps

6 Baruník.nb

Page 7: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Interactive Manipulation

Single function Manipulate gives immediate access to a huge range of powerful interactive capa-bilities. Researcher can instantly create full-function dynamic interface as a routine part of every-day work.

Manipulate [ expr , { u , umin , umax } ]

where "u" is parameter of "expr" which we want to be interactive, within range specified bylowerbound umin and upperbound umax.

Baruník.nb 7

Page 8: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Adding Dynamics

:][: Manipulate a and b in f(x) : y = Sin( a x) + Sin(b x)

With this simple code we get dynamic interactive panel with controls:Manipulate@Plot@Sin@α xD + Sin@β xD, 8x, 0, 2 Pi<D, 8α, 1, 20<, 8β, 1, 20<D

a

b

1 2 3 4 5 6

-2

-1

1

2

8 Baruník.nb

Page 9: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Graphics Far Beyond Plotting

:][: Slider, 2D Slider and Locator

With little bit of simple code, we are able to give our study an "extra dimension".

Manipulate@

Graphics@8Line@Table@88Cos@tD, Sin@tD<, pt<, 8t, 2. Pi ê n, 2. Pi, 2. Pi ê n<DD<, ImageSize → 8300, 300<D,

88n, 30<, 1, 200, 1<, 8pt, 8−1, −1<, 81, 1<<, 88pt, 80, 0<<, Locator<, ControlPlacement → LeftD

n

pt

Baruník.nb 9

Page 10: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Power to Illustrate and Demonstrate

:][: Derivative of a function

How many students really understand the concept of derivatives at first sight? Why not toemploy locator ???

polynomial trigonometric logarithmic

tangent line first derivative second derivative

2 4 6 8 10

-4

-2

2

4

»

10 Baruník.nb

Page 11: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Mathematica's Dynamic Interactivity

in Economic modeling

Baruník.nb 11

Page 12: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Interactive Generation / Simulation of Artificial d ata

We can interactively study behavior of any process, example shows IGARCH(1,1) generation,using mathematica, we can easily create interfaces for simulating any kind of process, evenexport it into external file.

IGARCHH1,1L

Simulated series Simulated Volatility

a0 0.5

b1 0.2

New Random Case

Export Simulated Series

100 200 300 400 500

-10

-5

5

10

12 Baruník.nb

Page 13: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Interactive OLS Polynomial Curve-Fitting EnviromentWith 2 lines of code, we are able to create interactive dynamic interface for OLS curve fitting:

Manipulate@Module@8x<, Plot@Fit@points, Table@x^i, 8i, 0, order<D, xD,

8x, −2, 2<, PlotRange → 2, ImageSize → 500, Evaluated −> TrueDD,

88order, 3<, 1, 10, 1, Appearance → "Labeled"<,

88points, RandomReal@8−2, 2<, 85, 2<D<, Locator, LocatorAutoCreate → True<D

order 3

-2 -1 1 2

-2

-1

1

2

Baruník.nb 13

Page 14: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Interactive Cobb-Douglas Production FunctionsCobb-Douglas functions are used in economics to show the relationship between input factorsand the level of production, and is of form a l a k b, where l and k are factors of production (laborand capital)

scaling factor

[email protected], 0.505, 0.53DA�, kE

Cobb-Douglas Production Function

method ContourPlot Plot3D

14 Baruník.nb

Page 15: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Exploring Black-Scholes Model and Behavior of Greeks

European Option Price

option price call put

European Option Greeks

call sensitivities call delta call gamma call rho call vega call theta

put sensitivities put delta put gamma put rho put vega put theta

European Option Parameters

strike price 70.

interest rate 0.0396

dividend yield 0.0172

volatility 0.234

time to maturity 0.141

Plot type 2D 3D

80 100 120 140

20

40

60

80

option price

Stock Price:129.Call Option Price:59.0773

Baruník.nb 15

Page 16: Dynamic Interactivity in Economic with Mathematica fileDynamic Interactivity in Economic Modeling with Mathematica 6:][: Motivation "A picture may be worth a thousand words, but a

Any Questions?

Thank you for your attention !

16 Baruník.nb