primes
Returns all primes up to X.
Syntax
primes(x)
Inputs
- x
- Any real or complex integer.
Outputs
- R
- Resulting primes vector.
Example
Simple and complex input primes examples.
primes(17)
ans = [Matrix] 1 x 7
2 3 5 7 11 13 17
Discover new features and enhancements.
New to Activate? Learn the basics here.
Start using Activate with our interactive tutorials.
Learn about the components in Activate models.
Learn about modeling physical components.
Learn how to set up, run, and troubleshoot simulations.
Discover options to review, display, and export results.
Learn about block libraries for building dynamic system models.
Explore the Extended Definitions, OML Guides, Block Library, API Guide and Glossary.
PDF file with in-depth information on key topics in the User's Guide.
OpenMatrix is a mathematical scripting language.
The Reference Guide contains documentation for all functions supported in the OpenMatrix language.
Returns the absolute value of a scalar/matrix/complex number.
Array accumulation.
Returns the phase angle of z equal to atan2(imag(z), real(z)).
Converts numbers from binary or a specified base to their decimal equivalents.
Converts binary numbers to their decimal equivalents.
Converts Cartesian coordinates to polar or cylindrical.
Converts Cartesian coordinates to spherical.
Returns the smallest integer that is greater than or equal to x.
Circular shift.
Returns a complex number composed of real elements.
Sorts x into its ascending pairs by real part.
The cumulative product of object's elements along a specified dimension.
The cumulative sum of an object's elements along a specified dimension.
Converts non-negative integers to their equivalents in binary or a specified base.
Converts non-negative integers to their binary equivalents.
Converts non-negative integers to their hexadecimal equivalents.
Creates a diagonal matrix or returns the diagonal elements of a matrix on diagonal k.
Returns a vector or matrix of differences.
Converts A into double precision type.
Symbol for the base of the natural logarithm.
The spacing between two adjacent numbers in a given machine's floating point system, Epsilon.
For each element of x, returns e^x.
Returns an identity matrix.
Returns the prime factorization of X. If two outputs are requested, returns the unique primes of X.
Returns the position of non-zero elements in a matrix.
Rounds X down to zero.
Returns R, which is the matrix, m, flipped along the axis, a.
Returns R, which is the matrix, m, with its columns flipped left to right.
Returns R, which is the matrix, m, with its rows flipped from top to bottom.
Returns the largest integer that is not greater than x.
Returns the greatest common deviser of the set x.
Converts hexadecimal numbers to their decimal equivalents.
The imaginary number i, such that i^2 = -1
Returns the imaginary component of a complex number.
Returns subscript from the linear index ind.
Returns the elements in both a and b.
Determines if x is a logical value.
Determines if x is a complex value.
Determines if x is an empty value.
Compares x1,x2,... to each other; if all are equal, returns boolean value true, otherwise returns false.
Returns a logical value indicating whether the input is global in scope.
Determines if x is a logical value.
Determine which elements of the first argument exist in the second argument.
Determines if x is a prime number.
Determines if x is a real number.
Returns true if the array x sorted by mode. By default mode is ascending.
Determines if x is a vector.
The imaginary number i, such that i^2 = -1.
Least common multiple.
Returns the length of an object's largest dimension.
Computes the natural log for each element of x.
Computes the base-2 logarithm of a matrix.
Computes the base-10 logarithm for each element of x.
Converts x to a logical type.
Returns the maximum value of matrix.
Returns the mean of X. When x is a matrix the mean for each column and returns them in a row vector.
Returns the minimum value of a matrix.
Returns x modulo y.
Returns the number of dimensions of an array.
Returns the number of elements in x.
Returns a matrix of ones.
Generalized transpose of a matrix, using a permutation vector.
Symbol for pi.
Converts polar or cylindrical coordinates to Cartesian.
Computes powers of 2.
Returns all primes up to X.
Takes the product of elements along dimension dim.
Computes the rank of matrix A.
Returns a rational approximation of the input using a continued fraction approximation.
Returns the real part of x.
Returns a matrix whose elements are all the largest floating point number that is representable.
Returns a matrix whose elements are all the smallest normalized floating point number that is representable.
The resulting remainder of x / y.
Replicates an input to create a block matrix with the number of specified replications in each dimension.
Returns a matrix with the same elements as the input, but with reassigned dimensions.
Returns R, the result of rotating matrix, m, in 90-degree succession(s).
Returns nearest integer to x.
Returns a matrix of the elements in matrix that are not in another specified matrix.
Returns the elements exclusive to a or b.
Shift dimensions.
Returns the sign of the value passed in.
Returns the size of each dimension of an object.
Converts spherical coordinates to Cartesian.
Returns the square root of each element of x.
Removes singular dimensions from a matrix.
Converts subscript to a linear index. From dimensions x and index i,j.
Sums up the elements within the input A, along the dimension d (if d is given).
Returns the elements that are in matrices x and y. If 'rows' is provided then each row will be considered its on set.
Returns the unique elements in the input x
Converts a vector, v, to a matrix with the specified number of columns, c.
Creates a matrix of zeros.
Describes all of the blocks in the installed Activate library.
Key terms associated with the software.
Define shortcuts to common operations.
Explore the Extended Definitions, OML Guides, Block Library, API Guide and Glossary.
The Reference Guide contains documentation for all functions supported in the OpenMatrix language.
Returns all primes up to X.
Returns all primes up to X.
primes(x)
Simple and complex input primes examples.
primes(17)
ans = [Matrix] 1 x 7
2 3 5 7 11 13 17
(c) Altair Engineering, Inc. All rights reserved.