Hi,

I'm continuing my work on implementing unit systems into sympy [1-3].
I'm currently focusing on dimensions which, as I understood recently,
are trully the most important (and tricky) part.

The classes Dimension and DimensionSystem are almost finished. I have
some difficulties when I want to allow computations with dimensions when
doing manipulations, like solving equation.

I have designed the following example:

from sympy import solve, symbols
from sympy.physics.unitsystems.systems import mks_dim
length = mks_dim["length"]
mass = mks_dim["mass"]
time = mks_dim["time"]
m, a, F = symbols("m a F")
newton_2nd = m*a - F
solve(newton_2nd.subs({m: mass, a: length*time**-2}), F)
 

The first error I encoutered is
"AttributeError: 'Dimension' object has no attribute 'as_base_exp'",
and I suppose that this (and others similar methods) are needed for the
solver to perform the symbolic manipulations. So I tried to derive
Dimension from AtomicExpr in order to profide these functions, but then
I get the error
"TypeError: object of type 'Symbol' has no len()"
and it is pointing the line 100 of dimensions.py, where I'm using len()
to compute the size of some of the arguments. I think it is because I
have redefined the __new__ method, and thus something is missing for the
AtomicExpr part.

Do you have some ideas? My branch can be seen in [4].

Best,

Harold

[1] https://github.com/sympy/sympy/wiki/Unit-systems
[2] https://groups.google.com/forum/?fromgroups#!topic/sympy/XbWxpKS6S94
[3] https://github.com/sympy/sympy/pull/1389
[4] https://github.com/melsophos/sympy/tree/units/sympy/physics/unitsystems

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to