[image: Screenshot from 2017-10-30 22-44-41.png]

I can get the same answer. But that result is not that nice to handle. I
attached a solution the mathematica produces. It's a good bit more compact.

The additional symbols in the equation are:
D = 1/3(D_1 + D_2 + D_3)
Delta = \sqrt{D_1^2 + D_2^2 + D_3^2 - D_1 D_2 - D_1 D_3 - D_3 D_2}

It would be cool to be able to get the same answer with sympy.

On Mon, Oct 30, 2017 at 4:36 AM Chris Smith <[email protected]> wrote:

> I get the following when using auxiliary variables to make true your
> assumptions.
>
> >>> eq
> (0.2*exp(t*(4*d1 + 7*d2 + 7*d3)) + 0.2*exp(t*(7*d1 + 4*d2 + 7*d3)) +
> 0.2*exp(t*(
> 7*d1 + 7*d2 + 4*d3)) + 0.4*exp(t*(6*d1 + 6*d2 + 6*d3 + 2*sqrt(d1**2 -
> d1*d2 - d1
> *d3 + d2**2 - d2*d3
> <https://maps.google.com/?q=2+-+d2*d3&entry=gmail&source=g> +
> d3**2))))*exp(-8*t*(d1 + d2 + d3))
> >>> eq = nsimplify(eq)
> >>> p,q=var('p,q',positive=True)
> >>> factor_terms(nsimplify(eq.subs(d1,d3+p+q).subs(d2,d3+p).expand()))
> (1 + 2*exp(-2*p*t)*exp(-q*t)*exp(2*t*sqrt(p**2 + p*q + q**2)) +
> exp(-3*p*t) + ex
> p(-3*p*t)*exp(-3*q*t))*exp(-6*d3*t)*exp(-2*p*t)*exp(-q*t)/5
> >>> _.integrate((t,0,oo))
> Piecewise((2/(5*(1 + q/(d3*(3 + 2*p/d3)))*(1 - sqrt(p**2 + p*q +
> q**2)/(d3*(1 +
> q/(d3*(3 + 2*p/d3)))*(3 + 2*p/d3)))*(6*d3 + 4*p)) + 1/(5*d3*(1 +
> 4*q/(d3*(6 + 5*
> p/d3)))*(6 + 5*p/d3)) + 1/(5*d3*(1 + q/(d3*(6 + 5*p/d3)))*(6 + 5*p/d3)) +
> 1/(10*
> d3*(1 + q/(2*d3*(3 + p/d3)))*(3 + p/d3)),
> (Abs(periodic_argument(polar_lift(d3)*
> polar_lift(3 + p/d3), oo)) <= pi/2) &
> (Abs(periodic_argument(polar_lift(d3)*pola
> r_lift(6 + 5*p/d3), oo)) <= pi/2) &
> (Abs(periodic_argument(polar_lift(d3)*polar_
> lift(1 + q/(d3*polar_lift(3 + 2*p/d3)))*polar_lift(3 + 2*p/d3), oo)) <
> pi/2) & N
> e(sqrt(p**2 + p*q + q**2)/(d3*(1 + q/(d3*(3 + 2*p/d3)))*(3 + 2*p/d3)), 1)
> & (-2*
> sqrt(p**2 + p*q + q**2) +
> 2*cos(Abs(periodic_argument(polar_lift(d3)*polar_lift(
> 1 + q/(d3*polar_lift(3 + 2*p/d3)))*polar_lift(3 + 2*p/d3), oo)))*Abs(d3*(1
> + q/(
> d3*(3 + 2*p/d3)))*(3 + 2*p/d3)) > 0)), (Integral((1 +
> 2*exp(-2*p*t)*exp(-q*t)*ex
> p(2*t*sqrt(p**2 + p*q + q**2)) + exp(-3*p*t) +
> exp(-3*p*t)*exp(-3*q*t))*exp(-6*d
> 3*t)*exp(-2*p*t)*exp(-q*t)/5, (t, 0, oo)), True))
>
>
>
>
> On Thursday, October 26, 2017 at 11:13:34 AM UTC-5, Max Linke wrote:
>>
>>
>> <https://screenshots.firefoxusercontent.com/images/c1f24747-118b-41ba-9785-012212161d83.png>
>>
>>
>> Hi
>>
>> I'm trying to solve a integral with sympy.  To get meaningful results I
>> need to tell sympy that the assumptions d1>d2>d3 hold for the variables
>> in the integral. I tried this unsuccessfully:
>>
>> ```python
>> with assume.assuming(Q.is_true(d1 > d2), Q.is_true(d2 > d3)):
>>     integrate(C2, (t, 0, oo)
>> ```
>>
>> I've attached a image of the function C2 and a here is a notebook
>> <https://gist.github.com/kain88-de/3f019fff2ab8b5299edc9b0fb19caf93>
>> with my attempt at solving the integral.
>>
>> I appreciate help how to define these assumptions in sympy.
>>
>> With google I haven't found anything helpful on this topic. Only a 4 year
>> old SO post <https://stackoverflow.com/a/16435975/2207958> that this is
>> not possible.
>>
>> A colleague already checked with mathematica for me that given the
>> assumption d1>d2>d3 the integral
>> converges. So a solution does exist.
>>
>> best Max
>>
> --
> 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/3b675a36-dbe0-45e4-8891-dec9d8bcd99a%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/3b675a36-dbe0-45e4-8891-dec9d8bcd99a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAKRyePBrNERCJ%2Bd%3DKt7xrTtwfYzqN03DF27BN9Ty1foyoFQYnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to