Skip to content

Commit

Permalink
Some docs touchups
Browse files Browse the repository at this point in the history
  • Loading branch information
LebedevRI committed Oct 30, 2023
1 parent 91c08e6 commit 8469fd2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# History of Measurements.jl

## v2.11.0 (????)

### New features

* Support for [symbolic variables](https://symbolics.juliasymbolics.org/stable/manual/variables/),
as provided by `Symbolics.jl` package.

## v2.10.0 (2023-09-21)

### New features
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ easy-to-use calculator.
[arbitrary precision](https://docs.julialang.org/en/v1/manual/integers-and-floating-point-numbers/#Arbitrary-Precision-Arithmetic-1)
(also called multiple precision) numbers with uncertainties. This is useful
for measurements with very low relative error
* Support for numbers with uncertainties of
[symbolic variable](https://symbolics.juliasymbolics.org/stable/manual/variables/)
type, as provided by `Symbolics.jl` package.
* Define arrays of measurements and perform calculations with them. Some linear
algebra functions work out-of-the-box
* Propagate uncertainty for any function of real arguments (including functions
Expand Down
27 changes: 27 additions & 0 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,33 @@ hypot(a, b)
log(2a) ^ b
```

Symbolic Variables
------------------

You can perform any mathematical operation supported in `Measurements.jl` using
[symbolic variables](https://symbolics.juliasymbolics.org/stable/manual/variables/),
as provided by `Symbolics.jl` package:

``` julia
julia> using Measurements, Symbolics

julia> @variables x_val, x_err, y_val, y_err
4-element Vector{Num}:
x_val x_err y_val y_err

julia> x = x_val ± x_err
x_val ± x_err

julia> y = y_val ± y_err
y_val ± y_err

julia> x + y
x_val + y_val ± sqrt(abs2(x_err) + abs2(y_err))

julia> x - x
0 ± 0.0
```

Operations with Arrays and Linear Algebra
-----------------------------------------

Expand Down
3 changes: 3 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ The main features of the package are:
precision](https://docs.julialang.org/en/v1/manual/integers-and-floating-point-numbers/#Arbitrary-Precision-Arithmetic-1)
(also called multiple precision) numbers with uncertainties. This is useful
for measurements with very low relative error
- Support for numbers with uncertainties of
[symbolic variable](https://symbolics.juliasymbolics.org/stable/manual/variables/)
type, as provided by `Symbolics.jl` package.
- Define arrays of measurements and perform calculations with them. Some linear
algebra functions work out-of-the-box
- Propagate uncertainty for any function of real arguments (including functions
Expand Down
7 changes: 4 additions & 3 deletions docs/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ where
- `err` is its uncertainty, assumed to be a [standard
deviation](https://en.wikipedia.org/wiki/Standard_deviation).

They are both subtype of `AbstractFloat`. Some keyboard layouts provide an easy
They are both subtype of `Real`. Some keyboard layouts provide an easy
way to type the `±` sign, if your does not, remember you can insert it in Julia
REPL with `\pm` followed by `TAB` key. You can provide `val` and `err` of any
subtype of `Real` that can be converted to `AbstractFloat`. Thus,
`measurement(42, 33//12)` and `pi ± 0.1` are valid.
subtype of `Real` that can be converted to `AbstractFloat`, or are
[symbolic variables](https://symbolics.juliasymbolics.org/stable/manual/variables/).
Thus, `measurement(42, 33//12)` and `pi ± 0.1` are valid.

`measurement(value)` creates a `Measurement` object with zero uncertainty, like
mathematical constants. See below for further examples.
Expand Down

0 comments on commit 8469fd2

Please sign in to comment.