There is also some concept of operators in the quantum module. I don't
remembr if it does what you want or not.

You could try just making an object that overrides __rmul__.  But if
any operation manually creates a Mul with your object, it won't be
called (this is a long running issue that we are still thinking about
how to fix. See http://code.google.com/p/sympy/issues/detail?id=1941).

Aaron Meurer

On Sat, Jan 26, 2013 at 5:45 PM, ruoyu zhang <[email protected]> wrote:
> I want to do some calculation like this:
>
> [cos(theta), -sin(theta)]     [Ld*p + R, -Lq*omega]     [cos(theta),
> sin(theta)]      [Id]
>                           *                         *
> *
> [sin(theta),  cos(theta)]     [Ld*omega,  Lq*p + R]     [-sin(theta),
> cos(theta)]    [Iq]
>
> This is a part of motor equation expressed in matrix multiplication,Id, Iq,
> theta are functions of t (time), p is the differential operator, so this
> isn't a simple multiplication. I will do this kind of calculation a lot, so
> I want to find a generic method.
>
>
>
> 在 2013年1月26日星期六UTC+9下午10时45分08秒,Stefan Krastanov写道:
>>
>> Before suggesting a solution I need to point out a problem with your
>> suggestion. Namely, multiplication and application are two very
>> different operation (there is overlap (e.g. matrix multiplication) but
>> I will leave it out for the moment). SymPy does not have support for
>> this type of "abuse of notation" for the moment. If you are
>> interesting implementing it yourself your best shot (in my opinion)
>> would be to get inspiration by the matrix expression module and the
>> rewrite rules module.
>>
>> On the other hand if you want to use simple vanilla python for all
>> this you can just use the `diff` global function but presumably you do
>> not want that in order to facilitate automatic simplifications like
>> "2*p - p -> p".
>>
>> If this is the case (and you are absolutely sure that this is
>> necessary (usually it is not)) you can try to use the differential
>> geometry module (in differential geometry vector fields are
>> differential operators). If you know the formalism it will be very
>> easy to use, however if you do not know it you will need to read
>> something more than just the documentation.
>>
>>
>> http://docs.sympy.org/dev/modules/diffgeom.html#sympy.diffgeom.BaseVectorField
>>
>> On 25 January 2013 23:49, ruoyu zhang <[email protected]> wrote:
>> >>>> p = DifferentialOperator(t)
>> >>>> a * p * f(t)
>> > Derivative(f(t), t)*a
>> >
>> > p is a DifferentialOperator, when it multiply with some expression  at
>> > right
>> > side, it calculates the derivative of the expression.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "sympy" group.
>> > To post to this group, send email to [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected].
>> > Visit this group at http://groups.google.com/group/sympy?hl=en.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to