6

Im making a calculator app for Android, and a user requested for a derivatives calculator. Is there any preloaded function or a custom method available? Thanks.

Erol
  • 6,478
  • 5
  • 41
  • 55
  • 5
    There's definitely nothing in the Android API or in the JDK. To compute derivatives, first you'd have to have a representation for *functions*, and you'd probably be plotting them, etc. How you compute derivatives depends on how you represent functions: *numerically* or *symbolically*. Both can be done, and there are certainly libraries that can help with both, but they're apples and oranges, so you need to pick one first. – Ernest Friedman-Hill Jul 21 '12 at 21:16
  • http://code.google.com/p/symja/ might be what you need. – assylias Jul 21 '12 at 21:21
  • I saw a similar question on this site. Might be useful to you . Good luck. – MathewE Jul 25 '12 at 07:35
  • This may help you: http://en.wikipedia.org/wiki/List_of_numerical_libraries#Java – nosferat Jul 26 '12 at 11:53

2 Answers2

2

If Internet access is going to be available, you could delegate differentiation to Wolfram Alpha. Although free of charge API usage comes with limitations in the number of API calls.

johnidis
  • 111
  • 4
1

I'll attempt to answer, following on from @Ernest in the comments.

It depends largely on what derivatives you want to include. If you want to be able to differentiate only polynomials then it would be pretty easy to just write your own differentiation methods because they're really straightforward.

The part that requires thought is in representing the polynomials. This could simply be done by storing each term as a pair consisting of the coefficient and the exponent parts. With some simple multiplication and subtraction, you can differentiate.

You could take it a step further using recursion and implement the Chain Rule for differentiation to allow differentiation of nested polynomials.

For most people, this is probably good enough, or better than they need.

My suggestion: limit your scope and have fun doing it yourself

Mike T
  • 4,747
  • 4
  • 32
  • 52