# Method to find derivative

dhwani mathur

Ranch Hand

Posts: 621

posted 8 years ago

- 0

ok

I have to find derivative of a function in java,but i am not getting which method and from which class of java package i should use.Please

if anyone has any idea your suggestions are welcome.

Thanks in advance.

I have to find derivative of a function in java,but i am not getting which method and from which class of java package i should use.Please

if anyone has any idea your suggestions are welcome.

Thanks in advance.

Peter Chase

Ranch Hand

Posts: 1970

posted 8 years ago

- 0

I presume by derivative, you mean f'(x) = dy/dx, where y = f(x).

There's no function, to my knowledge, to find the derivative in Java. You won't find that in many, if any, general-purpose programming languages. You'd need something maths-specific - maybe Matlab (I don't know if it actually has this feature, but it might).

There are two completely different ways you might want your derivative.

First, you might want to do it analytically. That is, given some machine-understandable formula for f(x), it should be able to work out an exact formula for f'(x). This would only be possible for certain classes of function, for which derivatives are reasonably easy to compute analytically.

The alternative is that you might want to compute the derivative numerically, at a particular value of x. A numerical method can work for any type of f(x) - well any f(x) that's not discontinuous anyway. There are various algorithms for this: try the Numerical Recipes books, for instance. All of these will be inexact, but they can get close to an exact answer, depending on the algorithm chosen and the type of function f(x).

There's no function, to my knowledge, to find the derivative in Java. You won't find that in many, if any, general-purpose programming languages. You'd need something maths-specific - maybe Matlab (I don't know if it actually has this feature, but it might).

There are two completely different ways you might want your derivative.

First, you might want to do it analytically. That is, given some machine-understandable formula for f(x), it should be able to work out an exact formula for f'(x). This would only be possible for certain classes of function, for which derivatives are reasonably easy to compute analytically.

The alternative is that you might want to compute the derivative numerically, at a particular value of x. A numerical method can work for any type of f(x) - well any f(x) that's not discontinuous anyway. There are various algorithms for this: try the Numerical Recipes books, for instance. All of these will be inexact, but they can get close to an exact answer, depending on the algorithm chosen and the type of function f(x).

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.

I agree. Here's the link: http://aspose.com/file-tools |