Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Method to find derivative  RSS feed

 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for giving an idea.
 
Ivan Capponi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uhm, I know this is a 10 years ago thread but I wanted to give you for users that come here.
I've just done a video introducing a library to do that:



Here are sources, if needed: Dropbox download
Hope this will help.
 
Campbell Ritchie
Marshal
Posts: 55751
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!