I was hoping so, but apparently unitsystems.Quantity currently only allows
numerical computations, not symbolic ones.
At least, when I try
>>> x = Quantity(factor=Symbol("x"))
I get a NotImplementedError (see also code at
http://docs.sympy.org/dev/_modules/sympy/physics/unitsystems/quantities.html).
I interpret this to mean that hopefully support for symbolic physical
quantities is planned, but I'd like to get an idea of when it might be
available...
Am Donnerstag, 2. März 2017 19:24:10 UTC+1 schrieb Aaron Meurer:
>
> I believe the sympy.physics.unitsystems module is capable of doing
> this. http://docs.sympy.org/latest/modules/physics/unitsystems/index.html
>
> Aaron Meurer
>
> On Thu, Mar 2, 2017 at 4:56 AM, <[email protected] <javascript:>>
> wrote:
> > I wonder whether it is currently (or will soon be) possible to specify
> which
> > physical dimension (or unit) a symbol has and have sympy check that
> these
> > are compatible when, say, adding symbols or expressions, and compute the
> > resulting dimension (or unit) when, say, multiplying symbols or
> expressions?
> >
> > I imagine something like
> >
> >
> >>>> x = Symbol("x", dimension=length/time)
> >>>> y = Symbol("y", dimension=time)
> >>>> x + y
> > DimensionError: incompatible dimensions cannot be added
> >>>> (x * y).dimension
> > length
> >
> >
> > I know that sympy has now units, but it seems they are only used in
> > numerical computations, not in symbolic ones, am I right?
> >
> > If the imagined functionality is not present or planned to be added
> soon,
> > how would you advise me to add it for my project by subclassing? Would
> it be
> > sufficient to subclass sympy.Expr or would I have to subclass Add, Mul,
> etc.
> > as well?
> >
> > Thanks, Jobst
> >
> > --
> > 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] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > 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/1ce09588-af7d-4781-9ce9-cac5cf858086%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/1deaf860-449c-4ac9-9a14-13ca00d8d54b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.