New feature possibility

121 views
Skip to first unread message

Henrique Miguel Cortes Soares

unread,
Apr 23, 2024, 5:54:21 PMApr 23
to sympy
Hello all,

I've seen in the page https://github.com/sympy/sympy/wiki/Unit-systems that two of the possible improvements for the unit systems in SymPy are to define new unit systems and improving the access to units and dimensions in a given system.
Me and a friend wanted to give this feature a try, in the context of a subject of a Computer Science course we are both taking.
So, I wanted to ask whether the functionality I described is something worth working on and not yet implemented.

Thank you for your time.

Best regards,
Henrique Soares

Aaron Meurer

unread,
Apr 23, 2024, 5:56:47 PMApr 23
to sy...@googlegroups.com, Francesco Bonazzi
I would say that new unit systems should be added only if they are
generally used and useful. General improvements to the units module
are always welcome. Francesco is the main maintainer of the units
module, so he would know more details on what needs to be done there.

Aaron Meurer
> --
> 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 sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/c342d6ca-2d5a-4b5e-ac1a-d4e7488a04d7n%40googlegroups.com.

Henrique Miguel Cortes Soares

unread,
Apr 25, 2024, 12:06:24 PMApr 25
to sympy
So, should the imperial system be added? If not, what system could we add then?

Henrique Soares

Aaron Meurer

unread,
Apr 25, 2024, 3:56:35 PMApr 25
to sy...@googlegroups.com
I believe the imperial system should already be there, but if there's
anything missing, we should fix that.

Aaron Meurer

On Thu, Apr 25, 2024 at 10:06 AM 'Henrique Miguel Cortes Soares' via
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/2b5adfc0-2e33-4ba9-be7f-43eb2a2093c9n%40googlegroups.com.

Aaron Meurer

unread,
Apr 25, 2024, 4:02:04 PMApr 25
to sy...@googlegroups.com
Looking closer, I think you might be right that the imperial system
isn't there. The units are all defined, but there isn't an imperial
Unitsystem that includes them all. This should be straightforward to
add, The main concern I see is that there isn't a single "imperial
system" and what's often called that contains many units that measure
the same quantities. But the SymPy unit systems define a single unit
for each quantity. So we may need to add multiple "systems" to
represent the imperial units.

Aaron Meurer

Francesco Bonazzi

unread,
Apr 29, 2024, 8:20:12 AMApr 29
to sympy
The class UnitSystem in SymPy defines the relations between units. In most cases, the Imperial Units follow the same relations as the SI unit system (maybe there are slight differences in fluid units between the UK and the US?). Anyways, creating an imperial unit system does not make any sense to me, as the SI unit system already implements the relations between imperial units.

New unit systems should be implemented when the relations between units or physical constants are different than in SI. For example, in CGS there is no fundamental unit for electromagnetic quantities, and also physical equations are different from SI.

Bear in mind that UnitSystem defines the behaviour of the function "convert_to". You can convert Imperial Units using "convert_to" from SI without any issue (relationships are the same). On the other hand, "convert_to" behaves differently in other unit systems, such as CGS or Natural units.

Henrique Miguel Cortes Soares

unread,
May 13, 2024, 10:56:30 AMMay 13
to sympy
Sorry for the late response, we've been busy with other subjects.
What about time systems, included in the "Misc" section in the page mentioned on my first message? Or is there anything from the units module you would like us to work on?
We could also work on some new area where sympy is still at a basic level, if there is one.

Aaron Meurer

unread,
May 14, 2024, 2:39:51 PMMay 14
to sy...@googlegroups.com
Francesco could probably give a more specific answer, but I imagine
you could find some things that need fixing in the units module if you
search in the issue tracker.

Aaron Meurer

On Mon, May 13, 2024 at 8:56 AM 'Henrique Miguel Cortes Soares' via
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/1f6b5543-7f8a-40fb-b7a9-17656c2fc020n%40googlegroups.com.

Francesco Bonazzi

unread,
May 15, 2024, 12:41:50 PMMay 15
to sympy
On Monday, May 13, 2024 at 4:56:30 p.m. UTC+2 henrique...@tecnico.ulisboa.pt wrote:
Sorry for the late response, we've been busy with other subjects.
What about time systems, included in the "Misc" section in the page mentioned on my first message?

That page hasn't really been updated since 2014 :(
Time units are already supported. Calendars are not. I cannot think of a use case where users would use SymPy for calendars.

Or is there anything from the units module you would like us to work on?

It would be nice to have transformations between unit systems. But that's quite hard to implement.

Aaron Meurer

unread,
May 15, 2024, 1:52:10 PMMay 15
to sy...@googlegroups.com
On Wed, May 15, 2024 at 10:41 AM Francesco Bonazzi
<franz....@gmail.com> wrote:
>
>
>
> On Monday, May 13, 2024 at 4:56:30 p.m. UTC+2 henrique...@tecnico.ulisboa.pt wrote:
>
> Sorry for the late response, we've been busy with other subjects.
> What about time systems, included in the "Misc" section in the page mentioned on my first message?
>
>
> That page hasn't really been updated since 2014 :(
> Time units are already supported. Calendars are not. I cannot think of a use case where users would use SymPy for calendars.

I agree. We don't want SymPy to become a datetime library. There are
already excellent libraries for that, and they are a lot of work to
write and maintain correctly.

Aaron Meurer

>
> Or is there anything from the units module you would like us to work on?
>
>
> It would be nice to have transformations between unit systems. But that's quite hard to implement.
>
> --
> 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 sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/52560e2f-c9c3-48b3-bdbf-577628c2c67bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages