A limit problem. (Is something wrong with matlab?)

In summary, the conversation discusses an issue with the limit algorithm of MATLAB when finding the derivative of a function using different methods. The result obtained using the limit function is incorrect, while using the derivative function gives the expected result. It is suggested to use the exponent definition of the function to find the derivative instead.
  • #1
oahsen
59
0
With the following code segment ;
limit((sin(z+h)-sin(z))/h,h,0)
matlab gives the result cos(z). (which is the differential of the sin(z)).
However, with the code ;
limit((sinh(z+h)-sinh(z))/h,h,0)
matlab gives an absurd result;
limit((sinh(z+h)-sinh(z))/h,h = 0)
newertheless, the result should be cosh(z). Why does MATLAB makes such a wrong calculation also what is the meaning of this result? Does anybody have an idea about that?
 
Physics news on Phys.org
  • #2
I tried the same code, and i got:

ans=
NaN

I don't know why this answer is given. However, if you are looking for the derivitive of a function, try this line:

> syms x; diff(sinh(x))
ans =
cosh(x)
 
  • #3
Just for the record, Maxima does it right.

(%i1) limit((sinh(x+h)-sinh(x))/h,h,0);

gives exp(-x)*(exp(2x)+1)/2;
 
  • #4
atqamar said:
I tried the same code, and i got:

ans=
NaN

I don't know why this answer is given. However, if you are looking for the derivitive of a function, try this line:

> syms x; diff(sinh(x))
ans =
cosh(x)

actually this is the problem. The teacher asks us to find the derivative with;
syms x; diff(sinh(x)) and after that finding it with;
syms z h; limit((sinh(z+h)-sinh(z))/h,h,0)

and he wants us to comment on the difference.

With my matlab(R2007a) I find the first result as cosh(z) as expected however with the second code it gives me ;
limit((sinh(z+h)-sinh(z))/h,h = 0).

Some of my friend said that Maxima finds the correct result. I wonder if it is something about the limit algorithm of Matlab or I do not know? What kind of comment can I write for the difference?
 
  • #5
I'm wondering if you didn't accidently enter a "=" instead of "," and MatLab just echoed it back to you.
 
  • #6
HallsofIvy said:
I'm wondering if you didn't accidently enter a "=" instead of "," and MatLab just echoed it back to you.
I checked it 1000 times. This is the copy of the command window;

>> syms z h;
>> limit((sinh(z+h)-sinh(z))/h,h,0)

ans =

limit((sinh(z+h)-sinh(z))/h,h = 0)
 
  • #7
If limits have to be used to find the derivitive, use the exponents definition of sinh(x) and find the limit:

>> syms z h; limit((((exp(z+h)-exp(-z-h))/2)-((exp(z)-exp(-z))/2))/h,h,0)
ans =
(1/2*exp(2*z)+1/2)*exp(-z)

The answer, when simplified, is cosh(x).
 

1. What is a limit problem?

A limit problem is a mathematical concept that involves finding the value that a function approaches as its input approaches a certain value. It is often used in calculus to determine the behavior of a function at a particular point.

2. How do I solve a limit problem?

To solve a limit problem, you first need to understand the function and the value that its input is approaching. Then, you can use various mathematical techniques, such as factoring, substitution, or L'Hopital's rule, to evaluate the limit and find its value.

3. What is the difference between a one-sided limit and a two-sided limit?

A one-sided limit only considers the behavior of a function as its input approaches the given value from one direction (either from the left or the right). A two-sided limit, on the other hand, considers the behavior from both directions and ensures that the function approaches the same value from both sides.

4. Why am I getting an error in Matlab when trying to solve a limit problem?

There could be several reasons for this, such as incorrect syntax or a function that is not supported by Matlab. It is also possible that there is an issue with the function itself, such as a discontinuity or division by zero, which can cause errors in the calculation of the limit.

5. Can I use Matlab to solve any type of limit problem?

Yes, Matlab can be used to solve a wide range of limit problems, including both one-sided and two-sided limits. However, it is important to understand the limitations and assumptions of the software, as well as to double-check the results for accuracy.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
897
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
18
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Back
Top