Solvers Part II03 Jul 2017
This a combined blog for progress of week-4 and week-5. The PR on ImageSet is merged in. As mentioned in my previous blog, I continued my work on implementing solvers for lower degree polynomials here.
We can now solve polynomials even with symbolic coefficients.
When FLINT is not supported,
if the order of the polynomial is <=4, then Solve Poly returns a FiniteSet of roots calculated using the known algorithms as described in detail here
When FLINT is supported,
solve_poly tries to fit the given input as a Flint Polynomial.
If it fails, then it will use the method described above. or else, It factorises the polynomial using the wrappers developed during community bonding period and returns the solutions found for each factor.
For solving inputs, if we already know that input is a kind of polynomial, initially i designed a different function here, But later upon Srajan’s suggestion, I went on to modify
from_basic<>() here to directly call
from_poly<>() if the input is a
I started working on implementing solvers for trigonometric equations. You can track its progress on trigsolve branch of my repo. I will make a PR once #1296 gets in.
Short story of how this is implemented :
- First, we figure out if given input is of type trigonometric/hyperbolic(excluding inverses). What I mean by
typeis whether if given input comprises functions of trigonometric/hyperbolic classes which are multiplied by or added to expressions independent of the symbol and the arguments of all these functions are linear in symbol.
- Then using
expand_as_exp(), we write all trigs/hyperbolics in the given equation in terms of
exp(I*x)is substituted with a dummy and solved using polynomial solver. using
invertComplexon the solutions thus found, we find the actual solutions of the given input.
For this^, I implemented a new function
as_real_imag() using visitor pattern for getting the real and imaginary parts. This was needed for implementing
invertComplex routine. Also, earlier subs was incapable of handling cases as described in the second point above. It is handled correctly now.
More on Trigonometric Solvers next time !!