Code Monkey home page Code Monkey logo

physicalconstants.jl's People

Contributors

giordano avatar github-actions[bot] avatar hurak avatar juliatagbot avatar ovidiuscicero avatar simeonschaub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

physicalconstants.jl's Issues

Faster compile times with UnitSystems.jl

I read in a comment on JuliaMath/IrrationalConstants.jl#1 that you have compile time issues with this package, as it is slow. If that is an issue for you, I highly recommend using my UnitSystems.jl package, as it has very quick compilation times. Unfortunately, I was not able to respond directly to that discussion, since the Julia Stewarses have banned me from all their websites and repositories. If you need arbitrary precision, it should be possible to add as a feature to UnitSystems also, but in practice none of the physical constants are known beyond Float64 precision, so I did not implement it as of now.

Export all constants?

Currently the submodule CODATA2014 exports all constants. This definitely clutters Main with some short names. On the other end, without automatic exports, users would have to spell in full PhysicalConstants.CODATA2014.c, unless they do something like

julia> using PhysicalConstants, PhysicalConstants.CODATA2014

julia> const cst = PhysicalConstants.CODATA2014
PhysicalConstants.CODATA2014

julia> cst.c
Speed of light in vacuum (c)
Value                         = 2.99792458e8 m s^-1
Standard uncertainty          = (exact)
Relative standard uncertainty = (exact)
Reference                     = CODATA 2014    

which may not be very convenient.

A good point of not exporting the constants is that it would be easy to load two different datasets providing different values for the same constants (e.g., other CODATA datasets) and use values from one module or another without messing things up.

I'm not sure what's the best thing to do here.

Version tag

When I try to use it right now, I get

(v1.0) pkg> resolve
 Resolving package versions...
PhysicalConstants [22bc3fda] log:
 ├─PhysicalConstants [22bc3fda] has no known versions!

Add CODATA2018

CODATA2018 will be available 20 May 2019.

The next regular CODATA four year cycle adjustment of the fundamental constants will be the 2018 adjustment with a closing date for input data of 31 December, 2018, with the relevant data in publication or preprint form as usual. The results will be made available by 20 May 2019 (World Metrology Day) when the revised SI is to be implemented. The 2018 CODATA adjustment is unique in that it will be the first adjustment of the fundamental constants in the revised SI with much more accurate values for almost all the fundamental constants.

http://www.codata.org/committees-and-groups/fundamental-physical-constants

Numeric value of constants

Is there a simple way to obtain the numeric value of constants, or combination of constants?

I need to multiply the equation by the factor of e/m_e and I need the result to be a simpe float without units. Only way I come with is by dividing by the units of that expression e/m_e/1u"C*kg^-1" which give me the required factor 1.7588e11 but to get it I need to know the units of the factor which makes the procedure kind of uselles.

Unable to install on fresh julia 1.6/1.7 installs

Dear maintainers,
This looks like a super useful package for science and I'm trying to install it.
I tried a few ways using different versions of Julia but keep running into the same problem:

image

I'm kind of a Julia noob so please let me know if I'm doing something really silly.

Thanks in advance!

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Automatic conversion of Constant to Quantity

In order to use a Constant in mathematical operations one has to explicitly convert it to a Quantity with float(). I think that it's good that the user has to explicitly require the uncertainty with measurement(x), this is something that may not be always needed.

My desire is to make the conversion to Quantity, without uncertainty, automatic. I initially thought that promotion rules would have helped, but I found out that they're quite useless for this (you almost never want to promote a Constant and another number to a common type).

I see the following options:

  • manually overload all relevant mathematical operations here in order to support Constant objects
  • lobby Unitful.jl maintainer to define an AbstractQuantity type that can be subclassed. Constant could then be a subtype of AbstractQuantity and automatically benefits from all the mathematical operations defined there, without duplicating the work here.

Please share your thoughts on this.

Unexpected error in runtime: StackOverflowError()

Hi,
The initial using PhysicalConstants fails for me, see below.
An infinite loop of error messages is produced, the julia prcoess has to be killed.

Is this the right place for this issue, it looks like it could be a julia v1.5 issue?
Thanks.

julia> versioninfo()
Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 9 3900X 12-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, znver1)
Environment:
  JULIA_EDITOR = vim
  JULIA_NUM_THREADS = 12
