1 | ### conj =====================================================================
|
2 |
|
3 | Tags
|
4 | ----
|
5 | scripting, JS, internal, treenode, general concept
|
6 |
|
7 | Parameters
|
8 | ----------
|
9 | z
|
10 |
|
11 | General description
|
12 | -------------------
|
13 | Returns the complex conjugate of z.
|
14 |
|
15 | ###
|
16 |
|
17 |
|
18 | Eval_conj = ->
|
19 | push(cadr(p1))
|
20 | Eval()
|
21 | p1 = pop()
|
22 | push(p1)
|
23 | if (!Find(p1, imaginaryunit)) # example: (-1)^(1/3)
|
24 | polar()
|
25 | conjugate()
|
26 | clockform()
|
27 | else
|
28 | conjugate()
|
29 |
|
30 |
|
31 | # careful is you pass this one an expression with
|
32 | # i (instead of (-1)^(1/2)) then this doesn't work!
|
33 | conjugate = ->
|
34 | push(imaginaryunit)
|
35 | push(imaginaryunit)
|
36 | negate()
|
37 | subst()
|
38 | Eval()
|