Skip to content

Commit 84f025c

Browse files
committed
Demonstrate explicit imports
1 parent f144936 commit 84f025c

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,14 @@ julia> x = 0.3u"km/s"
7878

7979
julia> y = 42 * u"kg"
8080
42.0 kg
81+
```
82+
83+
or by importing explicitly:
84+
85+
```julia
86+
julia> using DynamicQuantities: kPa
8187

82-
julia> room_temp = 100u"kPa"
88+
julia> room_temp = 100kPa
8389
100000.0 m⁻¹ kg s⁻²
8490
```
8591

docs/src/examples.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@ using DynamicQuantities
4747
Set up initial conditions as quantities:
4848

4949
```julia
50-
y0 = 10u"km"
51-
v0 = 250u"m/s"
50+
# Can explicitly import units:
51+
using DynamicQuantities: km, m, s, min
52+
53+
y0 = 10km
54+
v0 = 250m/s
5255
θ = deg2rad(60)
53-
g = 9.81u"m/s^2"
56+
g = 9.81m/s^2
5457
```
5558

5659
Next, we use trig functions to calculate x and y components of initial velocity.
@@ -67,7 +70,7 @@ Note that these are the same dimension (time), so it's fine to treat
6770
them as dimensionally equivalent!
6871

6972
```julia
70-
t = range(0u"s", 1.3u"min", length=100)
73+
t = range(0s, 1.3min, length=100)
7174
```
7275

7376
Next, use kinematic equations to calculate x and y as a function of time.

0 commit comments

Comments
 (0)