View previous topic :: View next topic 
Author 
Message 
ManDay Apprentice
Joined: 22 Jan 2008 Posts: 226

Posted: Wed Feb 27, 2013 8:32 pm Post subject: An improved dc? 


Does anyone know a dclike (RPN) calculator which supports things like exponential notation, uses readline for input or is in any other way better than dc?
Edit: Exponentation with a fraction should also be possible. _________________ ⇨ PDF for documents is misused. Use HTML!
¶ Math markup for HTML5
¶ GCPM for Footnotes 

Back to top 


Bones McCracker Veteran
Joined: 14 Mar 2006 Posts: 1579 Location: U.S.A.

Posted: Thu Feb 28, 2013 4:46 am Post subject: 


Look at
bc
Orpie _________________ 'Hell, how many times I'd open a file and think "WTF who wrote this" only to discover it was me.'  Stribor 

Back to top 


Sir Link Apprentice
Joined: 02 Feb 2008 Posts: 151 Location: /dev/chair

Posted: Thu Feb 28, 2013 7:34 am Post subject: 


"qalc", which comes with scilibs/libqalculate, does that and much more (run as qalc set "rpn_syntax on" to start in RPN mode). It also has an optional GTK interface (scicalculators/qalculategtk). _________________ PUSH BUTTON, RECEIVE BAILOUT 

Back to top 


ManDay Apprentice
Joined: 22 Jan 2008 Posts: 226

Posted: Thu Feb 28, 2013 6:53 pm Post subject: 


Orpie looks promising.
The others not so much (certainly not bc, which doesn't even support RPN) _________________ ⇨ PDF for documents is misused. Use HTML!
¶ Math markup for HTML5
¶ GCPM for Footnotes 

Back to top 


Bones McCracker Veteran
Joined: 14 Mar 2006 Posts: 1579 Location: U.S.A.

Posted: Thu Feb 28, 2013 9:31 pm Post subject: 


RPN is hard to give up once you get used to it. _________________ 'Hell, how many times I'd open a file and think "WTF who wrote this" only to discover it was me.'  Stribor 

Back to top 


Akkara Administrator
Joined: 28 Mar 2006 Posts: 5710 Location: &akkara

Posted: Thu Feb 28, 2013 10:23 pm Post subject: 


Sir Link wrote:  "qalc", which comes with scilibs/libqalculate, does that and much more (run as qalc set "rpn_syntax on" to start in RPN mode). It also has an optional GTK interface (scicalculators/qalculategtk). 
Thanks for the pointer.
I went to try it (the commandline version). Ran into some issues, but it's probably just me not knowing how to use it yet.
Typing 2^32 gives approx. 4.2949673E9
I was expecting the exact full integer.
I tried various options and eventually found the configuration file ~/.qalculate/qalc.cfg.
Changed the default precision=8 to something more reasonable. (Wonder why it defaults to such a low value for a arbitraryprecision calculator.) Eventually settled on precision=65000 so there's no further surprises here. But that still doesn't carry my intent, which is, "use as much precision as needed, up to all of available memory if necessary, when the result is an exact integer"
The next problem came up with round(1000*sqrt(2)). Which it dutifully reports back as being equal to round(1000*sqrt(2)). Gee, thanks. Again, there's an exact, unambiguous answer here. I'd have expected to receive the integer result. I understand (and appreciate) leaving an expression such as sqrt(2) unevaluated since any evaluation necessarily loses precision. But there's no such issues with round(1000*sqrt(2)), or, indeed round(any_expression)
Anyway, just thought I'd try a different tool, but ran into these problems.
Edit: Tried round(1000*sqrt(2)) after removing and recreating ~/.qalculate, in case I had inadvertently messed something up while trying the options.
Now it comes up as round(1000 * sqrt(2)) = approx. 1414
Which is a good start. But it isn't approx.. It is exactly that. And same issue applies with the precision. Integers shouldn't need any qualifications, there's no question as to the quantity.
Edit#2: bumped precision up to 12 million. Now it's taking a *very* long time. Apparently it's working out all 12 million places of sqrt(2), before dropping 11999997 of them. Guess this isn't usable for my needs. Thanks for the pointer anyway! _________________ "Full sentences are harder to write. They have verbs."  Jeff Bezos, in a Fortune profile
Last edited by Akkara on Thu Feb 28, 2013 10:32 pm; edited 1 time in total 

Back to top 


Bones McCracker Veteran
Joined: 14 Mar 2006 Posts: 1579 Location: U.S.A.

Posted: Thu Feb 28, 2013 10:29 pm Post subject: 


What do you use now? _________________ 'Hell, how many times I'd open a file and think "WTF who wrote this" only to discover it was me.'  Stribor 

Back to top 


Akkara Administrator
Joined: 28 Mar 2006 Posts: 5710 Location: &akkara

Posted: Thu Feb 28, 2013 10:37 pm Post subject: 


BoneKracker wrote:  What do you use now? 
Depends. For simple stuff (no sqrt etc), expr (built with with USE=gmp on coreutils). bc and dc for more complicated things. Sometimes write a loop or two in python. And Mathematica when the going gets rough. So I'm not hurting for tools. Just like to keep things FOSS when I can and it's good to learn of new options. _________________ "Full sentences are harder to write. They have verbs."  Jeff Bezos, in a Fortune profile 

Back to top 


Bones McCracker Veteran
Joined: 14 Mar 2006 Posts: 1579 Location: U.S.A.

Posted: Thu Feb 28, 2013 11:04 pm Post subject: 


What do you use for interactive use, when you just need to do some quick calculations? _________________ 'Hell, how many times I'd open a file and think "WTF who wrote this" only to discover it was me.'  Stribor 

Back to top 


Akkara Administrator
Joined: 28 Mar 2006 Posts: 5710 Location: &akkara

Posted: Thu Feb 28, 2013 11:22 pm Post subject: 


BoneKracker wrote:  What do you use for interactive use, when you just need to do some quick calculations? 
I hardly ever find the need to do calculations interactively. If I'm doing math interactively, it's probably because I need to solve some sort of minimization problem or deriving symbolic results for the output of some process. So for that, it's Mathematica. If I just need to add or multiply a few numbers, expr on the command line is quick and easy. _________________ "Full sentences are harder to write. They have verbs."  Jeff Bezos, in a Fortune profile 

Back to top 


ManDay Apprentice
Joined: 22 Jan 2008 Posts: 226

Posted: Fri Mar 01, 2013 1:26 pm Post subject: 


Akkara wrote:  BoneKracker wrote:  What do you use for interactive use, when you just need to do some quick calculations? 
I hardly ever find the need to do calculations interactively. If I'm doing math interactively, it's probably because I need to solve some sort of minimization problem or deriving symbolic results for the output of some process. So for that, it's Mathematica. If I just need to add or multiply a few numbers, expr on the command line is quick and easy. 
You're probably already aware of that, but Sage (you can run the interactive notebook online on sagemath.org) is a pretty solid and powerful package  I do all my symbolic stuff (apart from tensor calculus, for which you have to resort to pure sympy) with Sage and it works like a charm (internally uses maxima iirc). Getting a bit off topic here...
Have you tried Orpie by now?
If you care for HP, there are a couple of ARMemulators out there on which you can run the HP's firmware:
http://developer.berlios.de/projects/x48/ _________________ ⇨ PDF for documents is misused. Use HTML!
¶ Math markup for HTML5
¶ GCPM for Footnotes 

Back to top 


