How to find limit of the function in Octave
How to calculate the limit of a function in Octave with some practical examples.
What do you need? You must have already installed the GNU Octave open source software on your PC and the Symbolic module.
Define the independent variable x symbol of the function using syms on the Octave command line.
syms x
Now calculate limit as x approaches infinity x→∞ of the function f(x)=(x+1)/(x-1)
$$ \lim_{x \rightarrow + \infty} \frac{x+1}{x-1} $$
Type the limit() command
Write the function name f (x) in the first parameter and the variable name x in the second parameter. Then hit enter.
limit((x+1)/(x-1),x)
Octave calculates the limit of the function as x→∞
ans = (sym) 1
In this case the limit of the function is 1
Verify. The limit of the function f(x)=(x+1)/(x-1) as x→∞ is 1. $$ \lim_{x \rightarrow + \infty} \frac{x+1}{x-1} = 1 $$
If you want to calculate the limit as x approaches minus infinity x→-∞, type the same command adding -inf in the third parameter
limit((x+1)/(x-1),x,-inf)
The output result is 1
ans = (sym) 1
Verify. The limit of the function f(x)=(x+1)/(x-1) as x→-∞ is 1. $$ \lim_{x \rightarrow - \infty} \frac{x+1}{x-1} = 1 $$
To evaluate a limit of x approaching x0, where a is x0 finite number, type the same command and indicate x0 in the third parameter.
For example, calculate the limit of the function as x tends two (x → 2)
limit((x+1)/(x-1),x,2)
The output result is 3
ans = (sym) 3
Verify. The limit of the function f(x)=(x+1)/(x-1) as x→2 is 3. $$ \lim_{x \rightarrow 2} \frac{x+1}{x-1} = 3 $$
If you just want to calculate the hand right limit, use the same command and type 'right' in the fourth parameter.
limit((x+1)/(x-1),x,1,'right')
The output result is infinite ( ∞ )
ans = (sym) ∞
Verify. The limit of the function f(x)=(x+1)/(x-1) as x→1+ is infinity. $$ \lim_{x \rightarrow 1^+} \frac{x+1}{x-1} = + \infty $$
To calculate the hand left limit, use the same command and type 'left' in the fourth parameter.
limit((x+1)/(x-1),x,1,'left')
The output result is minus infinite ( -∞ )
ans = (sym) -∞
Verifiy. The limit of the function f(x)=(x+1)/(x-1) as x→1- is minus infinity. $$ \lim_{x \rightarrow 1^-} \frac{x+1}{x-1} = - \infty $$
If this practical lesson is useful and has helped you, please continue to follow us.