Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
| Download
Project: Bernoulli configurations
Views: 217Image: ubuntu2004
Black Scholes formulas for European Call and Put
where , is Asset price, is Expiry Price, is expiry time, is bank interest rate, is time, and
Interact: please open in CoCalc
(S, t, T, E, r, sigma, y, dt)
This is .
Help on function show in module smc_sagews.sage_salvus:
show(*objs, **kwds)
Show a 2d or 3d graphics object (or objects), animation, or matplotlib figure, or show an
expression typeset nicely using LaTeX.
- display: (default: True); if True, use display math for expression (big and centered).
- svg: (default: True); if True, show 2d plots using svg (otherwise use png)
- d3: (default: True); if True, show graphs (vertices and edges) using an interactive D3 viewer
for the many options for this viewer, type 'import graphics; graphics.graph_to_d3_jsonable?'
If false, graphs are converted to plots and displayed as usual.
- renderer: (default: 'webgl'); for 3d graphics
- 'webgl' (fastest) using hardware accelerated 3d;
- 'canvas' (slower) using a 2d canvas, but may work better with transparency;
- 'tachyon' -- a ray traced static image.
- spin: (default: False); spins 3d plot, with number determining speed (requires mouse over plot)
- events: if given, {'click':foo, 'mousemove':bar}; each time the user clicks,
the function foo is called with a 2-tuple (x,y) where they clicked. Similarly
for mousemove. This works for Sage 2d graphics and matplotlib figures.
ANIMATIONS:
- animations are by default encoded and displayed using an efficiently web-friendly
format (currently webm, which is **not supported** by Safari or IE).
- ``delay`` - integer (default: 20); delay in hundredths of a
second between frames.
- gif=False -- if you set gif=True, instead use an animated gif,
which is much less efficient, but works on all browsers.
You can also use options directly to the animate command, e.g., the figsize option below:
a = animate([plot(sin(x + a), (x, 0, 2*pi)) for a in [0, pi/4, .., 2*pi]], figsize=6)
show(a, delay=30)
EXAMPLES:
Some examples:
show(2/3)
show([1, 4/5, pi^2 + e], 1+pi)
show(x^2, display=False)
show(e, plot(sin))
Here's an example that illustrates creating a clickable image with events::
@interact
def f0(fun=x*sin(x^2), mousemove='', click='(0,0)'):
click = sage_eval(click)
g = plot(fun, (x,0,5), zorder=0) + point(click, color='red', pointsize=100, zorder=10)
ymax = g.ymax(); ymin = g.ymin()
m = fun.derivative(x)(x=click[0])
b = fun(x=click[0]) - m*click[0]
g += plot(m*x + b, (click[0]-1,click[0]+1), color='red', zorder=10)
def h(p):
f0.mousemove = p
def c(p):
f0(click=p)
show(g, events={'click':c, 'mousemove':h}, svg=True, gridlines='major', ymin=ymin, ymax=ymax)
Interact: please open in CoCalc
Interact: please open in CoCalc