On Mon, Mar 1, 2021 at 4:58 PM Oscar Benjamin <[email protected]>
wrote:

> On Mon, 1 Mar 2021 at 13:43, Bruno Nicenboim <[email protected]>
> wrote:
> >
> > On Fri, Feb 26, 2021 at 9:01 PM Oscar Benjamin <
> [email protected]> wrote:
> >>
> >> I don't think your constraints are enough to determine what the
> >> correct solution should be. For example if we have the values:
> >> {mu_1:1, mu_2:2, tau:2, psi:1, x:2}
> >>
> >> Then neither solution satisfies the constraint:
> >
> > yes, it's true. I realize that a missing piece of information is that
> psi < min(mu_1,mu_2,x). Is there a way to include this to get only one
> solution from solveset?
> >
> > And is changing the domain of solveset the right approach?
>
> In principle yes, but I wouldn't be surprised if `solveset` is unable
> to handle a case like this.
>
> There isn't really a sympy function that handles this kind of case.
> The solve function can handle a mix of equations and inequalities but
> it doesn't treat them in the way that you want. The solveset function
> is only for a single equation so you would have to encode the
> inequality constraints in the domain somehow (which is not so easy for
> the last constraint you have shown).
>

ok, thanks!

But for example here:
```
K_pp = tau**2*(2*mu_1**2*mu_2**2*t**2*tau**4 + mu_1**2 + mu_2**2 +
t*(-2*mu_1**2*mu_2*tau**2 - 2*mu_1*mu_2**2*tau**2))/((mu_1*t*tau**2 -
1)**2*(mu_2*t*tau**2 - 1)**2)
```
This is another version without the psi, so the two constraints for t
should be enough. But this is still giving me two solutions

```
cset  = ConditionSet(t, t < 1/(mu_1 * tau**2)).intersect(ConditionSet(t, t
< 1/(mu_1 * tau**2)))
s_x = solveset(K_p - x, t, domain=cset)
```
As follows.
```
Intersection(ConditionSet(t, t < 1/(mu_1*tau**2)), {(-2*mu_1*mu_2 + mu_1*x
+ mu_2*x)/(2*mu_1*mu_2*tau**2*x) - sqrt(4*mu_1**2*mu_2**2 + mu_1**2*x**2 -
2*mu_1*mu_2*x**2 + mu_2**2*x**2)/(2*mu_1*mu_2*tau**2*x), (-2*mu_1*mu_2 +
mu_1*x + mu_2*x)/(2*mu_1*mu_2*tau**2*x) + sqrt(4*mu_1**2*mu_2**2 +
mu_1**2*x**2 - 2*mu_1*mu_2*x**2 + mu_2**2*x**2)/(2*mu_1*mu_2*tau**2*x)}) \
Intersection(ConditionSet(t, t < 1/(mu_1*tau**2)), {1/(mu_2*tau**2)})
```

I understand correctly that this is the right approach, but solveset is
just unable to find the right solution given the specific domain?

>
> There has been discussion recently on this last about adding a solver
> for systems of inequalities.
>
> --
> Oscar
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sympy" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sympy/oIKJ0nJHZC8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CAHVvXxQgpaZZOCAefpBpXPfLE3PnuvDnfuaN%2BdU50d%2B244RZnQ%40mail.gmail.com
> .
>


-- 
Bests,

Bruno Nicenboim

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHRDyEa9EMRmLA%3D596G%2BxWwyMtxS-%3DGOE9yBUtsA68tgpZ9eiQ%40mail.gmail.com.

Reply via email to