Title: | Functions and Datasets for Math Used in School |
---|---|
Description: | Contains functions and datasets for math taught in school. A main focus is set to prime-calculation. |
Authors: | Jörg große Schlarmann [aut, cre], Josef Wienand [ctb] |
Maintainer: | Jörg große Schlarmann <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.4.2 |
Built: | 2024-11-13 06:22:51 UTC |
Source: | CRAN |
returns a frequency table with absolute and relative frequencies and cumulated frequencies
cancel.fraction(numerator, denominator)
cancel.fraction(numerator, denominator)
numerator |
the fraction's numerator |
denominator |
the fraction's denominator #' |
Character string
cancel.fraction(40,15) cancel.fraction(42, 56)
cancel.fraction(40,15) cancel.fraction(42, 56)
convert a decimal-number into fraction
decimal2fraction(decimal, period = 0)
decimal2fraction(decimal, period = 0)
decimal |
the decimal number to be converted, given without an repeating ending |
period |
if the decimal places have an repeating ending (period), set the period here. See examples. #' |
a character string with the fraction.
## converting 23.4323 decimal2fraction(23.4323) ## converting a number with decimal period, e.g. 12.12344444444444444444 decimal2fraction(12.123, 4)
## converting 23.4323 decimal2fraction(23.4323) ## converting a number with decimal period, e.g. 12.12344444444444444444 decimal2fraction(12.123, 4)
Greatest common divisor of two numbers
gcd(x, y)
gcd(x, y)
x |
first number |
y |
second number #' |
numeric greatest common divisor
gcd(42, 56)
gcd(42, 56)
checks if a number is decimal or integer
is.decimal(x)
is.decimal(x)
x |
the number to check #' |
true or false
is.decimal(40.15) is.decimal(4015)
is.decimal(40.15) is.decimal(4015)
checks if a number or vector is even
is.even(x)
is.even(x)
x |
the number to check #' |
true or false
is.even(45) is.even(46) x <- c(1,2,3,4,5, 6, 7) is.even(x)
is.even(45) is.even(46) x <- c(1,2,3,4,5, 6, 7) is.even(x)
check whether numbers of a vector are negative
is.negative(x)
is.negative(x)
x |
the number or vector to check #' |
true or false
is.negative(3) # this will return FALSE is.negative(-2) # this will return TRUE x <- c(-1, -2, 3.02, 4, -5.2, 6, -7) is.negative(x)
is.negative(3) # this will return FALSE is.negative(-2) # this will return TRUE x <- c(-1, -2, 3.02, 4, -5.2, 6, -7) is.negative(x)
checks if a number or vector is odd
is.odd(x)
is.odd(x)
x |
the number or vector to check #' |
true or false
is.odd(45) is.odd(46) x <- c(1,2,3,4,5, 6, 7) is.odd(x)
is.odd(45) is.odd(46) x <- c(1,2,3,4,5, 6, 7) is.odd(x)
check whether numbers of a vector are positive
is.positive(x)
is.positive(x)
x |
the number or vector to check #' |
true or false
is.positive(-3) # this will return FALSE is.positive(2) # this will return TRUE x <- c(-1, -2, 3.02, 4, -5.2, 6, -7) is.positive(x)
is.positive(-3) # this will return FALSE is.positive(2) # this will return TRUE x <- c(-1, -2, 3.02, 4, -5.2, 6, -7) is.positive(x)
check whether a vector contains prime-numbers
is.prim(y)
is.prim(y)
y |
the number or vector to check |
true or false
is.prim(8) # this will return FALSE is.prim(11) # this will return TRUE x <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) is.prim(x)
is.prim(8) # this will return FALSE is.prim(11) # this will return TRUE x <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) is.prim(x)
check whether numbers of a vector are real positive. Real positive means, that zero is included as a positive number.
is.real.positive(x)
is.real.positive(x)
x |
the number or vector to check #' |
true or false
is.real.positive(-3) # this will return FALSE is.real.positive(0) # this will return TRUE x <- c(0, -1, -2, 3.02, 4, -5.2, 6, -7) is.real.positive(x)
is.real.positive(-3) # this will return FALSE is.real.positive(0) # this will return TRUE x <- c(0, -1, -2, 3.02, 4, -5.2, 6, -7) is.real.positive(x)
check whether a vector contains numbers with decimal places
is.whole(x)
is.whole(x)
x |
the number or vector to check #' |
true or false
is.whole(3.12) # this will return FALSE is.whole(2) # this will return TRUE x <- c(1, 2, 3, 4, 5.5, 6.03, 23.07) is.whole(x)
is.whole(3.12) # this will return FALSE is.whole(2) # this will return TRUE x <- c(1, 2, 3, 4, 5.5, 6.03, 23.07) is.whole(x)
This function calculates the prime-factors of a number
prime.factor(n)
prime.factor(n)
n |
the number to be checked #' |
a vector with the prime factors
prime.factor(21) prime.factor(100)
prime.factor(21) prime.factor(100)
generate prime-numbers in a range from START to END
primes(start = 12, end = 9999)
primes(start = 12, end = 9999)
start |
the number to start from |
end |
the number to end #' |
a vector of prime numbers
primes(12,150) # list prime-numbers between 12 and 150
primes(12,150) # list prime-numbers between 12 and 150
Contains primes from 0 to 9999999
data(primlist)
data(primlist)
A vector containing primes from 0 to 9999999
Variables in the dataset:
primlist. A vector containing primes from 0 to 9999999
calculating the smallest common multiple of two numbers
scm(x, y)
scm(x, y)
x |
first number |
y |
second number #' |
numeric least common multiple
scm(3528, 3780)
scm(3528, 3780)