Skip to content

Commit 948a743

Browse files
committed
update and
1 parent eda07b7 commit 948a743

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
},
234234
{
235235
"slug": "tracking-turntable",
236-
"name": "tracking-turntable",
236+
"name": "Tracking Turntable",
237237
"uuid": "85cec5ea-2ed4-4f9a-b629-b7f03bdc5108",
238238
"concepts": ["complex-numbers"],
239239
"prerequisites": [

exercises/concept/tracking-turntable/.docs/introduction.md

+3-32
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
`Complex numbers` are not complicated.
44
They just need a less alarming name.
55

6-
They are so useful, especially in engineering and science, that Julia includes [complex numbers][complex] as standard numeric types alongside integers and floating-point numbers.
6+
They are so useful, especially in engineering and science, that Julia includes complex numbers as standard numeric types alongside integers and floating-point numbers.
77

88
## Basics
99

@@ -16,13 +16,10 @@ To create complex numbers from two real numbers, just add the suffix `im` to the
1616
```julia-repl
1717
julia> z = 1.2 + 3.4im
1818
1.2 + 3.4im
19-
2019
julia> typeof(z)
2120
ComplexF64 (alias for Complex{Float64})
22-
2321
julia> zi = 1 + 2im
2422
1 + 2im
25-
2623
julia> typeof(zi)
2724
Complex{Int64}
2825
```
@@ -44,10 +41,8 @@ To access the parts of a complex number individually:
4441
```julia-repl
4542
julia> z = 1.2 + 3.4im
4643
1.2 + 3.4im
47-
4844
julia> real(z)
4945
1.2
50-
5146
julia> imag(z)
5247
3.4
5348
```
@@ -65,13 +60,10 @@ However, it is still a complex number in Julia.
6560
```julia-repl
6661
julia> zr = 1.2 + 0im
6762
1.2 + 0.0im
68-
6963
julia> typeof(zr)
7064
ComplexF64 (alias for Complex{Float64})
71-
7265
julia> zi = 3.4im
7366
0.0 + 3.4im
74-
7567
julia> typeof(zi)
7668
ComplexF64 (alias for Complex{Float64})
7769
```
@@ -89,27 +81,21 @@ This is a simple idea, but it leads to interesting consequences.
8981

9082
## Arithmetic
9183

92-
All of the standard mathematical [`operators`][operators] and elementary functions used with floats and integers also work with complex numbers. A small sample:
84+
All of the standard mathematical `operators` and elementary functions used with floats and integers also work with complex numbers. A small sample:
9385

9486
```julia-repl
9587
julia> z1 = 1.5 + 2im
9688
1.5 + 2.0im
97-
9889
julia> z2 = 2 + 1.5im
9990
2.0 + 1.5im
100-
10191
julia> z1 + z2 # addition
10292
3.5 + 3.5im
103-
10493
julia> z1 * z2 # multiplication
10594
0.0 + 6.25im
106-
10795
julia> z1 / z2 # division
10896
0.96 + 0.28im
109-
11097
julia> z1^2 # exponentiation
11198
-1.75 + 6.0im
112-
11399
julia> 2^z1 # another exponentiation
114100
0.5188946835878313 + 2.7804223253571183im
115101
```
@@ -127,16 +113,12 @@ There are several functions, in addition to `real()` and `imag()`, with particul
127113
```julia-repl
128114
julia> z1
129115
1.5 + 2.0im
130-
131116
julia> conj(z1)
132117
1.5 - 2.0im
133-
134118
julia> abs(z1)
135119
2.5
136-
137120
julia> abs2(z1)
138121
6.25
139-
140122
julia> angle(z1)
141123
0.9272952180016122
142124
```
@@ -151,15 +133,13 @@ Here is an example using some constants:
151133
```julia-repl
152134
julia> euler = exp(1im * π)
153135
-1.0 + 1.2246467991473532e-16im
154-
155136
julia> real(euler)
156137
-1.0
157-
158138
julia> round(imag(euler), digits=15) # round to 15 decimal places
159139
0.0
160140
```
161141

162-
The polar `(r, θ)` notation is so useful, that there are built-in functions `cis` and `cispi` for constructing it more efficiently.
142+
The polar `(r, θ)` notation is so useful, that there are built-in functions `cis` (short for `cos(x) + isin(x)`) and `cispi` (short for `cos(πx) + isin(πx)`) which can help in constructing it more efficiently.
163143

164144
```julia-repl
165145
julia> exp(1im * π) ≈ cis(π) ≈ cispi(1)
@@ -171,22 +151,13 @@ The approximate equality above is because the functions `cis` and `cispi` can gi
171151
```julia-repl
172152
julia> cis(π)
173153
-1.0 + 0.0im
174-
175154
julia> cispi(1)
176155
-1.0 + 0.0im
177-
178156
julia> θ = π/2;
179157
julia> exp(im*θ)
180158
6.123233995736766e-17 + 1.0im
181-
182159
julia> cis(θ)
183160
6.123233995736766e-17 + 1.0im
184-
185161
julia> cispi(θ / π) # θ/π == 1/2
186162
0.0 + 1.0im
187163
```
188-
189-
[complex]: https://docs.julialang.org/en/v1/manual/complex-and-rational-numbers/#Complex-Numbers
190-
[math-complex]: https://www.nagwa.com/en/videos/143121736364/
191-
[engineering-complex]: https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers
192-
[operators]: https://docs.julialang.org/en/v1/manual/mathematical-operations/#Arithmetic-Operators

0 commit comments

Comments
 (0)