isprime
Determines if x is a prime number.
Syntax
isprime(x)
Inputs
- x
- Type: double | integer | char | string | logical | struct | cell
Outputs
- R
- Numerical equivalent true/false.
Example
Simple isprime example:
isprime(7)
R = 1
Discover new features and enhancements.
New to Activate? Learn the basics here.
Start using Activate with our interactive tutorials.
Learn about the features and functionality available in Activate.
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 that are common to two sets, without duplication.
Generalized reversing transpose of a matrix, using a permutation vector.
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 maximum values.
Returns the mean of X. When x is a matrix the mean for each column and returns them in a row vector.
Returns minimum values.
Returns x modulo y.
Returns the number of dimensions of an array.
Computes the exponent of the smallest power of 2 that is greater than or equal to the input in magnitude.
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.
Returns vector or matrix element products.
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).
Rounds values to specified precision.
Returns the subset of the first set that does not belong to the second set.
Returns the elements contained in either of two sets, but not in their intersection.
Shift dimensions.
Returns the sign of the value passed in.
Marks the given input in as a single precision data type. Single precision data can be used in the save command to write with single precision in .mat files.
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.
Returns vector or matrix element sums.
Returns the elements contained in either of two sets, without duplication.
Returns the elements of a set, without duplication.
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.
Provides information about developing and simulating models through the Activate Application Program Interface.
Key terms associated with the software.
You've got questions? We've got answers!
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.
Determines if x is a prime number.
Determines if x is a prime number.
isprime(x)
Simple isprime example:
isprime(7)
R = 1
© 2022 Altair Engineering, Inc. All Rights Reserved.
Intellectual Property Rights Notice | Technical Support | Cookie Consent