Hi, I'm Harsh Gupta I will be GSOC applicant this year. I want to discuss 
the solvers idea given on the Idea's page.
https://github.com/sympy/sympy/wiki/GSoC-2014-Ideas#solvers

Some of the aspect of the idea are discussed at 
https://groups.google.com/forum/?fromgroups=#!starred/sympy/8TM8cnuzkG8.


Aaron Meurer said:

I think with TransformationSet we can do quite a bit. That handles
> sets like {f(x) | x in A}. I think what is missing is the basic set
> builder {x | P(x)}, where P(x) is a boolean predicate.



Matthew Rocklin said:

> Real issue here - how to represent some solutions (e.g. sin(x)==0).
>
> In sets we would represent this with
> In [1]: imageset(k, pi*k, S.Integers)
> Out[1]: {π⋅k | k ∊ ℤ}


Implementing a general set builder will be very useful, we will need to 
define basic set operations like union
and intersection on them. We might use a syntax like `BuildSet(expr, 
sym_in_inputset, cond)` 

In [1]: BuildSet(pi*k, (k, S.Integers), True).intersect(0, 10)
Out[1]: {pi, 2*pi, 3*pi}


Matthew Rocklin said:

It sounds like maybe solve should return a Set.


I think it will be necessary to return set if we want to represent the 
solution of expressions like `floor(x) - 5`. 
See https://code.google.com/p/sympy/issues/detail?id=3975.
One problem I see with returning sets is that it can break a lot of 
existing code.


As mentioned in the idea page we need to have a method to check if solve 
returns all the solutions. For polynomials or expressions which are 
solved by converting to polynomials we can compare the degree of the 
polynomial to the number of solutions returned.

Other method can be verifying the number of the solutions by using the 
derivative of the function. Say we are given a *continuous* and 
*differentiable*  function f(x) and it's derivative w.r.t x is g(x),
then if g(x) has n solutions then f(x) cannot have more than n + 1 
solutions. So, if the solve returns n + 1 solutions for f(x) then we are 
guaranteed that we have found all the solutions.
For this we will need a discontinuity finder and we will also have to make 
sure that we have found all the solutions for g(x), i.e., the derivative of 
f(x), which can be done recursively or by using other methods.

A third way can be using numerical solver. Say we use solve to find the 
solution of f(x) for some interval [a, b] then we can also run the 
numerical solver for f(x) on [a, b] 
if the number of solutions by numerical solver and symbolic solve matches 
then we can be pretty sure that we have found out all the solutions of f(x) 
in [a, b]. 

--
Harsh

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to