README.md (2719B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # conj 22 23 > Return the [complex conjugate][complex-conjugate] of a complex number. 24 25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> 26 27 <section class="intro"> 28 29 </section> 30 31 <!-- /.intro --> 32 33 <!-- Package usage documentation. --> 34 35 <section class="usage"> 36 37 ## Usage 38 39 ```javascript 40 var conj = require( '@stdlib/complex/conj' ); 41 ``` 42 43 #### conj( z ) 44 45 Returns the [complex conjugate][complex-conjugate] of a `complex` number. 46 47 ```javascript 48 var Complex128 = require( '@stdlib/complex/float64' ); 49 50 var z = new Complex128( 5.0, 3.0 ); 51 var str = z.toString(); 52 // returns '5 + 3i' 53 54 var v = conj( z ); 55 str = v.toString(); 56 // returns '5 - 3i' 57 ``` 58 59 </section> 60 61 <!-- /.usage --> 62 63 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 64 65 <section class="notes"> 66 67 </section> 68 69 <!-- /.notes --> 70 71 <!-- Package usage examples. --> 72 73 <section class="examples"> 74 75 ## Examples 76 77 <!-- eslint no-undef: "error" --> 78 79 ```javascript 80 var Complex128 = require( '@stdlib/complex/float64' ); 81 var randu = require( '@stdlib/random/base/randu' ); 82 var round = require( '@stdlib/math/base/special/round' ); 83 var conj = require( '@stdlib/complex/conj' ); 84 85 var re; 86 var im; 87 var z; 88 var i; 89 90 for ( i = 0; i < 100; i++ ) { 91 re = round( (randu()*100.0) - 50.0 ); 92 im = round( (randu()*50.0) - 25.0 ); 93 z = new Complex128( re, im ); 94 console.log( 'conj(%s) = %s', z.toString(), conj( z ).toString() ); 95 } 96 ``` 97 98 </section> 99 100 <!-- /.examples --> 101 102 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 103 104 <section class="references"> 105 106 </section> 107 108 <!-- /.references --> 109 110 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 111 112 <section class="links"> 113 114 [complex-conjugate]: https://en.wikipedia.org/wiki/Complex_conjugate 115 116 </section> 117 118 <!-- /.links -->