On Feb 28, 3:38 pm, Fabian Seoane <[email protected]> wrote:
> On Sat, Feb 28, 2009 at 1:09 PM, Priit Laes <[email protected]> wrote:
>
> > We currently have bunch of fundemental physical constants defined in
> > sympy/physics/units.py in the following form:
>
> > ...
> > c = speed_of_light = 299792458 * m/s
> > G = gravitational_constant = Rational('6.67428') * ten**-11 * m**3 /
> > kg / s**2
> > u0 = magnetic_constant = 4*pi * ten**-7 * N/A**2
> > e0 = electric_constant = 1/(u0 * c**2)
> > Z0 = vacuum_impedance = u0 * c
> > ...
>
> > In my opinion this pollutes namespace and doesn't look elegant at all
> > and will certainly introduce many problems when we start defining more
> > of them.. :P
>
> > My proposal:
>
> > from physics.constants import constant
> > #  Speed of light (without the m/s)
> > print constant("c", units=False)
>
> > The same approach could be used with also measurement units (plus the
> > possibility that they could be defined using the fundamental
> > constants :) )
>
> The problem I see with this is that it would make introspection harder. At
> least now you can do
>
> In [1]: import sympy.physics.units as units
>
> In [2]: dir(units)
>
> and get a list of units
>
>
>
> --
> Fabian,http://fseoane.net/blog/

This could be easily realised using a function however.

I like this approach. We could even just use a dict.

It might be cumbersome to define every used constant though. Imagine

>>> c = constants('c')
>>> e0 = constants('e0')
>>> G = constants('G')

A solution would be something like symbols().

>>> c, e0, G = constants('c e0 G')

Vinzent


--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to