Skip to main content
added 145 characters in body
Source Link
meraxes
  • 215
  • 2
  • 9

In Python, the resulting graph is very strange, and I don't believe itThis is correctpython implementation of the method of lines for the above equation should match the results in the matlab code here. I can't seem to find where I went wrong. Any insight on the Python code would be really helpful.

In Python, the resulting graph is very strange, and I don't believe it is correct. I can't seem to find where I went wrong. Any insight on the Python code would be really helpful.

This is python implementation of the method of lines for the above equation should match the results in the matlab code here. I can't seem to find where I went wrong. Any insight on the Python code would be really helpful.

deleted 7 characters in body
Source Link
meraxes
  • 215
  • 2
  • 9

I'm trying to model the Black-Scholes Equation (transformed in into a heat equation) using method of lines in Python.

\begin{equation*} u(x,0) = \max(e^a - 1, 0) \end{equation*}\begin{equation*} u(x,0) = \max(e^x - 1, 0) \end{equation*}

3d Plot

The plot, I believe should look like the following plot

I'm trying to model the Black-Scholes Equation (transformed in into a heat equation) using method of lines in Python.

\begin{equation*} u(x,0) = \max(e^a - 1, 0) \end{equation*}

3d Plot

I'm trying to model the Black-Scholes Equation (transformed into a heat equation) using method of lines in Python.

\begin{equation*} u(x,0) = \max(e^x - 1, 0) \end{equation*}

3d Plot

The plot, I believe should look like the following plot

Remove Matlab as tag
Source Link
nicoguaro
  • 8.6k
  • 6
  • 26
  • 51

\begin{equation*} \frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2} + (k-1)\frac{\partial u}{\partial x} - ku \end{equation*} where k

where $k$ is a constant and with initial condition   

\begin{equation*} u(x,0) = \max(e^a - 1, 0) \end{equation*} and

and boundary conditions   

\begin{equation*} u(a,t) = \alpha \hspace{35pt} u(b,t) = \beta \end{equation*}

In pythonPython, the resulting graph is very strange, and I don't believe it is correct. I can't seem to find where I went wrong. Any insight on the Python code would be really helpful.

\begin{equation*} \frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2} + (k-1)\frac{\partial u}{\partial x} - ku \end{equation*} where k is a constant and with initial condition  \begin{equation*} u(x,0) = \max(e^a - 1, 0) \end{equation*} and boundary conditions  \begin{equation*} u(a,t) = \alpha \hspace{35pt} u(b,t) = \beta \end{equation*}

In python, the resulting graph is very strange, and I don't believe it is correct. I can't seem to find where I went wrong. Any insight on the Python code would be really helpful.

\begin{equation*} \frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2} + (k-1)\frac{\partial u}{\partial x} - ku \end{equation*}

where $k$ is a constant and with initial condition 

\begin{equation*} u(x,0) = \max(e^a - 1, 0) \end{equation*}

and boundary conditions 

\begin{equation*} u(a,t) = \alpha \hspace{35pt} u(b,t) = \beta \end{equation*}

In Python, the resulting graph is very strange, and I don't believe it is correct. I can't seem to find where I went wrong. Any insight on the Python code would be really helpful.

edited body
Source Link
meraxes
  • 215
  • 2
  • 9
Loading
deleted 41 characters in body
Source Link
meraxes
  • 215
  • 2
  • 9
Loading
deleted 22 characters in body
Source Link
meraxes
  • 215
  • 2
  • 9
Loading
edited title
Link
meraxes
  • 215
  • 2
  • 9
Loading
added 41 characters in body; edited title
Source Link
meraxes
  • 215
  • 2
  • 9
Loading
added 3 characters in body
Source Link
meraxes
  • 215
  • 2
  • 9
Loading
added 6 characters in body
Source Link
meraxes
  • 215
  • 2
  • 9
Loading
edited tags
Link
meraxes
  • 215
  • 2
  • 9
Loading
added 65 characters in body
Source Link
meraxes
  • 215
  • 2
  • 9
Loading
Source Link
meraxes
  • 215
  • 2
  • 9
Loading