(@v1.5) pkg> add PhysicalConstants
   Updating registry at `~/.julia/registries/General`
  Resolving package versions...
Updating `~/.julia/environments/v1.5/Project.toml`
  [5ad8b20f] + PhysicalConstants v0.2.1
Updating `~/.julia/environments/v1.5/Manifest.toml`
  [eff96d63] + Measurements v2.2.1
  [5ad8b20f] + PhysicalConstants v0.2.1

julia> using PhysicalConstants
[ Info: Precompiling PhysicalConstants [5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab]
Internal error: encountered unexpected error in runtime:
StackOverflowError()
inst_type_w_ at /buildworker/worker/package_linux64/build/src/jltypes.c:1543
inst_type_w_ at /buildworker/worker/package_linux64/build/src/jltypes.c:1532
jl_instantiate_unionall at /buildworker/worker/package_linux64/build/src/jltypes.c:918
rename_unionall at /buildworker/worker/package_linux64/build/src/subtype.c:457 [inlined]
unalias_unionall at /buildworker/worker/package_linux64/build/src/subtype.c:798
subtype_unionall at /buildworker/worker/package_linux64/build/src/subtype.c:826 [inlined]
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1272
exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1416 [inlined]
forall_exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1444
subtype_ccheck at /buildworker/worker/package_linux64/build/src/subtype.c:509
var_lt at /buildworker/worker/package_linux64/build/src/subtype.c:572
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1246
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1246
with_tvar at /buildworker/worker/package_linux64/build/src/subtype.c:735
subtype_unionall at /buildworker/worker/package_linux64/build/src/subtype.c:829 [inlined]
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1272
exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1416 [inlined]
forall_exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1444
subtype_ccheck at /buildworker/worker/package_linux64/build/src/subtype.c:509
var_lt at /buildworker/worker/package_linux64/build/src/subtype.c:572
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1246
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1246
with_tvar at /buildworker/worker/package_linux64/build/src/subtype.c:735
subtype_unionall at /buildworker/worker/package_linux64/build/src/subtype.c:829 [inlined]
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1272
exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1416 [inlined]
forall_exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1444
subtype_ccheck at /buildworker/worker/package_linux64/build/src/subtype.c:509
var_lt at /buildworker/worker/package_linux64/build/src/subtype.c:572
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1246
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1246
with_tvar at /buildworker/worker/package_linux64/build/src/subtype.c:735
subtype_unionall at /buildworker/worker/package_linux64/build/src/subtype.c:829 [inlined]
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1272
exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1416 [inlined]
forall_exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1444
subtype_ccheck at /buildworker/worker/package_linux64/build/src/subtype.c:509
var_lt at /buildworker/worker/package_linux64/build/src/subtype.c:572
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1246
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1246
with_tvar at /buildworker/worker/package_linux64/build/src/subtype.c:735
subtype_unionall at /buildworker/worker/package_linux64/build/src/subtype.c:829 [inlined]
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1272
exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1416 [inlined]
forall_exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1444
...
infinite loop

Fine structure constant is not usable

julia> α
Fine-structure constant (α)
Value = 0.0072973525664
Standard uncertainty = 1.7e-12
Relative standard uncertainty = 2.3e-10
Reference = CODATA 2014

julia> α * 1.0
ERROR: MethodError: no method matching ustrip(::Unitful.FreeUnits{(),NoDims,nothing}, ::Float64)
Closest candidates are:
ustrip(::Unitful.Units, ::Unitful.Quantity) at /home/dmitry/.julia/packages/Unitful/W0mMi/src/utils.jl:28
Stacktrace:
[1] getproperty(::PhysicalConstants.Constant{:α,Float64,NoDims,Unitful.FreeUnits{(),NoDims,nothing}}, ::Symbol) at /home/dmitry/.julia/packages/PhysicalConstants/chGDZ/src/PhysicalConstants.jl:75
[2] *(::PhysicalConstants.Constant{:α,Float64,NoDims,Unitful.FreeUnits{(),NoDims,nothing}}, ::Float64) at /home/dmitry/.julia/packages/Unitful/W0mMi/src/quantities.jl:32
[3] top-level scope at none:0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.