On Tue, Jun 7, 2016 at 8:58 AM, Michi S <[email protected]> wrote:
>
> Thanks for the answers! For the purpose of my master thesis I am trying to
> optimize the simulaion of helicopter dynamics. These dynamics are pretty
> complicated, which leads to huge equations for most states. In order to
> speed up the calculation I need to detect functions that where already
> evaluated. The inner derivative that is produced due to the chain rule is
> such a function, that I need to detect.
>
> factor() works only for the first derivative unfortunately. In the second
> and higher derivatives it does not factorize the inner derivates anymore:
>
> t = sym.symbols('t')
> diff( (sin(t)+exp(t))**5 , t )
>>> (exp(t) + sin(t))**4*(5*exp(t) + 5*cos(t))
>
> factor(diff( (sin(t)+exp(t))**5 , t ))
>>> 5*(exp(t) + sin(t))**4*(exp(t) + cos(t))
>
> factor(diff( (sin(t)+exp(t))**5 , t, t ))
>>> 5*(exp(t) + sin(t))**3*(5*exp(2*t) + 8*exp(t)*cos(t) - sin(t)**2 +
>>> 4*cos(t)**2)

What output were you expecting here? I don't think the second factor
can be factorized. Note however that it can be simplified slightly if
you call trigsimp() on it.

Aaron Meurer

>
>
> I think, writing my own differentiation programm will be a little bit to
> hard to solve my issue. Is there no other way besides factor() and wiriting
> my own programm?
>
>
> Thank for your help!
>
>
> Am Mittwoch, 1. Juni 2016 15:34:28 UTC+2 schrieb Michi S:
>>
>> Hello!
>>
>> Is there a way to turn off the automatic simplification by calculating the
>> derivative of a function? For example
>>
>> t = sym.symbols('t')
>> sym.Derivative( (sin(t)+exp(t))**3 , t ).doit()
>>
>> gives:
>> (exp(t) + sin(t))**2*(3*exp(t) + 3*cos(t))
>>
>> I need the result without any simplifications (in order to detect the
>> inner derivative for further calculations)
>>
>> Should be:
>> (exp(t) + sin(t))**2*3*(exp(t) + cos(t))
>
> --
> 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/c5e1f95e-d5e2-4334-b302-39bd6e2ebc9b%40googlegroups.com.
>
> 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/CAKgW%3D6J%3D%3Dq4K17wnEvJFagB3URSbJO9CHAjhDJ%3D6a6iQdbZ-gA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to