I must chime in that these are some really excellent diagrams and explanations; I should point people who are trying to understand parse trees to this topic.
SirCmpwn wrote:
You should show your work Smile


Stepping through tree manipulations is showing work. For example, it is possible to have gCAS show its work on expanding (x+2)^50... It doesn't use any theorems (as I learned), but instead does it the lame way of (x+2)(x+2)(x+2)(x+2).... which is fine as the very basic distributing alg.s take up less space then adding a new functions for limited cases.

@KermMartian

Sure, if anyone wants to make trees or share pointers, this would be a good place. Although I should make a separate topic for CAS node trees in general (as this was supposed to be just a project-status thread XD).

<sidenote> Still working on gCAS2. Anyone will be able to use it in any C/C++ project for ti84/PC by linking with the library. (People needing to do math in games or programs could use a simple function like float gcas_ezcalc(char*) to evaluate a math problem)
That's excellent that you're working on gCAS2, and that you will be exposing that powerful of a parser! And yes, definitely make a CAS node tree thread; that would be a good resource to have.
string parser works. No alpha support (variables/functions)
AHelper wrote:
string parser works. No alpha support (variables/functions)
Alpha as in any alphabetic characters? So any math expression consisting of numbers and operators works nicely now?
Just parsing the string into a template of nodes. A function (writing) will assemble these nodes into the lovely thing called a tree XD Such a silly process...

And yes, alpha, specifically isalpha(, isn't used. Variable parsing will be moved in my source from a separate step to be incorporated into the parsing step.

(Basic CAS layout)

  • Parse your string into a linear format
  • Assemble the linear nodes into a tree
  • Evaluate the tree
gCAS2 is at alpha. It is working well right now. I will be able to easily write alg. functions for it. Currently, it has addsub and multdiv alg.s. I hope to add in alg_fact, alg_power, alg_expand, and alg_solve_linear soon. It runs on a PC right now, but I will make a huge GUI for it on the calc.

If anyone wants, I have a php page and gCAS2 ready to go for you to calculate things on a web server Smile sf.net doesn't let me run programs from php

<edit>
This is a list of algorithms that have been put into gCAS2:

  • gcas_alg_addsub
  • gcas_alg_multdiv
  • gcas_alg_power
  • gcas_alg_power_simp
  • gcas_alg_fact


Factorial running with debugging:
Code:
>>(5!)/((5-3)!*3!)
D: ((5.000000!)/(((5.000000-3.000000)!)*(3.000000!)))
D: (120.000000/(((5.000000-3.000000)!)*(3.000000!)))
D: (120.000000/((2.000000!)*(3.000000!)))
D: (120.000000/(2.000000*(3.000000!)))
D: (120.000000/(2.000000*6.000000))
D: (120.000000/12.000000)
D: 10.000000
>10.000000

(D: are debugging lines for each math step, aka showing work)

<edit>

Fixing bugs all over, it's becoming more stable, but still has no error checking
gCAS2 frontend and library work. I will try to add in a full GUI for gCAS2 so text input will be much better.

(Right now, it prints out the entire tree, but because there is no LCD scrolling, it just spams the screen with a tree dump XD) (at the end, it gives you an answer) (no functions or variables implemented just yet)
Late reply: It looks great! Good luck with this. Guess math is somewhat useful on a calculator Razz
gCAS2 is getting a gui similar to the ti89. I already have a working list widget, and everything fits. No screenshots due to a size glitch in the main glasslib library... just imagine the ti89's homescreen, but with the input box at the top of the screen. silly sprintf Razz
AHelper wrote:
gCAS2 is getting a gui similar to the ti89. I already have a working list widget, and everything fits. No screenshots due to a size glitch in the main glasslib library... just imagine the ti89's homescreen, but with the input box at the top of the screen. silly sprintf Razz
Camera / cameraphone screenshots, then? Smile Err, why the input box at the top of the screen? That feels a bit upside-down to me, considering how Matlab, Maple, etc scroll with the input box moving down towards the bottom, the 89 series having it at the bottom, and the 83+ series following the Matlab/Maple/command-line/shell convention. You're the designer, though; I'm sure you've evaluated all the options. Smile
:-/ Other ti os's and pc inputs scroll up, so why not have a third-party calc. scroll down?

When you see a screenshot, it should make sence... Also, I plan to have the scrolling portion also act as a quick math function menu (as opposed to a drop-down menu)

<edit>

Note that my writing abilities on a pocket pc suck. (windows mobile 2003 using IE, not Opera)
When you type repeated lines, does it scroll the way the TI-OS's EOS scrolls? Or the opposite? Do the newest lines stay at the top or are they all the way at the bottom?
Why don't I show you...... with an animation!

The first time I run it, it DOES show some still-existing parsing errors (periods at the end are killing right now, not so much negatives anymore). I quit then start it again. the 'o' command lists used RAM (includes header and reserved space). It isn't optimized, as it put in the whole 50 byte string. I still am fighting to find an odd RAM issue, but that isn't too important right now... At the end, I hit [MODE] to go to scroll-mode. Usual keys for movement. Hitting enter in the list will, in the future, copy the text in that row at the cursor location in the text box.

Again, sorry for the 2 screens and for me failing to type on an emulator whose key mapping doesn't work well...
I'm very concerned that it thinks 3^4 is 80.999961 instead of 81. Smile That's why TI uses binary-coded decimal (BCD) instead of binary-coded binary, because of the annoying representational roundoff error. I now see what you mean about the scrolling, and I guess that seems to work fairly well, even though it's the reverse of most normal console/terminals with which I am accustomed. I notice you punt on the variable-width small font issue by making your small font fixed-width, and now that I'm saying that, I feel like I have said that before. Smile
Correction, large font is fixed width. Small font is not.
AHelper wrote:
Correction, large font is fixed width. Small font is not.
You have many fewer exceptions, though; it looks like the ( and ) are four pixels including 2 blank columns, for example?
There are only 4 small font characters that are extended in length. The large font is the same widh. Now, those are the characters. The spaces are smaller just so it doesn't look silly...

Yes, the text draws slowly because nothing is buffered - the LCD is just read, masked, and overwritten... most times twice per character. I intended for no buffer as buffered drawing will be done as an external library

Oh, and to address your concern for the precision? I started porting GMP to GlassOS
Wow, looking pretty good! I'd recommend switching back to small font, though, since you can fit more on the screen, and I'd request that you separate answers and expressions on different sides of the screen.
SirCmpwn wrote:
Wow, looking pretty good! I'd recommend switching back to small font, though, since you can fit more on the screen, and I'd request that you separate answers and expressions on different sides of the screen.
I agree on both of those points, especially the second. Having expressions and answers in a single aligned column is quite counter-intuitive to me.
  
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
» Goto page Previous  1, 2, 3, 4, 5 ... 10, 11, 12  Next
» View previous topic :: View next topic  
Page 4 of 12
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement