This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
allemensen


Newbie


Joined: 21 Jul 2009
Posts: 20

Posted: 08 Apr 2010 12:13:11 pm    Post subject:

I created a symbolic program for calculating the derivative of an equation.

I'd like to know what you think about it, and possibly new features or bugs.
I think the most common operators are supported, with the exception of the "x-th power root of y"

If you have any questions about its structure, ask away!
Back to top
thornahawk
μολών λαβέ


Active Member


Joined: 27 Mar 2005
Posts: 569

Posted: 09 Apr 2010 06:53:04 am    Post subject:

I'm still reviewing your code (that's a rather long and recursive beastie you have there Smile ), though I'm wondering what you meant by not handling the power/root operators correctly; just treat x^y as e^(y*ln(x)) (with the implicit question of whether your routine can handle this composition).

Still, this looks good, thanks for posting.

thornahawk

P.S. You might want to add support for the hyperbolic functions at some point...
Back to top
allemensen


Newbie


Joined: 21 Jul 2009
Posts: 20

Posted: 09 Apr 2010 07:20:41 am    Post subject:

x^y is handled correctly, but I haven't implemented the root version (x-root y, equal to y^(1/x))

How do you differentiate hyperbolic functions (and what are they?). I've never come across them.

The previous version does have some bugs, and only accepts whole numbers, not fractions. I fixed those.
The program basically has three parts:
- string parsing, turning it into a list with operations and tokens
- differentiating the function into another list
- displaying the list

Do you have any suggestions how to speed up the code?

EDIT: found the hyperbolic functions. Their derivates are equal to cos and sin, so if you don't use both at the same time you should be fine. I might add them, as soon as I feel like doing so.
Where can they be found in the calculator, besides the catalog?


Last edited by Guest on 09 Apr 2010 08:00:27 am; edited 1 time in total
Back to top
bwang


Member


Joined: 15 Mar 2009
Posts: 128

Posted: 15 Apr 2010 09:54:05 pm    Post subject:

Hyperbolic functions don't differentiate into cos and sin; they differentiate into cosh and sinh.
They are only available in the catalog.

I don't have access to an 83/84 right now, so I can't test this. How fast is it?

What method does it use to parse expressions? Does it use a stack?
Back to top
allemensen


Newbie


Joined: 21 Jul 2009
Posts: 20

Posted: 16 Apr 2010 01:27:51 am    Post subject:

That's what I meant. cosh and sinh differentiate similarly as cos and sin. The only difference is the 'h', if you'd write it down.

It is really slow. For a complex function it will take over 10 seconds.

It parses expressions by running over a substring of the input. It evaluates the lowest priority operator and then parses the two/one/zero parts left.
It uses a stack (a list) to keep track of information such as where to split.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement