Skip to content

Commit

Permalink
fixing issue 1
Browse files Browse the repository at this point in the history
  • Loading branch information
zolabar authored Nov 29, 2021
1 parent 20823d7 commit 5219379
Showing 1 changed file with 70 additions and 13 deletions.
83 changes: 70 additions & 13 deletions exFinder/IexFinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Created on Wed Nov 3 08:42:17 2021
@author: zoufine Lauer Bare
v1.0.2
"""

import sympy as sym
Expand Down Expand Up @@ -41,21 +42,26 @@ def __init__(self):
)

trace = go.Table(
header=dict(values=['Stationary points', 'Eigenvalues and algebraic multiplicity', 'Type'],
line = dict(color='#7D7F80'),
fill = dict(color='#a1c3d1'),
header=dict(values=['<b>Stationary points</b>',
'<b>Eigenvalues and algebraic multiplicity</b>',
'<b>Type</b>'],
#line = dict(color='#7D7F80'),
#fill = dict(color='#a1c3d1'),
align = ['left'] * 5),
cells=dict(values=[[],
[],
[]],
line = dict(color='#7D7F80'),
fill = dict(color='#EDFAFF'),
#line = dict(color='#7D7F80'),
#fill = dict(color='#EDFAFF'),
align = ['left'] * 5))

#layout = dict(width=500, height=300)
data = [trace]
self.fig = go.FigureWidget(data=data)#, layout=layout)




f_num = sym.lambdify((x,y), eval(self.f.value))

x_ = np.linspace(-5, 5, 100)
Expand All @@ -79,10 +85,21 @@ def __init__(self):
title=r"$H_f(x, y)=%s$ " %(lH))

self.fig2.update_layout(
title=r"$f(x, y) = %s$ " %(lF))
title=r"$f(x, y) = %s$ " %(lF))

self.html = widgets.HTMLMath(
value=r"$\begin{matrix}\frac{\partial}{\partial x}%s=0\\\frac{\partial}{\partial y}%s=0\end{matrix}$"%(sym.latex(sym.diff(eval(self.f.value), x)), sym.latex(sym.diff(eval(self.f.value), y))),
#description=r'Gradien$',
)

self.html2 = widgets.HTMLMath(
value=r"$%s$"%(lH),
#description=r'Gradien$',
)

self.fig2.update_layout(template = 'plotly_dark')
#self.fig2.update_layout(template = 'plotly_dark')
#self.fig2.update_layout(template = 'ggplot2')
self.fig2.update_layout(template = 'simple_white')



Expand Down Expand Up @@ -213,10 +230,19 @@ def exFinder(self, f):


self.fig.update_layout(
title=r"$H_f(x, y)=%s$ " %(sym.latex(self.H(self.f))))
title="Stationary points and characterization"
)

self.fig2.update_layout(
title=r"$f(x, y) = %s$ " %(sym.latex(f)))
title=r"$f(x, y) = %s$ " %(sym.latex(f)))




self.html.value = r"$\begin{matrix}%s=0\\%s=0\end{matrix}$"%(sym.latex(sym.diff(f, x)), sym.latex(sym.diff(f, y)))

self.html2.value = r"$H_f(x, y)=%s$"%(sym.latex(self.H(self.f)))


return points, eigenvalues, eType

Expand All @@ -241,16 +267,47 @@ def compute(self):

container3 = widgets.HBox([
self.fig, self.fig2
])
container4 = widgets.HBox([self.colormap,
self.fig2])
])

html0 = widgets.HTMLMath(
value=r"$\begin{matrix}\frac{\partial f}{\partial x}=0\\\frac{\partial f}{\partial y}=0\end{matrix}$",
#description=r'Gradien$',
)


text = widgets.HTML(
value="Setting the gradient of <i>f</i> to zero, gives the following system of equation in <i>x</i> and <i>y</i>. Solving it yields the <b>stationary points</b>.",
#placeholder='Some HTML',
#description='Some HTML',
)

text1 = widgets.HTML(
value=" yields ",
#placeholder='Some HTML',
#description='Some HTML',
)

text2 = widgets.HTML(
value="Then, put the stationary points into the following <b>Hessian</b> and compute its eigenvalues.",
#placeholder='Some HTML',
#description='Some HTML',
)

container4 = widgets.HBox([text])

container5 = widgets.HBox([html0, text1, self.html])

container6 = widgets.HBox([text2])

container7 = widgets.HBox([self.html2])

display(widgets.VBox([container,
#container2,
container3,
#container4
container4,
container5,
container6,
container7,
]))

return

0 comments on commit 5219379

Please sign in to comment.