Classes
The following classes are available globally.
-
A radical expression. Radical expressions are simplified by calling the objects
simplify()
method.Usage
Create a new expression using integers with
The cube root of 27:
let expression = Radical(root: 27, index: 3)
Example
The square root of 27:
let expression = Radical(root: 27) print("Your expression is \(expression.radicand) square roots of \(expression.coefficient)") // => Your expression is 1 square roots of 27 (root 27) expression.simplify() print("Your expression is \(expression.radicand) square roots of \(expression.coefficient)") // => Your expression is 3 square roots of 3 (root 27)
Imaginary Numbers
See moresimplify()
will do nothing if simplification results in an imaginary number.Declaration
Swift
public final class Radical: Codable