I am working on the front end of an engineering software, where I have an evaluator to return the value of a function at a point in a given domain, lets call it
f(x)is itself single parameter mathematical function, or a combination of such functions, and
xis any real number.
I need to validate
f(x) only over a continuous subset of the domain, and if the range of
f(x) in the given domain is out of bounds, I am supposed to return an error.
I also have a given domain this function is to work over, and the range this function is supposed to spew results over.
eval() itself returns certain error messages, such as 0 given inside a log function, (My backend can handle this at the domain's end point, so I need my frontend to not return an error when this case hits)
I basically want to know what individual values of the continuous domain I should evaluate my values at, and how do I evaluate my function in an exclusive range(so I can exclude the endpoints of my domain), what step size should I use to reasonably divide my given domain into values?
Keep in mind, I have no other mathematical operators apart from eval() I can use on my function, and I don't want to make my own for the sake of computer power, unless absolutely needed.
Extra info about the function: The
f(x)is a standard or a combination of standard functions, it is never a piece-wise defined function. Also, I only care about the rules I have of my own about the function: (e.g. is log(9999)>2222) rather than if log(0) is valid or not). I can also make do with a check for the range being a continuous range, and not having infinities or any close values in it.
I also don't expect my users to enter functions which are indeterminate, I just want to check the validity of the range of the entered functions(Against my own rules) rather than the correctness of the function itself, in case the function is invalid, I actually want to ignore that since
eval()already gives errors for those conditions(Apart from
f(x)domain endpoints, which I need to ignore specifically)
I don't really expect f'(x) to have a very high value either(unless its going towards infinity(e.g.
-log(x-1) at 1;
In the future, my
f(x) also might become
f(x,y), with a similar restrictions on the domain of
y, any advice on that?