m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
3.6 KiB

7 months ago
  1. from sympy.core.singleton import S
  2. from sympy.functions.elementary.miscellaneous import sqrt
  3. from sympy.physics.units import UnitSystem, centimeter, gram, second, coulomb, charge, speed_of_light, current, mass, \
  4. length, voltage, magnetic_density, magnetic_flux
  5. from sympy.physics.units.definitions import coulombs_constant
  6. from sympy.physics.units.definitions.unit_definitions import statcoulomb, statampere, statvolt, volt, tesla, gauss, \
  7. weber, maxwell, debye, oersted, ohm, farad, henry, erg, ampere, coulomb_constant
  8. from sympy.physics.units.systems.mks import dimsys_length_weight_time
  9. One = S.One
  10. dimsys_cgs = dimsys_length_weight_time.extend(
  11. [],
  12. new_dim_deps=dict(
  13. # Dimensional dependencies for derived dimensions
  14. impedance=dict(time=1, length=-1),
  15. conductance=dict(time=-1, length=1),
  16. capacitance=dict(length=1),
  17. inductance=dict(time=2, length=-1),
  18. charge=dict(mass=S.Half, length=S(3)/2, time=-1),
  19. current=dict(mass=One/2, length=3*One/2, time=-2),
  20. voltage=dict(length=-One/2, mass=One/2, time=-1),
  21. magnetic_density=dict(length=-One/2, mass=One/2, time=-1),
  22. magnetic_flux=dict(length=3*One/2, mass=One/2, time=-1),
  23. )
  24. )
  25. cgs_gauss = UnitSystem(
  26. base_units=[centimeter, gram, second],
  27. units=[],
  28. name="cgs_gauss",
  29. dimension_system=dimsys_cgs)
  30. cgs_gauss.set_quantity_scale_factor(coulombs_constant, 1)
  31. cgs_gauss.set_quantity_dimension(statcoulomb, charge)
  32. cgs_gauss.set_quantity_scale_factor(statcoulomb, centimeter**(S(3)/2)*gram**(S.Half)/second)
  33. cgs_gauss.set_quantity_dimension(coulomb, charge)
  34. cgs_gauss.set_quantity_dimension(statampere, current)
  35. cgs_gauss.set_quantity_scale_factor(statampere, statcoulomb/second)
  36. cgs_gauss.set_quantity_dimension(statvolt, voltage)
  37. cgs_gauss.set_quantity_scale_factor(statvolt, erg/statcoulomb)
  38. cgs_gauss.set_quantity_dimension(volt, voltage)
  39. cgs_gauss.set_quantity_dimension(gauss, magnetic_density)
  40. cgs_gauss.set_quantity_scale_factor(gauss, sqrt(gram/centimeter)/second)
  41. cgs_gauss.set_quantity_dimension(tesla, magnetic_density)
  42. cgs_gauss.set_quantity_dimension(maxwell, magnetic_flux)
  43. cgs_gauss.set_quantity_scale_factor(maxwell, sqrt(centimeter**3*gram)/second)
  44. # SI units expressed in CGS-gaussian units:
  45. cgs_gauss.set_quantity_scale_factor(coulomb, speed_of_light*statcoulomb/10)
  46. cgs_gauss.set_quantity_scale_factor(ampere, speed_of_light*statcoulomb/second/10)
  47. cgs_gauss.set_quantity_scale_factor(volt, speed_of_light*statvolt/10**6)
  48. cgs_gauss.set_quantity_scale_factor(weber, 10**8*maxwell)
  49. cgs_gauss.set_quantity_scale_factor(tesla, 10**4*gauss)
  50. cgs_gauss.set_quantity_scale_factor(debye, One/10**18*statcoulomb*centimeter)
  51. cgs_gauss.set_quantity_scale_factor(oersted, sqrt(gram/centimeter)/second)
  52. cgs_gauss.set_quantity_scale_factor(ohm, 10**9/speed_of_light**2*second/centimeter)
  53. cgs_gauss.set_quantity_scale_factor(farad, One/10**9*speed_of_light**2*centimeter)
  54. cgs_gauss.set_quantity_scale_factor(henry, 10**9/speed_of_light**2/centimeter*second**2)
  55. # Coulomb's constant:
  56. cgs_gauss.set_quantity_dimension(coulomb_constant, 1)
  57. cgs_gauss.set_quantity_scale_factor(coulomb_constant, 1)
  58. __all__ = [
  59. 'ohm', 'tesla', 'maxwell', 'speed_of_light', 'volt', 'second', 'voltage',
  60. 'debye', 'dimsys_length_weight_time', 'centimeter', 'coulomb_constant',
  61. 'farad', 'sqrt', 'UnitSystem', 'current', 'charge', 'weber', 'gram',
  62. 'statcoulomb', 'gauss', 'S', 'statvolt', 'oersted', 'statampere',
  63. 'dimsys_cgs', 'coulomb', 'magnetic_density', 'magnetic_flux', 'One',
  64. 'length', 'erg', 'mass', 'coulombs_constant', 'henry', 'ampere',
  65. 'cgs_gauss',
  66. ]