This week I worked on implementing a method for finding the range of a function in a given domain.
Following from last weeek's research on the same, I tried to develop these utility functions.
Here, I have defined the two functions along with some of their implementation details:
continuous_in(f, x, interval)
The function returns the sub-domains as an
Interval in case a discontinuity exists in the
interval. If the function is continuous in the entire domain, the
interval itself is returned.
For this we need to consider 2 primary conditions:
Domain constraints for real functions I have also added some code for domain constraints in
solve_univariate_inequalitymethod (as the name suggests, it solves univariate inequalities),
we calculate these constraints.
f(x) = sqrt(g(x)), we determine the range of values of
xfor which the function
g(x) >= 0.
f(x) = log(g(x)), the interval of
g(x) > 0is the constrained interval.
Singularities For determining the discontinuities, I tried to solve the reciprocal of the given function using
solveset(1/f, x, interval). The
singularitiesfunction can also be used here but its implementation is
restricted to rational functions only. There are possibilities of improving this function to create a universal
function which returns all the possible singularities of the function in a given domain.
function_range(f, x, domain)
Like the name suggests, this method returns the range of a univariate function in a given domain. This function is primarily designed for the purpose of
This function calls the above implemented
continuous_in method for finding the actual domain of
f. Following this, we iterate over each
Interval object returned by
By using the boundaries of the interval and first derivate test, we determine the crtical points in the interval
and their corresponding critical values.
For determining the values of the function at the singularities, we determine its limit at that point.
For this, I use the
limit function of SymPy.
After calculating the local extremas, I calculate the global minima and maxima using the
sup(supremum) of the
FiniteSet of all critical values. The range, which is the
Interval of these extremasm, is returned.
$ git log
That was all for this week.
My task for the upcoming days would be to update my
solve_decomposition method to accomodate these methods.
I aim to get all these PR merged before the midterm evaluation.