Results 1 to 10 of 10
  1.    #1  
    (TouchPad only)

    Web Calculator

    After having misplaced my TI-89 I was in need of a scientific calculator that could parse/evaluate expressions rather than simple stack-based ones (e.g., solar-powered ones) and I wanted simple graphing capabilities.

    I wasn't able to find anything in the app-store or preware that looked like what I wanted so I made my own and I hope that others will find it as useful as I do.

    I'm a C# developer by day and this is my first venture into webOS/Enyo development so I'm sure there will be bugs. If you're patient with me and let me know of any issues you find I promise I'll do my best (as my time allows) to fix them as well as slowly add new functionality.

    Expression evaluator

    The expression evaluation part of the calculator should be easy enough to figure out; you give it an expression an it'll evaluate it if possible. Some examples include:
    3+4*2 -> 11 (notice that order of operations are observed)
    4! -> 24
    2^3 -> 8
    sqrt(4) -> 2

    Note that I also define 2 constants, e and pi that evaluate to exactly what you think they should. The rest of the evaluator should be easy enough to pick up with the exception of the sum() function: I wanted a way to compute summations so the arguments to this function seem a little odd at first. As an example, consider one of the many methods of approximating the natural constant e: the sum of the quantity one divided by x factorial, with x from zero to (some upper bound.) This could be entered like:
    sum(1/x!,x,0,10)
    and will yield 2.7182818011463845
    Note that the variable x in this case is arbitrary. I could do the same thing with the variable taco:
    sum(1/taco!,taco,0,10)

    Graphing

    Switching into the graphing mode via the button up top will show an empty graph. Simply enter any function with x as the independent variable and hit the equals sign to see the graph. Simple as that. When many graphing calculators draw a function with a vertical asymptote such as 1/x or tan(x) they will accidentally draw a vertical line where the graph really shouldn't have one. I've made what I think to be a pretty good effort at avoiding these anomalies.

    Conclusion

    I'm releasing this for free and it will always be free, so feel free to use and distribute this as you like. I've attached some screenshots and the app is in the preware feeds.

    Enjoy!
    -Brett

    Change log
    1.0.0 - Initial release.
    1.0.1 - (1) Fixed number parsing bug. Leading zeroes no longer required for decimal numbers. E.g., ".5" now parses correctly where before "0.5" was required. (2) Improved reporting of parse errors in history view.
    1.1.0 - (1) Added support for entering numbers in scientific notation, e.g., 2E15. (2) Added ans() function to reference past results. This doubles as a sort of memory. (3) Added degree/radian selector for trigonometric functions.
    1.1.1 - Enabled tapping on an item in the history list to have the appropriate 'ans(X)' value added to the input line.
    Attached Images Attached Images
    Last edited by brettfo; 08/24/2012 at 12:52 AM. Reason: New release
  2. MikeN68's Avatar
    Posts
    332 Posts
    Global Posts
    333 Global Posts
    #2  
    brettfo - nice to see you making the jump to webOS. I wish I had a use for the calculator, but I'm just a simple guy without the brain cells to (or job) for this app.
  3. Semma2's Avatar
    Posts
    292 Posts
    Global Posts
    293 Global Posts
    #3  
    Not bad, easy to use, but a little incomplete as a scientific calculator.

    - How do you enter a number in exponential notation, e.g., 2e15 ?
    - No memory?
    - No deg/rad selection?
  4.    #4  
    Quote Originally Posted by Semma2 View Post
    Not bad, easy to use, but a little incomplete as a scientific calculator.

    - How do you enter a number in exponential notation, e.g., 2e15 ?
    - No memory?
    - No deg/rad selection?
    Semma2, thanks for the feedback! I updated it with your suggestions but with a slight tweak to memory; there is a new function, ans(), that references past results, e.g., ans(1) is the most recent result, ans(2) the second most recent, etc. I also updated the input so that if the first thing you type is an operator the text "ans(1)" will be inserted appropriately. This means you can execute "2+2" to get "4" in the output pane, then immediately type "*3" and the input line will now say "ans(1)*3" and the expression will evaluate to "12". This should enable quick streaming of expressions. The only operator I didn't do this to is "-" because it also doubles as the negation operator and when you type it at the head of a line I have no way of knowing if you want "ans(1)-" or if you simply want to type a negative number like "-3+4".
  5. Semma2's Avatar
    Posts
    292 Posts
    Global Posts
    293 Global Posts
    #5  
    I tried the new version, and the enhancements are much appreciated, thanks brettfo.

    It's easy to enter ans(1), but I don't see any way to access previous answers other than using backspace to erase the 1 and substitute a higher number. That works, but it seems a bit awkward. It's also a bit awkward having to count backwards since the answers aren't numbered. This scheme is certainly more flexible than a traditional simple Mem, but a bit more complicated to use.
  6.    #6  
    Quote Originally Posted by Semma2 View Post
    I tried the new version, and the enhancements are much appreciated, thanks brettfo.

    It's easy to enter ans(1), but I don't see any way to access previous answers other than using backspace to erase the 1 and substitute a higher number. That works, but it seems a bit awkward. It's also a bit awkward having to count backwards since the answers aren't numbered. This scheme is certainly more flexible than a traditional simple Mem, but a bit more complicated to use.
    Semma2, thanks for using my app and thanks for all the good feedback! (I think you're the only one using it besides me :/)

    I agree that manually counting back for the proper 'ans(X)' value is annoying so I made it so that you can click on a history item to get the appropriate 'ans(X)' inserted automatically. I just submitted v1.1.1 to the preware feed so you should see an update shortly.
  7. Semma2's Avatar
    Posts
    292 Posts
    Global Posts
    293 Global Posts
    #7  
    Quote Originally Posted by brettfo View Post
    I made it so that you can click on a history item to get the appropriate 'ans(X)' inserted automatically.
    Excellent! That's exactly what I tried to do when I was experimenting with it.
  8. Semma2's Avatar
    Posts
    292 Posts
    Global Posts
    293 Global Posts
    #8  
    Are you going to post that last update brettfo?
  9.    #9  
    Quote Originally Posted by Semma2 View Post
    Are you going to post that last update brettfo?
    The v1.1.1 update (which allows tapping on a history item) was submitted on 8/24 to the precentral feed. I just checked my copy of PreWare and I'm seeing v1.1.1. Are you still seeing v1.1.0?
  10. Semma2's Avatar
    Posts
    292 Posts
    Global Posts
    293 Global Posts
    #10  
    I was getting it from the App library here on webOS Nation. I didn't think to check PreWare.

Tags for this Thread

Posting Permissions