On Mon, Apr 13, 2015 at 6:54 PM, Carsten Knoll <[email protected]> wrote:
> Thanks for the clarifications,
>
> On 04/13/2015 06:28 PM, Aaron Meurer wrote:
>> On Fri, Apr 10, 2015 at 3:54 AM, Carsten Knoll <[email protected]> wrote:
>>>
>>> 1. What does an object like
>>>
>>> Integral(F(t), (t, 0))
>>>
>>> mean?
>>
>> It means the integral of F(t), evaluated at t = 0. It's the same as
>> Integral(F(t), (t, a, 0)) except we don't want to create a new
>> arbitrary symbol a.
>>
>> Normally this is not a well-defined concept, but for solutions from
>> dsolve, it is, because there is always a + C arbitrary constant factor
>> in the solution that absorbs the term with a.
>
> OK. But anyway: wouldn't it be simpler for dsolve (from user point of
> view) to return a Integral object with two boundary values the lower
> being zero and the upper being t. If I see it right, this formulation of
> the solution has the same level of generality but the advantage that it
> is possible to perform useful calculation with the result. E.g. I want
> to determine C1 in terms of the intial value x(0).

Maybe, but it's potentially harder to work with a dummy symbol because
you'd have to extract it from the expression if you wanted to use it.

Anyway, this behavior was modeled after Maple, which does pretty much
the same thing.

>
>>
>>>
>>> 2. Is the behavior described below intended or is it kind of a bug?
>>
>> If you mean Integral(F(t), t).subs(t, 0) returning Integral(F(t), (t,
>> 0)) instead of vanishing, that is intended. SymPy can't know that
>> Integral(F(t), (t, 0)) is supposed to be 0. The only way to get
>> constants to absorb into C1 is to use constantsimp.
>
> Here I do not understand how I could "use" constantship? If evaluate
> Integral(F(t), (t, 0)) (i.e. I choose t=0) than the integral should be
> constant.
>
> In Fact I get
>
> In [22]: sp.Integral(F(t), (t, 0)).is_constant()
> Out[22]: True
>
> But this Term is not absorbed into C1. (Should it be?)

No. Constants don't absorb automatically
(https://github.com/sympy/sympy/issues/4435). You'd have to use
constantsimp in the ode module to do that.

>
>>
>>>
>>> 3. What would be a (generic) workaround? (I was thinking in replacing
>>> all Integrals occurring in the rhs-result of dsolve and replacing them
>>> by new definite integrals like Integral(F(tau), (tau, 0, t)). But maybe
>>> this should happen in dsolve itself.)
>>
>> If you want to do this, it shouldn't be hard to use replace() to do it.
>
> Thanks for the tip. I was thinking in using subs, but replace seems much
> more elegant.
>
> I interpret your suggestion to use replace in my private code (not
> altering the behavior of sympy.dsolve), right?

Yes, in your own code. dsolve should absorb constants automatically in
its result (but in this case, it isn't a constant until after you do a
substitution on the result).

Aaron Meurer

>
>
> Thanks,
> Carsten.
>
>>
>> Aaron Meurer
>>
>>>
>>> Tanks and best regards,
>>> Carsten.
>>>
>>>
>>> On 04/08/2015 06:18 PM, Carsten Knoll wrote:
>>>> I have the following problem
>>>>
>>>>
>>>> In [1]: from sympy import *
>>>>
>>>> In [3]: x, F, t = symbols('x, F, t')
>>>>
>>>> In [4]: ode = x(t).diff(t) - F(t)
>>>>
>>>> In [5]: sol = dsolve(ode).rhs
>>>>
>>>> In [7]: sol
>>>> Out[7]: C1 + Integral(F(t), t)
>>>>
>>>> In [8]: sol.subs(t, 0)
>>>> Out[8]: C1 + Integral(F(t), (t, 0))
>>>>
>>>>
>>>> I want the last expression to evaluate to C1, i.e.
>>>>
>>>> Integral(F(t), t).subs(t, 0)
>>>>
>>>> should vanish instead of returning a "strange" object with one bound
>>>> specified.
>>>>
>>>> The application of .doit() does not help either.
>>>>
>>>>
>>>> BTW: IMHO dsolve should return something like
>>>>
>>>> C1 + Integral(F(tau), (tau, 0, t))
>>>>
>>>> where tau is a dummy variable
>>>>
>>>>
>>>> Thanks in advance,
>>>>
>>>> Carsten
>>>>
>>>
>>> --
>>> 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 http://groups.google.com/group/sympy.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/sympy/55278FCE.8020101%40gmx.de.
>>> 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 http://groups.google.com/group/sympy.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/552C5735.4080109%40gmx.de.
> 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 http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2Bvk_P_edVp91Z1Kmou3Orbu56xiFOT%3DH%3D%2Bi-eA8XoUPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to