Loading files
515dcb91fThis file is pinned to the selected release. Download the original to open it in your design tool.
Files from this revision, including CAD and LFS contents. Git history is not included.
Or in GitHub Desktop, choose File → Clone repository → URL and paste this address.
Public repositories can be cloned without signing in. For pushing, use your ThingAtlas username and a Git access token as the password.
git lfs install git clone https://thingatlas.com/git/-unclaimed/tulipcc-498083946.git
Includes Git history, branches, and Git LFS files. Clones the repository’s default branch, regardless of the version shown here.
import math
try:
from ulab import scipy as spy
except ImportError:
import scipy as spy
def f(x):
return x**2 - 2.0
ref_result = 1.4142135623715149
result = (spy.optimize.bisect(f, 1.0, 3.0))
print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
ref_result = -7.105427357601002e-15
result = spy.optimize.fmin(f, 3.0, fatol=1e-15)
print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
ref_result = -7.105427357601002e-15
result = spy.optimize.fmin(f, 3.0, xatol=1e-8, fatol=1e-15, maxiter=500)
print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
ref_result = 1.41421826342255
result = (spy.optimize.newton(f, 3.0, tol=0.001, rtol=0.01))
print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
result = (spy.optimize.newton(f, 3.0, tol=0.001, rtol=0.01, maxiter=100))
print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
515dcb91fThis file is pinned to the selected release. Download the original to open it in your design tool.