Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
@mikayla-eckelcifrese

Description

@mikayla-eckelcifrese

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp