Try to find default x axis limits where function is defined
This commit is contained in:
parent
913fdf5247
commit
4395718e0c
@ -363,11 +363,23 @@ end
|
||||
xmin, xmax = try
|
||||
axis_limits(plt[1][:xaxis])
|
||||
catch
|
||||
-5, 5
|
||||
tryrange(f, [-5,-1,0,0.01]), tryrange(f, [5,1,0.99])
|
||||
end
|
||||
|
||||
f, xmin, xmax
|
||||
end
|
||||
|
||||
# try some intervals over which the function may be defined
|
||||
function tryrange(F, vec)
|
||||
for v in vec
|
||||
try
|
||||
tmp = F(v)
|
||||
return v
|
||||
catch
|
||||
end
|
||||
end
|
||||
error("Function not defined over the given interval, $vec")
|
||||
end
|
||||
#
|
||||
# # --------------------------------------------------------------------
|
||||
# # 2 arguments
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user