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

Quantities that should be dimensionless are showing as still having units, causing errors with exp function #217

Open
mikayla-eckelcifrese opened this issue Mar 2, 2023 · 0 comments

Comments

@mikayla-eckelcifrese
Copy link

Example code producing the bug:
`from quantities import C, N, m, A, mm, V, F,
pF, H, ohm, Hz, MHz, S, s, kg, mS, rad
import numpy as np
from numpy import pi, exp

epsilon0 = 8.854187817 * 10**(-12) * C2/(N*m2)
mu0 = 4pi10**(-7) * N/(A**2)

def R_outer(r_center, Z_0, epsilonr):
epsilon = epsilon0epsilonr
return r_center
(exp(2piZ_0/np.sqrt(mu0/epsilon)) - 1)

Z_0 = 75ohm
r_center = 0.6
mm
R_outer(r_center, Z_0, 2.25)`

Running that code gives this error:
image

If I print out the expression inside the exp function, I get this:
image

The issue seems to be that it's treating ohm as if it were a base SI unit, rather than splitting it up into the base units and cancelling out common units, as it did for Coulombs and Newtons, and as the documentation for the simplify method says it should. It's easy to check that all those units do in fact cancel out by rewriting ohms in base units.

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