Continue: Simplified solution for Trigonometric Equation:
New Problems :
- When I tried more testcases having sqrt and other types I found new issues on
reduce_imagesetmethod. Some of the Simplified solutions contains undesired
Changes in solveset/_solve_radical
exp(I*x)terms and solving them we give Imageset, I added the
if isinstance(result, ImageSet) or any(isinstance(r, ImageSet) for r in result.args): return result
in the method.
factor_list in solve_trig :
There are many cases we can do factor of expression and solve each factor may give us more simplified solution.
I added the
factor_listand solving each factors and union the solution.
When I analyzed how
expform is solved and found correct order to use
factor_list,the summery is in this gist
- I implemented the above order and shifted the
ImageSet. I created
_union_simiplifya helper method for
_union_simplify better than my previous implementation :
Previous implementation was returning solution in simplified
ImageSet, although it passed the all test-case except 2-3 cases. But these 2-3 test-cases taught me you are doing over simplification. So now I understood that we should not simplify the
ImageSet(s)of the one factor solution, it may get simplified with other factor solution ImageSet(s).
Simplify them if there is difference of
pi, that means club [(2n + 1) and (2n) => (npi)] or [(2n* + 1) and (2npi + 2) => (n*pi)].
So now _solve_trig uses factor_list for trig eq and then solve each factor F_i. To solve each factor F_i first do
F_i.rewrite(exp) and get this exp form factors F_ij so now the unnecessary exp will come out that dont contribute in
final solution. That’s why we get simplified
ImageSet that will be Union with previous solution. Inside the
Union => _union => _union_simplify checks for simplification with already present
ImageSet. This is the process
till last factor F_i.
After working on blog for 1 week created my own blog template powered by Jekyll. and shifted the old blog into github. PR for the blog link update in planet: pull/42
Found a issue in
factor_list. issues/11198 , When I passed
f = sqrt(2)*sin(x) -1into
solvesetI got this problem.
factor_listissue I opened a PR pull/11201.