simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

square.md (1067B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function square
      4 
      5 Compute the square of a value, `x * x`.
      6 For matrices, the function is evaluated element wise.
      7 
      8 
      9 ## Syntax
     10 
     11 ```js
     12 math.square(x)
     13 ```
     14 
     15 ### Parameters
     16 
     17 Parameter | Type | Description
     18 --------- | ---- | -----------
     19 `x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix &#124; Unit |  Number for which to calculate the square
     20 
     21 ### Returns
     22 
     23 Type | Description
     24 ---- | -----------
     25 number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix &#124; Unit |  Squared value
     26 
     27 
     28 ### Throws
     29 
     30 Type | Description
     31 ---- | -----------
     32 
     33 
     34 ## Examples
     35 
     36 ```js
     37 math.square(2)           // returns number 4
     38 math.square(3)           // returns number 9
     39 math.pow(3, 2)           // returns number 9
     40 math.multiply(3, 3)      // returns number 9
     41 
     42 math.square([1, 2, 3, 4])  // returns Array [1, 4, 9, 16]
     43 ```
     44 
     45 
     46 ## See also
     47 
     48 [multiply](multiply.md),
     49 [cube](cube.md),
     50 [sqrt](sqrt.md),
     51 [pow](pow.md)