Leedehai / typst-physics

physica: vectors, fields, differentials, derivatives, Dirac brakets, tensors, and more. See examples in the manual PDF.
https://github.com/Leedehai/typst-physics
MIT License
343 stars 11 forks source link

Request: Physical constants #31

Open marisbaier opened 4 months ago

marisbaier commented 4 months ago

Excuse me not knowing if this is the right place to ask but wouldn't physical constants be an amazing addition to this package?

Leedehai commented 4 months ago

Hi - what constants you have in mind? I feel most of the time it's more convenient & clearer to just type the constants with native Typst..

marisbaier commented 4 months ago

Hi, I meant something like #let m_e = 9.1093837*calc.pow(10,-31)

Just because I came into the habit of doing quick calculations directly in typst for my homework assignments. Currently I have them in a seperate file and I use them like $hbar^2 approx #(const.hbar^2)$

Constants I have defined are: (but can be more readily copied from scipy here)

let m_e = 9.1093837*calc.pow(10,-31)

let c = 299792458

let epsilon_0 = 8.854 * calc.pow(10,-12)

let h = 6.626 * calc.pow(10,-34)

let hbar = 1.05457*calc.pow(10,-34)

let pi = 3.14159254

let alpha = 1/137

let mu_B = 9.274 * calc.pow(10,-24)

Leedehai commented 4 months ago

Thanks! I see you want the constants to be defined with their numeric values. It sounds to me it's worth a separate package (or just in your personal file so that can best suit your needs?), though.

At the moment I wish physica to be meant for typesetting only. In particular, offering the numeric values could lead to debates over what units they should be in (I prefer SI personally, but in certain engineering fields SI and the Imperial units coexist.. and also, in many fields other unit systems are preferred), what precision they should have, etc.