Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Ceiling Calculator

Ceiling

Function: ceiling (<x>) When <x> is a real number, return the least integer that is greater than or equal to <x>.

plot2d(sin(x)+1,[x,-%pi*2,%pi*2],[y,-5,5]);
plot2d([ceiling(x),floor(x)],[x,-4,4]);

If <x> is a constant expression (10 * %pi, for example), ceiling evaluates <x> using big floating point numbers, and applies ceiling to the resulting big float. Because ceiling uses floating point evaluation, its possible, although unlikely, that ceiling could return an erroneous value for constant inputs. To guard against errors, the floating point evaluation is done using three values for fpprec.

For non-constant inputs, ceiling tries to return a simplified value. Here are examples of the simplifications that ceiling knows about:

          (%i1) ceiling (ceiling (x));
          (%o1)                      ceiling(x)
          (%i2) ceiling (floor (x));
          (%o2)                       floor(x)
          (%i3) declare (n, integer)$
          (%i4) [ceiling (n), ceiling (abs (n)), ceiling (max (n, 6))];
          (%o4)                [n, abs(n), max(n, 6)]
          (%i5) assume (x > 0, x < 1)$
          (%i6) ceiling (x);
          (%o6)                           1
          (%i7) tex (ceiling (a));
          $$\left \lceil a \right \rceil$$
          (%o7)                         false

The function ceiling does not automatically map over lists or matrices. Finally, for all inputs that are manifestly complex, ceiling returns a noun form.

If the range of a function is a subset of the integers, it can be declared to be integervalued. Both the ceiling and floor functions can use this information; for example:

          (%i1) declare (f, integervalued)$
          (%i2) floor (f(x));
          (%o2)                         f(x)
          (%i3) ceiling (f(x) - 1);
          (%o3)                       f(x) - 1

(%o1)                                true
(%i2) 

Ceiling Example

Related Examples

ceiling-floor-plot2d-sin
plot2d([ceiling(x),floor(x)],[x,-4,4]);

plot2d([ceiling(x),fl...

plot2d(sin(x)+1,[x,-%...

Calculate

ceiling-floor-round

round(0.5);

ceiling(0.5);

floor(0.5);

Calculate

ceiling

ceiling(25+0)*(1+0.00...

Calculate

ceiling-floor-log-sum

/* input number n */n:7;

1+sum((1-floor((1/n)*...

Calculate

ceiling-delta-hessian-max

p1:1-((1-t1)^(n-1))*(...

t1:(2*(1-p1))/((1-2*p...

Pi1:(1-t2)*(1-t1)^n;

Calculate

ceiling-floor-kill-matrix-numer

kill(all);

a: matrix ( [3.75,-0....

floor (ceiling (x));

Calculate

ceiling

ceiling(0.5)+1.1;

Calculate

ceiling-floor

floor(1.5*1.5);

ceiling(1.5)*floor(1.5);

Calculate

ceiling

x: -2.4566765;

ceiling(x);

Calculate