Skip to content

Commit 359bf05

Browse files
author
vlazzarini
committed
added log and exp, and adjusted complex page
1 parent f9b9721 commit 359bf05

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

docs/math/complex.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,28 @@ For Complex and Complex[] types, the following functions are supported
1212
* [arg](../opcodes/arg.md) - argument
1313
* [complex](../opcodes/complex.md) - rectangular conversion
1414
* [conj](../opcodes/conj.md) - conjugation
15+
* [exp](../opcodes/exp.md) - argument
1516
* [imag](../opcodes/imag.md) - imaginary part
17+
* [log](../opcodes/log.md) - logarithm
1618
* [polar](../opcodes/polar.md) - polar conversion
1719
* [real](../opcodes/real.md) - real part
1820

21+
A complex number can be created using the `complex` function/cast (for
22+
scalars or vector arrays)
23+
24+
``` csound-orc
25+
complex(real:{k},imag:{k})
26+
```
27+
28+
1929
Assignment and initialisation are also supported with comma-separated arguments for
2030
both real and imaginary parts respectively,
2131

2232
``` csound-orc
23-
var:Complex = real:{k,i}, imag:{k,i}
33+
var:Complex = real:{k}, imag:{k}
2434
```
2535

26-
36+
Generally, operations resulting in Complex types run at both at init
37+
and perf-time. Operations consuming Complex types run at either init,
38+
perf, or init and perf, depending on the output type.
2739

docs/opcodes/complex.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,26 @@ id:complex
33
category:Mathematical Operations:Mathematical Functions
44
-->
55
# conj
6-
Returns a complex number in rectangular format.
6+
Returns a complex number, optionally in polar form.
77

88

99
## Syntax
1010
``` csound-orc
1111
complex(var:Complex)
1212
complex(var:Complex[])
13+
complex(arg1:k, arg2:k[,isPolar:i])
14+
complex(real:k[], imag:k[])
15+
complex(real:a, imag:a)
1316
```
1417

15-
where the argument within the parentheses may be an expression.
1618
A complex number or a complex array is given as the result of this
17-
function.
19+
function. For the k-var version, it is possible to return a polar
20+
complex number by setting the optional argument to 1, and the two
21+
arguments are interpreted as magnitude and angle.
1822

23+
The other opcode overloads all return in rectangular form, so the opcode can
24+
be used as a polar-to-rectangular converter. The array and a-sig
25+
versions return a Complex vector.
1926

2027

2128
## See also

docs/opcodes/exp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Returns e raised to the xth power.
77

88
## Syntax
99
``` csound-orc
10-
exp(x) (no rate restriction)
11-
exp(k/i[]) (k- or i-arrays)
10+
exp({a,k,i,Complex})
11+
exp({k[],i[],Complex[]})
1212
```
1313

1414
where the argument within the parentheses may be an expression. Value converters perform arithmetic translation from units of one kind to units of another. The result can then be a term in a further expression.

docs/opcodes/log.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ The argument value is restricted for _log_, [log10](../opcodes/log10.md), and [s
1111

1212
## Syntax
1313
``` csound-orc
14-
log(x) (no rate restriction)
15-
log(k/i[]) (k- or i-arrays )
14+
log({a,k,i,Complex})
15+
log({k[],i[],Complex[]})
1616
kout[] log kin[], ibas
1717
```
1818

0 commit comments

Comments
 (0)