Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrals involving physical units doesn't evaluate: "Inconsistent units" #1314

Open
Wiljea opened this issue Nov 7, 2024 · 2 comments
Open

Comments

@Wiljea
Copy link

Wiljea commented Nov 7, 2024

In the Examples1 & 2 of the "Terminal Velocity" simulation, I added two new eqns (3) & (4), where the latter involves an integral (Δx=∫v·dt from 0 to tfr):
"'(vt_(m/s))=√((2·(m_kg)·Ⓒg)/(Cd·(ρ_(kg/m^3))·(Ah_cm^2)))' "
"'v_(m/s)=(vt_(m/s))·TANH((t_s)·Ⓒg/(vt_(m/s)))' "
"'tfr_s=ATANH(fr)/(Ⓒg/(vt_(m/s)))' "
"'xfr_ft=(vt_(m/s))·∫(0_s;tfr_s;TANH((t_s)·Ⓒg/(vt_(m/s)));t)' "

Previously, MSOLVER worked fine for vt & v alone:

Cd=0.15  ρ=0.025_lb/ft^3  Ah=100000_in^2  m=1250_lb  t=5_s
@ Expecting [ vt=175.74722 3631 ft/s v=127.18655 2185 ft/s ]
@ C#18 MSOLVER: works fine for vt & v. I added 2 new eqns, therefore, it needs to be checked BUT integration with units don't work see ISSUE #1314
'ROOT(ⒺTerminal Velocity;[vt;v];[1_ft/s;1_ft/s])'

Then, I added a new variable fr: fraction of terminal velocity (fr=0.95) and two new unknowns: [tfr_s ; xfr_ft] (time required to reach the fraction fr of vt, displacement during tfr) with their respective eqns. Using them, I just calculated by hand the two required answers:
@ Expecting [ tfr=10.00590 25332 s xfr=1 117.39339 246 ft ]

AND the problem lies with the integral using physical units (in the limits & variables):
'(175.74722 3631_ft/s)·∫(0_s;10.00590 25332_s;TANH((t_s)·Ⓒg/(175.74722 3631_ft/s));t_s)' doesn't work

where in TANH, t_s needs to be in second in order to cancel units from the remaining factors of the argument. Indeed, after many attempts, I found the only way to obtain a valid answer with:
'(175.747223631_ft)·∫(0;10.0059025332;TANH(t·Ⓒg/(175.747223631_ft/s)·(1_s));t)'
=1 117.39339 246 ft=xfr
providing that I cancel myself the remaining units of TANH. In other words, integration works ONLY WITHOUT physical units (I had also to remove them from the integration limits, which is not physically satisfactory). This is probably related to ISSUE #1307. The very same problem is encountered in 3 other cases. Everything is clearly documented in "equations.md".

@Wiljea
Copy link
Author

Wiljea commented Nov 15, 2024

As I commented elsewhere, the BASE function has to be applied to the integration LIMITS but also to the INTEGRAND itself. In the last version of the simulation with the recent equations.cc (simulator constructed from the EQNS branch) I tried the computation with no net units remaining in both limits & integrand. But to simplify these units either the algorithm has to execute BASE or the user has to do so with an algebraic form of BASE. This will be the simplest solution for the time being.

@Wiljea
Copy link
Author

Wiljea commented Nov 15, 2024

It is essential to cure this problem because we now have 1 (Black Body) + 2 (Terminal Velocity) + 2 (Buoyancy & Terminal Velocity) + 4 (Planck & Wien Comparison) + 4 (Planck & Rayleigh-Jeans Comparison) = 13 such integrals up to now in the Library Equation. And in all case this idea of algebraic BASE function should work without further modifications of the Romberg algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant