- #1

ranger

Gold Member

- 1,680

- 1

Language = C or C++. Java would be fine also.

--thank you

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter ranger
- Start date

- #1

ranger

Gold Member

- 1,680

- 1

Language = C or C++. Java would be fine also.

--thank you

- #2

HallsofIvy

Science Advisor

Homework Helper

- 41,847

- 966

It's not clear what you mean. Do you mean a numerical differentiation?

- #3

ranger

Gold Member

- 1,680

- 1

i mean that given a function f, find f`. Example

f = x^3 + 3x + 4

f`= 3x^2 + 3

No need to find the numerical value.

f = x^3 + 3x + 4

f`= 3x^2 + 3

No need to find the numerical value.

Last edited:

- #4

lurflurf

Homework Helper

- 2,440

- 138

That would be easy to code as differentiation is very systematic. The problem would be typesetting and simplification. Without nice (hard to write) simplification and type setting the results would be very ugly. You would just need a few rules and use them in combination.ranger said:

Language = C or C++. Java would be fine also.

--thank you

(u*v)'=u'*v+u*v'

(u+v)'=u'+v'

(u^v)'=v*u^(v-1)*u'+u^v*log(u)*v'

(f(g))'=f'(g)g'

exp'(x)=exp(x)

log'(x)=1/x

sin'(x)=cos(x)

cos'(x)=-sin(x)

and so on

- #5

ranger

Gold Member

- 1,680

- 1

lurflurf said:That would be easy to code as differentiation is very systematic. The problem would be typesetting and simplification. Without nice (hard to write) simplification and type setting the results would be very ugly. You would just need a few rules and use them in combination.

(u*v)'=u'*v+u*v'

(u+v)'=u'+v'

(u^v)'=v*u^(v-1)*u'+u^v*log(u)*v'

(f(g))'=f'(g)g'

exp'(x)=exp(x)

log'(x)=1/x

sin'(x)=cos(x)

cos'(x)=-sin(x)

and so on

That is how the rules would be coded? So for example the C programming language has built in fuctions for dealing with differentiation?

- #6

lurflurf

Homework Helper

- 2,440

- 138

no no. You would need to have some text parsing. What exactly are your goals with this project? The text parsing could be quite tedeous.ranger said:That is how the rules would be coded? So for example the C programming language has built in fuctions for dealing with differentiation?

here are some sloppy ideas

Say your functions are

sin()

cos()

exp()

log()

+(,)

-(,)

*(,)

/(,)

^()()

-()

first you would have your parser check that the function was valid

then it could count the x's, then use differentiate with respect one x at a time and add the results. It would then start at the proper x and work backward until finished

say you

what makes this hard is

-checking the input function is valid

-allowing freedon in keying imput function

-reduceing the answer so it does not look silly ie

f=x*x*x

f'=x*x+x*x+x*x

-allowing many functions

-making the results pretty

- #7

ranger

Gold Member

- 1,680

- 1

.then it could count the x's, then use differentiate with respect one x at a time and add the results

How would that code look like(for the differentiation section)?

It would be damn ugly to look at x*x*x*x + x*x

- #8

lurflurf

Homework Helper

- 2,440

- 138

used lisp

http://mitpress.mit.edu/sicp/full-text/sicp/book/node39.html

somewhere a class called CS 381K had this as homework (uses lisp)

http://www.cs.utexas.edu/users/novak/asg-symdif.html

paper about coding this in c++

http://www.usenix.org/publications/library/proceedings/coots98/full_papers/gil/gil_html/gil.html

more lisp

http://www.cs.sfu.ca/~cameron/Teaching/384/971/Lectures/deriv.html

- #9

ranger

Gold Member

- 1,680

- 1

- #10

- 1,356

- 2

implicit differentiation? MAPLE

- #11

ranger

Gold Member

- 1,680

- 1

- #12

lurflurf

Homework Helper

- 2,440

- 138

For what purpose? I can think of a few.ranger said:

(1) understand differentiation better yourself

(2) to contrast how a computer program performs differentiatio with how a human does

(3) to see how actual step that are simple for a human are implemented

(1) is not likely, as you would need to follow individual steps out. Some steps would be ugly, possibly all steps without a good simplification process, if you did have good simplification it could make things more confusing.

(2) unlike integration, computers do symbolic differentiation much more like a human would. There are simple rules that can be followed in a deterministic fashion. The simplification, acceptable input check, and answer formating are where all the action it.

(3) is the area that could be most productive. It would also be very tedious. The process goes

-develop unambigues notation for input and output

-develop code for programe to deal with functions

-develope method for ensuring that imput and output are in proper form

-define rules by which valid imput is systematically reduced

-implement simplification to above step lest answer looks yucky

-implement typeset for answer lest looks yucky

All that is of some interest, but the details are very tedeous.

- #13

- 970

- 3

I located this simple java calculator, function page and source code included.

just type in diff(x^3 + 3*x + 4) and press '=' key.

Reference:

http://javaboutique.internet.com/Calc/

- #14

- 1,356

- 2

- #15

ranger

Gold Member

- 1,680

- 1

neurocomp2003, thanks for telling that maple has its source available.

http://www.math.utah.edu/lab/ms/maple/src/

You're saying that maple isnt a CAS (or doesnt have CAS capabilities)? Well in that case I've been lied to all my life.

- #16

- 1,356

- 2

Unless your talking about symbolic programming?

- #17

ranger

Gold Member

- 1,680

- 1

I'm sure that maple supports this capability.

Share: