5

I now have an idea, that I use the function as a string, and I calculate the real integral by hand, and ask a question to the user what the definite integral is, but that isn't a real solution.

I was wondering if there was a way to input a function and output an integral/derivative (depending on user choice). My initial step was to put it into an array somehow, but given the many types of functions, this wasn't happening.

I researched everywhere, and I haven't found a method that actually does this with no additional code, nor any code that actually does this, period.

Also, I want to see if there was a way to make a GUI interface and plot inputted functions on to that, if that's possible too.

Thanks :)

2 Answers2

2

What you're describing is known as symbolic integration. There's currently no fully general way to implement it, but there are some techniques available. One such is the Risch algorithm.

Alternatively, an easier problem than symbolic integration is [symbolic differentiation -- and, if the differential of the user's input is equivalent* to the expression which they were asked to integrate, then their integral is probably correct.

You may also want to consider using an existing CAS**, such as Mathematica, to implement this. They've already implemented most of the tools you're after.

*: Keep in mind, though, that two mathematical expressions may be equivalent without being identical, either in trivial ways (e.g, terms in a different order), more complex ones (e.g, large expressions factored differently), or fundamentally (e.g, trig functions replaced with complex exponentials or vice versa).

**: Computer algebra system

  • I believe Matlab has a Java API actually, not sure if it can solve this type of problem as I am not a user, but it was very popular in the Math department when I was in the University. – haskovec Apr 26 '12 at 16:58
0

Javacalculus is what you are looking for.

Good luck!

aviad
  • 8,229
  • 9
  • 50
  • 98