Calculator Usage Guide

This guide provides examples and explanations for using the calculator with its supported operators and functions.

Arithmetic Operators

The calculator supports the following arithmetic operators:

  • + (Addition)
  • - (Subtraction)
  • * (Multiplication)
  • / (Division)
  • % (Remainder/Modulo)
  • ^ (Exponentiation)

Examples:

2 + 3

Result: 5

10 - 5

Result: 5

4 * 6

Result: 24

15 / 3

Result: 5

17 % 5 Calculate the remainder when 17 is divided by 2.

Result: 2

2 ^ 3

Result: 8

4 ^ 0.5

Result: 2

-2 + 5

Result: 3

Combining Arithmetic Operations:

2 * (3 + 4) / 2

Result: 7

10 % 3 + 2 ^ 2 - 1

Result: 4

Comparison Operators

The calculator supports the following comparison operators:

  • == (Equal to)
  • != (Not equal to)
  • > (Greater than)
  • < (Less than)
  • >= (Greater than or equal to)
  • <= (Less than or equal to)

Note: These operators return True or False.

Examples:

5 == 5

Result: True

5 != 5

Result: False

10 > 5

Result: True

3 < 7

Result: True

8 >= 8

Result: True

2 <= 5

Result: True

Combining Comparison and Arithmetic Operations:

5^(1/7) > 3^(1/5)

Result: True

abs(-10) / 2 == 5

Result: True

(2 + 3) * 2 > 8

Result: True

Functions

The calculator supports a variety of functions, as described below.

Greatest Common Divisor (GCD) / Highest Common Factor (HCF)

hcf(...) or gcd(...): Calculates the greatest common divisor of multiple numbers.

hcf(12, 18, 24)

Result: 6

gcd(12, 18)

Result: 6

Least Common Multiple (LCM)

lcm(...): Calculates the least common multiple of multiple numbers.

lcm(4, 6, 8)

Result: 24

Prime Factorization

factors(n): Finds the prime factors of a number n. Returns a list of the prime factors.

factors(24)

Result: 2 * 2 * 2 * 3

factors(1)

Result: 1

Square Root

sqrt(x): Calculates the square root of x.

sqrt(9)

Result: 3

Absolute Value

abs(x): Calculates the absolute value of x.

abs(-5)

Result: 5

Rounding Functions

floor(x): Rounds x down to the nearest integer.

ceil(x): Rounds x up to the nearest integer.

round(x, d): Rounds x to d decimal places.

floor(3.7)

Result: 3

ceil(3.2)

Result: 4

round(3.14159, 2)

Result: 3.14

Combining Functions and Previous Operators:

sqrt(abs(-16)) + 3 * 2

Result: 10

round(3.14159, 2) > 3.14

Result: False

hcf(12, 18) + sqrt(9)

Result: 9

Constants

pi(): Returns the value of π (approximately 3.14159).

pi()

Result: 3.14159...

Combining Constants with other features

round(pi(), 2)

Result: 3.14

pi() > 3

Result: True

Exponential and Logarithmic Functions

exp(x): Calculates ex.

log(x): Calculates the natural logarithm (base e) of x.

log10(x): Calculates the base-10 logarithm of x.

exp(2)

Result: 7.3890560989307

log(exp(1))

Result: 1

log10(100)

Result: 2

Combining Exponential and Logarithmic functions with previous features

round(log(exp(2)), 2)

Result: 2

exp(1) > 2

Result: True

sqrt(exp(1)) + log10(100)

Result: 3.6487212707001

Trigonometric Functions

These functions operate on angles in radians:

  • sin(x): Sine of x
  • cos(x): Cosine of x
  • tan(x): Tangent of x
  • asin(x): Arcsine (inverse sine) of x
  • acos(x): Arccosine (inverse cosine) of x
  • atan(x): Arctangent (inverse tangent) of x
  • atan2(y, x): Arctangent of y/x, considering the quadrant

sin(pi()/2)

Result: 1

cos(0)

Result: 1

tan(pi()/4)

Result: 1

asin(1)

