Merge pull request #1115 from mkborregaard/default-function-limits
Function default x limits: fix #1109
This commit is contained in:
commit
bcc2f089be
@ -363,11 +363,24 @@ end
|
|||||||
xmin, xmax = try
|
xmin, xmax = try
|
||||||
axis_limits(plt[1][:xaxis])
|
axis_limits(plt[1][:xaxis])
|
||||||
catch
|
catch
|
||||||
-5, 5
|
xm = tryrange(f, [-5,-1,0,0.01])
|
||||||
|
xm, tryrange(f, filter(x->x>xm, [5,1,0.99, 0, -0.01]))
|
||||||
end
|
end
|
||||||
|
|
||||||
f, xmin, xmax
|
f, xmin, xmax
|
||||||
end
|
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
|
# # 2 arguments
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user