Ask Your Question

Has anyone found a way to handle units in sagemath ?

asked 2021-11-09 12:43:18 +0100

aurelius_nero gravatar image

Hi, I am looking for a way to handle units in Sagemath, both numerically and symbolically. I am trying to see how I can emulate the Mathcad capability of unit consistency in Sagemath. For example, How would I be able to do the following: Symbolic: delta= PL/AE , P=3F N, F=deltaAE/3*L N

numerical: 1kN +500N = 1.5kN

Thanks for the help

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-11-09 21:35:11 +0100

Emmanuel Charpentier gravatar image

This may enlighten you

I found this facility a bit awkward (at least initially) but useful. LaTeX output may use a bit of love...

edit flag offensive delete link more


@Emmanuel Charpentier I have seen that documentation. Though, it functions like a symbolic variable. You can't change m to mm and vice versa easily.

aurelius_nero gravatar imageaurelius_nero ( 2021-11-10 01:42:40 +0100 )edit

You can't change m to mm and vice versa easily.

Huh ?

sage.symbolic.units.convert(2/10*m, mm)

Also :

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2021-11-10 10:11:42 +0100 )edit

@Emmanuel Charpentier Does this work the same way if I want to change the unit of the same variable ? for example; L =10m to L=10000mm ?

aurelius_nero gravatar imageaurelius_nero ( 2021-11-13 10:43:28 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-11-09 12:35:37 +0100

Seen: 260 times

Last updated: Nov 09 '21