Result: 1.5707963267949

acos(1)

Result: 0

atan(1)

Result: 0.78539816339745

atan2(1,0)

Result: 1.5707963267949

atan2(0,1)

Result: 0

Combining Trigonometric Functions with Previous Features:

round(sin(pi()/4), 2)

Result: 0.71

sin(pi()/2) == 1

Result: True

sqrt(cos(0)) + log(exp(1))

Result: 2

factors(round(asin(1), 0))

Result: 2

Hyperbolic Functions

  • sinh(x): Hyperbolic sine of x
  • cosh(x): Hyperbolic cosine of x
  • tanh(x): Hyperbolic tangent of x
  • asinh(x): Inverse hyperbolic sine
  • acosh(x): Inverse hyperbolic cosine
  • atanh(x): Inverse hyperbolic tangent

sinh(1)

Result: 1.1752011936438

cosh(1)

Result: 1.5430806348152

tanh(1)

Result: 0.76159415595576

asinh(1)

Result: 0.88137358701954

acosh(2)

Result: 1.3169578969248

atanh(0.5)

Result: 0.54930614433405

Combining Hyperbolic Functions with Previous Features:

round(sinh(1), 2)

Result: 1.18

cosh(1) > 1.5

Result: True

sqrt(round(tanh(1), 1)) + log(2)

Result: 1.5875743715599

round(acosh(2) * sin(pi()/6), 2)

Result: 0.66

Rational Numbers

rational(a, b): Simplifies the fraction a/b.

to_rational(x, y=1000): Converts x to a rational number with a maximum denominator y. Defaults to a maximum denominator of 1000 if y isn't specified.

rational(12, 18)

Result: 2/3

to_rational(0.333)

Result: 333/1000

to_rational(0.333, 10)

Result: 1/3

to_rational(0.143, 100)

Result: 1/7

Combining Rational Numbers with Previous Features:

to_rational(0.5) == rational(1, 2)

Result: True

Summation

Σ(start, end, term) or sum(start, end, term): Calculates the summation of a term from start to end, using i as the variable. The maximum range is 100,000.

Σ(1, 5, i^2)

Result: 55

Note: 1 + 4 + 9 + 16 + 25 = 55

sum(1, 5, i*2)

Result: 30

Note: 2 + 4 + 6 + 8 + 10) = 30

sum(1, 3, 1/i)

Result: 1.8333333333333

sum(1, 10, sin(i/10))

Result: 5.0138809809837

Combining Summation with Previous Features

round(sum(1, 5, i^2 / 10), 2)

Result: 5.5

sum(1, 3, i) > 5

Result: True

Sum of Primes

sum_prime(a, b): Returns the sum of all prime numbers starting from the a-th prime to the b-th prime. The values of a and b cannot exceed 10,000.

sum_prime(1, 5)

Result: 28

Note: 2 + 3 + 5 + 7 + 11) = 28

sum_prime(3, 7)

Result: 53

Note: 5 + 7 + 11 + 13 + 17 = 53

Combining Sum of Primes with Previous Features:

sum_prime(1, 3) + sum_prime(4, 6)

Result: 41

round(sum_prime(1, 5)/5, 2)

Result: 5.6

factors(sum_prime(1, 3))

Result: 2 * 5

sum_prime(1, 2) > 4 as (2 + 3) > 5

Result: True

Error Handling

The calculator may return an error if you enter an invalid expression. For example:

sqrt(-1)

Result: NAN

log(0)

Result: -INF

log(-1)

Result: NAN

1 / 0

Result: Calculation Error: Syntax Error: Division by zero

sum(1, 100002, i)

Result: Summation Error: The range is too large. Maximum allowed range is 100,000.

Important Notes

  • Angles for trigonometric functions are expected to be in radians.
  • The summation function has a maximum range to prevent excessive computation.
  • Division by zero will result in an error.
  • Logarithms of negative numbers will result in NAN (Not a number).
  • Input values for functions like sqrt() and log() must be within their valid domains.

Copyright © 2021-2025 XpertEdu.in, All Rights Reserved.