# Math Help - MATLAB

1. ## MATLAB

The functions

f(x)= (sqrt(x^2+1) - 1) /x^2 and g(x) = 1/ (sqrt(x^2+1) +1)

1)Using MATLAB compute the limit as x approaches to 0 by looking at the values x=1/2^i for i=1:30

2) What happens if you set r=sqrt(ulp) and evaluate f(r) and g(r)?

anything would help.

2. Originally Posted by Juancd08
The functions

f(x)= (sqrt(x^2+1) - 1) /x^2 and g(x) = 1/ (sqrt(x^2+1) +1)

1)Using MATLAB compute the limit as x approaches to 0 by looking at the values x=1/2^i for i=1:30

2) What happens if you set r=sqrt(ulp) and evaluate f(r) and g(r)?

anything would help.
First it would help if you created function for the functions.

something like:

Code:
function rv=ff(x)
rv=(sqrt(x.^2+1)-1)./x.^2;
and:

Code:
function rv=gg(x)
r=1./ (sqrt(x.^2+1) +1);
then:

Code:
i=1:30;
x=2.^(-i);

ff(x)
gg(x)
Will show the values at a sequence of points approaching zero.

RonL