Integration/Antidifferentiation Program


#1

I’d like to write a program to integrate derivatives to save time on
calc homework and get extra credit in the class. I’m not completely sure
where to start.

I’m just looking for some tips from others who understand what I’m going
to do and any suggestions.

Thanks,
Matt


#2

SleepJunkie wrote:

I’d like to write a program to integrate derivatives to save time on
calc homework and get extra credit in the class. I’m not completely sure
where to start.

I’m just looking for some tips from others who understand what I’m going
to do and any suggestions.

Thanks,
Matt

Hm… you’ll probably strengthen your derivation and integration skills
more if you actually solved the problems yourself. :wink: If you really
need to have a computer work them out (such as to check your answers),
why not just use one of Mathematica, Maple, Matlab or IDL, which your
school probably has installed somewhere.

Personally, it sounds to me like too much work to write something
yourself whose answers you could be confident about.

Pistos


#3

On 4/27/06, Pistos C. removed_email_address@domain.invalid wrote:

Matt
Pistos


Posted via http://www.ruby-forum.com/.

And just to add to that a bit - doing integration with a computer is
relatively straightforward if you are talking about definate integrals
and
solving them using numerical methods. If you are trying solve them
symbollically, even integrating something as simple as x^2 is not
trivial.


#4

I can integrate and derive perfectly fine. It’s more of “I just want to
do this” then “Do my homework” program. If I do it, however, I’ll get
extra credit, which is always good.

I guess this is going to be harder than I thought. I’ll have to program
in the chain rule, quotient rule, product rule, and others…

More suggestions are welcome :slight_smile:


#5

On Apr 27, 2006, at 2:04 PM, SleepJunkie wrote:


Posted via http://www.ruby-forum.com/.

I think you’re going to have to look at the source of some other
computer algebra systems to see and how its done. This isn’t a
trivial problem, and it’s not just a matter of knowing all the rules,
especially for integrations. (Try writing a program to do integration
by parts, how is it going to decide what u and v should be for
instance?)


#6

Logan C. wrote:

I think you’re going to have to look at the source of some other
computer algebra systems to see and how its done. This isn’t a
trivial problem, and it’s not just a matter of knowing all the rules,
especially for integrations. (Try writing a program to do integration
by parts, how is it going to decide what u and v should be for
instance?)

Maxima is an open source symbolic solver/integrator, so you could start
by looking how they do it.


#7

Just for normal college/university level calc1&2, you will need
approximately 300 rules to do general integration. Derivation can be
done with only about 15rules though (though in general the rules are a
bit tougher)


#8

After hearing all of this and talking to a co-worker (programmer who has
been doing it much longer than I have), I have decided to just go with
making a program for differentiation.

I will look at the Maxima source code, thanks.
I’ll see how this goes :slight_smile:

Also, if you’re curious, I’m just doing calculus of a single-variable.


#9

Pistos C. wrote:

Hm… you’ll probably strengthen your derivation and integration skills
more if you actually solved the problems yourself. :wink: If you really

I agree. Matt didn’t say how he wants to solve them, but if he wants to
write something to solve them symbolically, rather than numerically, he
may actually learn more.

But then again, that’s not a task I’d want to take on.

–Steve


#10

Giles B. wrote:

First of all I’d like to disagree with everybody who told you you’d be
better off doing your homework. I think you’ll learn more about
integrating derivatives by automating the process than you will doing
it by hand a hundred million times.

Second, if I recall correctly, there’s example code for this in
“Higher-Order Perl,” although obviously the author of that particular
book didn’t use Ruby to do it.


Giles B.
http://www.gilesgoatboy.org

Thanks a lot for that book, I’ll have to check the book store and read
up on it or run to the library. And I agree too that I’d learn more that
way, but I’m doing great in calc now. I could, however, distribute it to
the morons in the class :wink:


#11

First of all I’d like to disagree with everybody who told you you’d be
better off doing your homework. I think you’ll learn more about
integrating derivatives by automating the process than you will doing
it by hand a hundred million times.

Second, if I recall correctly, there’s example code for this in
“Higher-Order Perl,” although obviously the author of that particular
book didn’t use Ruby to do it.


Giles B.
http://www.gilesgoatboy.org


#12

On Apr 27, 2006, at 4:29 PM, SleepJunk13 wrote:

So… I have no idea where to start.

Maybe you should figure out a format for storing polynomials, make a
class to deal with this, and then create some basic functions like
multiply or whatever you think you’ll need. or find a library to do
this.

– Elliot T.


#13

Basic symbolic differentiation is a piece of cake. It’s usually done as
an exercise in Lisp programming, but there’s no reason on earth you
can’t do it in Ruby, or for that matter, any language that supports
recursion. Hell, I’ve seen it done in Fortran! :slight_smile:

Symbolic integration is quite a bit more difficult. However, there are
quite a few open-source computer algebra packages you can learn the
algorithms from. There is absolutely no need to spend the money on
Mathematica or Maple – both quite expensive outside of a university –
just to get some integrals done. Check out Maxima and Axiom.

I think a high-school-level differentiation routine would make an
excellent Ruby quiz, now that I think of it.

SleepJunkie wrote:

I can integrate and derive perfectly fine. It’s more of “I just want to
do this” then “Do my homework” program. If I do it, however, I’ll get
extra credit, which is always good.

I guess this is going to be harder than I thought. I’ll have to program
in the chain rule, quotient rule, product rule, and others…

More suggestions are welcome :slight_smile:


M. Edward (Ed) Borasky

http://linuxcapacityplanning.com


#14

So… I have no idea where to start.

I’m starting to think even this is too big for me to do. I’ve only made
small programs before. I’d really like a place to start, or something to
help get me started. I’m going to have to be able to parse so many
different things.

Maybe I need to learn more Ruby. I’d love to do this, though.


#15

Hmmm … there’s actually a C++ library for writing computer algebra
function – it’s called “ginac”. Maybe all you need to do is write Ruby
bindings to ginac and call the ginac functions. I’m not sure what
“high-level” classes it has, like for differentiation, integration or
equation solving.

Elliot T. wrote:

– Elliot T.
http://www.curi.us/blog/


M. Edward (Ed) Borasky

http://linuxcapacityplanning.com


#16

As this is a calc student, I would assume he want to write the whole
thing.


#17

I’ve been thinking about doing something like this myself, just for
shits and giggles, and I was just wondering if it would be good to use
infinite series expressions to integrate. It seems like it would be a
more standardized way of integration (unless an ln shows up somewhere).
Perhaps once you can write something that will integrate polynomial
expressions, it would be reasonable to use infinite series like this.
However, I haven’t really taken the time to mess with it. I don’t know
how much calculus you know, either, so I don’t know if you really want
to teach yourself Taylor and Maclauren series just to do this. If
you’re really into it, though, that way seems possible.


#18

A look at Axiom or Maxima (open source) or Derive (closed source but
very inexpensive, especially to college students) will pretty much show
you what the state of the art in antidifferentiation algorithms is. The
name I remember is Risch, although there may be some others.

Justin Bangerter wrote:


M. Edward (Ed) Borasky

http://linuxcapacityplanning.com


#19

I know nada about calc, but for what it’s worth, it’s used as a
teaching exercise in the Perl book I mentioned (and is probably
adapted from the Lisp teaching exercises somebody else mentioned).

Of course it’s heavily dependent on recursion, if I recall correctly.


Giles B.
http://www.gilesgoatboy.org


#20

Hey, has anyone successfully created a program with Ruby that uses
maxima or any other “reasonably cheap” (or free) math programs?? If so,
can you point me to any resources??

http://www.ruby-forum.com/topic/177704#new