c3d / db48x

RPL runtime for the DM42 calculator, in the spirit of HP48/49/50
http://48calc.org
GNU Lesser General Public License v3.0
113 stars 13 forks source link

A suggestion to solve the radian unit problem of the angular frequency ω #1221

Closed Wiljea closed 1 month ago

Wiljea commented 1 month ago

In physics the angular units of the angular frequency ω is usually r/s (ω_r/s) but the numerically required radians, strictly speaking, appear or disappear depending on the equations, as in the following examples:

for "Waves": "'(vs_(cm/s))=(smcm)·(ω(r/s))·SIN((k_(r/cm))·(xcm)-(ω(r/s))·(t_s)+(φ_r))' " "'(as(cm/(s^2)))=-(ω(r/s))^2·(s_cm)' " or for "RLC Current Delay" "'(XCΩ)=1/((ω(r/s))·(C_μF))' " or for "Simple Pendulum" "'(ω_(r/s))=√(Ⓒg/(L_cm))' " All these equations (more than 20 in the Equation Library) currently lead to incompatible unit errors. Unlike several environments where the angles do not really have units (or are only in radians by default, like in Fortran or in HP50g, etc.) here the db48x assigns the angles their explicit units (rad, grad, ° ). Therefore, instead of tweaking exceptions with the parsing algorithm a simple solution would be to add or remove radians explicitly as needed, for instance: "'(vs_(cm/s))=(smcm)·(ω(r/s))/(1r)·SIN((k(r/cm))·(xcm)-(ω(r/s))·(t_s)+(φ_r))' " "'(as(cm/(s^2)))=-(ω(r/s)/(1_r))^2·(s_cm)' " "'(XCΩ)=1/((ω(r/s)/(1_r))·(C_μF))' " "'(ω_(r/s))=(1_r)·√(Ⓒg/(L_cm))' " It is not a big deal. Let's have the opinion of the author.

c3d commented 1 month ago

I agree. This is how I solved it in the Eccentric Columns and Simple Slope equations.

Wiljea commented 1 month ago

Ok, fine, I'll do it after a thorough check for all instances of such problem.