Skip to content

Instantly share code, notes, and snippets.

@marekyggdrasil
Last active May 2, 2019 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marekyggdrasil/17f61c8defdeaec4bf99e928b961f385 to your computer and use it in GitHub Desktop.
Save marekyggdrasil/17f61c8defdeaec4bf99e928b961f385 to your computer and use it in GitHub Desktop.
I encountered a problem related to usage of lambda functions to pass extra arguments to initial value problem solved from SciPy while used inside of Jupyter notebook environment. Perhaps someone more experienced with Jupyter could help out in the comments.
from scipy.integrate import solve_ivp
import numpy as np
def exponential_decay(t, y, alpha, beta): return -alpha*y + beta
for alpha in np.linspace(0.5, 0.7, 5) :
beta = 1.
sol = solve_ivp(lambda t, y: exponential_decay(t, y, alpha, beta), [0, 10], [2, 4, 8])
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment