Exemplo n.º 1
0
from sympy import sqrt, simplify
from sympy.physics.optics import Medium
from sympy.abc import epsilon, mu
from sympy.physics.units import speed_of_light, u0, e0, m, kg, s, A


c = speed_of_light.convert_to(m/s)
e0 = e0.convert_to(A**2*s**4/(kg*m**3))
u0 = u0.convert_to(m*kg/(A**2*s**2))


def test_medium():
    m1 = Medium('m1')
    assert m1.intrinsic_impedance == sqrt(u0/e0)
    assert m1.speed == 1/sqrt(e0*u0)
    assert m1.refractive_index == c*sqrt(e0*u0)
    assert m1.permittivity == e0
    assert m1.permeability == u0
    m2 = Medium('m2', epsilon, mu)
    assert m2.intrinsic_impedance == sqrt(mu/epsilon)
    assert m2.speed == 1/sqrt(epsilon*mu)
    assert m2.refractive_index == c*sqrt(epsilon*mu)
    assert m2.permittivity == epsilon
    assert m2.permeability == mu
    # Increasing electric permittivity and magnetic permeability
    # by small amount from its value in vacuum.
    m3 = Medium('m3', 9.0*10**(-12)*s**4*A**2/(m**3*kg), 1.45*10**(-6)*kg*m/(A**2*s**2))
    assert m3.refractive_index > m1.refractive_index
    assert m3 > m1
    # Decreasing electric permittivity and magnetic permeability
    # by small amount from its value in vacuum.
Exemplo n.º 2
0
"""
**Contains**

* Medium
"""

from __future__ import division
from sympy.physics.units import second, meter, kilogram, ampere

__all__ = ['Medium']

from sympy import Symbol, sympify, sqrt
from sympy.physics.units import speed_of_light, u0, e0

c = speed_of_light.convert_to(meter / second)
_e0mksa = e0.convert_to(ampere**2 * second**4 / (kilogram * meter**3))
_u0mksa = u0.convert_to(meter * kilogram / (ampere**2 * second**2))


class Medium(Symbol):
    """
    This class represents an optical medium. The prime reason to implement this is
    to facilitate refraction, Fermat's priciple, etc.

    An optical medium is a material through which electromagnetic waves propagate.
    The permittivity and permeability of the medium define how electromagnetic
    waves propagate in it.


    Parameters
    ==========
Exemplo n.º 3
0
**Contains**

* Medium
"""

from __future__ import division
from sympy.physics.units import second, meter, kilogram, ampere

__all__ = ['Medium']

from sympy import Symbol, sympify, sqrt
from sympy.physics.units import speed_of_light, u0, e0


c = speed_of_light.convert_to(meter/second)
_e0mksa = e0.convert_to(ampere**2*second**4/(kilogram*meter**3))
_u0mksa = u0.convert_to(meter*kilogram/(ampere**2*second**2))


class Medium(Symbol):

    """
    This class represents an optical medium. The prime reason to implement this is
    to facilitate refraction, Fermat's priciple, etc.

    An optical medium is a material through which electromagnetic waves propagate.
    The permittivity and permeability of the medium define how electromagnetic
    waves propagate in it.


    Parameters