First time here? Check out the FAQ!

Ask Your Question
1

Has anyone found a way to handle units in sagemath ?

asked 3 years ago

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 3 years ago

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...

Preview: (hide)
link

Comments

@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 ( 3 years ago )
1

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

Huh ?

m=units.length.meter
mm=units.length.millimeter
sage.symbolic.units.convert(2/10*m, mm)
200*millimeter

Also :

(200*mm).subs(mm==1/1000*m)
1/5*meter
Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 3 years ago )

@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 ( 3 years ago )

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

Stats

Asked: 3 years ago

Seen: 433 times

Last updated: Nov 09 '21