You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to do #3 on the project and I have defined the f_m function as follows:
I think there may be something wrong with this because when I use incsearch on it I get this:
The text was updated successfully, but these errors were encountered:
At first glance I see a problem with the definition of tf. You're dividing by dmdt which preciously wasn't changing so it worked but in this case it is changing.
I was having the same problem. This is what I got
/code/
def incsearch(func,xmin,xmax,ns=50):
'''incsearch: incremental search root locator
xb = incsearch(func,xmin,xmax,ns):
finds brackets of x that contain sign changes
of a function on an interval
arguments:
---------
func = name of function
xmin, xmax = endpoints of interval
ns = number of subintervals (default = 50)
returns:
---------
xb(k,1) is the lower bound of the kth sign change
xb(k,2) is the upper bound of the kth sign change
If no brackets found, xb = [].'''
x = np.linspace(xmin,xmax,ns)
f = np.zeros(ns)
for i in range(ns):
f[i] = func(x[i])
sign_f = np.sign(f)
delta_sign_f = sign_f[1:]-sign_f[0:-1]
i_zeros = np.nonzero(delta_sign_f!=0)
nb = len(i_zeros[0])
xb = np.block([[ x[i_zeros[0]+1]],[x[i_zeros[0]] ]] )
if nb==0:
print('no brackets found\n')
print('check interval or increase ns\n')
else:
print('number of brackets: {}\n'.format(nb))
return xb
I am trying to do #3 on the project and I have defined the f_m function as follows:
I think there may be something wrong with this because when I use incsearch on it I get this:
The text was updated successfully, but these errors were encountered: