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 generating a bunch of expression trees somewhat randomly, where each expression tree represents a particular function of x.
For example, one expression tree could be:
*
/
cos 5
|
x0
which represents the function "cos(x0)*5". I can call this function tree_as_func(x).
I need to run "quadgk(x -> tree_as_func(x), 0, 1, rtol=1e-8)" where "tree_as_func" is the function of x that the current expression tree represents.
I do not know if "tree_as_func(x)" blows up to infinity on the domain x=[0, 1) or if its integral over x=[0, 1) is infinity.
As a result, I need to be able to catch errors. But this try-catch block fails to catch the error.
How can I do this?
The text was updated successfully, but these errors were encountered:
JuliaError: Exception 'UndefVarError:
integral
not defined' occurred while calling julia code:When I ran this code:
"
using QuadGK
try
integral, err = quadgk(x -> exp(1/(x-0.5)), 0, 1, rtol=1e-8)
catch
print("Error")
end
print(integral)
print(err)
"
I am generating a bunch of expression trees somewhat randomly, where each expression tree represents a particular function of x.
For example, one expression tree could be:
*
/
cos 5
|
x0
which represents the function "cos(x0)*5". I can call this function tree_as_func(x).
I need to run "quadgk(x -> tree_as_func(x), 0, 1, rtol=1e-8)" where "tree_as_func" is the function of x that the current expression tree represents.
I do not know if "tree_as_func(x)" blows up to infinity on the domain x=[0, 1) or if its integral over x=[0, 1) is infinity.
As a result, I need to be able to catch errors. But this try-catch block fails to catch the error.
How can I do this?
The text was updated successfully, but these errors were encountered: