Hello,

`ConditionSet` is a better way to represent unevaluated equations.
We can use this in nested unevaluated equations.
I tried to do nested conditonSet :

```
>>> b= ConditionSet(y, And(Eq(y, x**2 -x-5)),S.Reals)
>>> b
⎧                         2         ⎫
⎨y | y ∊ ℝ ∧ y = x  - x - 5⎬
⎩                                    ⎭


>>> ConditionSet(x,b,S.Reals )
# it is not printing this correctly.

```


Can we use this in the system of equations/nested expressions, if sympy 
can't evaluate them (Is it a good idea)?

--
Shekhar Prasad Rajak

On Thursday, 6 August 2015 17:48:09 UTC+5:30, Harsh Gupta wrote:
>
> Recently we implemented a ConditionSet [1] object which abstractly 
> represents a set of elements satisfying a particular condition taken from 
> another set S:
>
> {x|Cond(x) is True for x in S}
>
> ConditionSet gives us the ability to represent unevaluated equations and 
> inequalities in forms like `{x|f(x)=0; x in S}` and `{x|f(x)>0; x in S}` 
> but a more powerful thing about ConditionSet is that it allows us to write 
> the intermediate steps as set to set transformation. Some of the 
> transformations are:
>
>
> Composition: `{x|f(g(x))=0;x in S} => {x|g(x)=y; x in S,y in {z|f(z)=0; z 
> in S}}`
>
> Polynomial Solver: `{x|P(x)=0;x in S} => {x_1,x_2, ... 
> ,x_n}.intersection(S)` where `x_i` are roots of P(x)
>
> Invert solver: `{x|f(x)=0;x in S} => {g(0)| all g such that f(g(x)) = x}`
>
> logcombine: `{x| log(f(x)) + log(g(x));x in S}` => `{x| log(f(x)*g(x)); x 
> in S}`  if f(x) > 0 and g(x) > 0
>                                               => `{x| log(f(x)) + 
> log(g(x));x in S}` otherwise
> product solve: {x|f(x)*g(x)=0; x in S} => `{x|f(x)=0; x in S} U {x|g(x)=0; 
> x in S}` given f(x) and g(x) are bounded
>                                        => {x|f(x)*g(x)=0; x in S}
>
>
> Since the output type is same as input type any composition of these 
> transformations is also a valid transformation. And our aim is to find the 
> right sequence of compositions (given the atoms) which transforms the given 
> condition set to a set which is not a condition set i.e., FiniteSet, 
> Interval, Set of Integers and their Union, Intersection, Complement or 
> ImageSet [2]. We can assign a cost function to each set, such that, more 
> desirable that form of set is to us, the less the value of cost function. 
> This way our problem is now reduced to finding the path from the initial 
> ConditionSet to of the lowest valued set on a graph where the atomic 
> transformations forms the edges. I'm hoping this is a well-studied problem 
> and someone on this mailing list can redirect us to existing literature.
>
> Another good thing about this method is that we will be able to log and 
> output the intermediate steps required to reach the final solution. These 
> step-by-step solutions should be helpful in teaching and also to verify the 
> final solution is correct or not.
>
> Please lets us know what do think about this new proposed method.
>
> [1]: https://github.com/sympy/sympy/pull/9696
> [2]: ImageSet is abstract class in SymPy to represent sets like {f(x)| x 
> in S} 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/22bd68d7-0d14-484e-9b34-e3932a2ee4bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to