Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
An improved dc?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Off the Wall
View previous topic :: View next topic  
Author Message
ManDay
Apprentice
Apprentice


Joined: 22 Jan 2008
Posts: 209

PostPosted: Wed Feb 27, 2013 8:32 pm    Post subject: An improved dc? Reply with quote

Does anyone know a dc-like (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
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1564
Location: U.S.A.

PostPosted: Thu Feb 28, 2013 4:46 am    Post subject: Reply with quote

Look at
bc
Orpie
_________________
juniper wrote:
I use ubuntu, which is why I am posting here.
Back to top
View user's profile Send private message
Sir Link
Tux's lil' helper
Tux's lil' helper


Joined: 02 Feb 2008
Posts: 146
Location: /dev/chair

PostPosted: Thu Feb 28, 2013 7:34 am    Post subject: Reply with quote

"qalc", which comes with sci-libs/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 (sci-calculators/qalculate-gtk).
_________________
PUSH BUTTON, RECEIVE BAILOUT
Back to top
View user's profile Send private message
ManDay
Apprentice
Apprentice


Joined: 22 Jan 2008
Posts: 209

PostPosted: Thu Feb 28, 2013 6:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1564
Location: U.S.A.

PostPosted: Thu Feb 28, 2013 9:31 pm    Post subject: Reply with quote

RPN is hard to give up once you get used to it.
_________________
juniper wrote:
I use ubuntu, which is why I am posting here.
Back to top
View user's profile Send private message
Akkara
Administrator
Administrator


Joined: 28 Mar 2006
Posts: 5174
Location: &akkara

PostPosted: Thu Feb 28, 2013 10:23 pm    Post subject: Reply with quote

Sir Link wrote:
"qalc", which comes with sci-libs/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 (sci-calculators/qalculate-gtk).

Thanks for the pointer.

I went to try it (the command-line 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 arbitrary-precision 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 re-creating ~/.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!
_________________
echo 'long long long x;' | gcc -x c -c -


Last edited by Akkara on Thu Feb 28, 2013 10:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1564
Location: U.S.A.

PostPosted: Thu Feb 28, 2013 10:29 pm    Post subject: Reply with quote

What do you use now?
_________________
juniper wrote:
I use ubuntu, which is why I am posting here.
Back to top
View user's profile Send private message
Akkara
Administrator
Administrator


Joined: 28 Mar 2006
Posts: 5174
Location: &akkara

PostPosted: Thu Feb 28, 2013 10:37 pm    Post subject: Reply with quote

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.
_________________
echo 'long long long x;' | gcc -x c -c -
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1564
Location: U.S.A.

PostPosted: Thu Feb 28, 2013 11:04 pm    Post subject: Reply with quote

What do you use for interactive use, when you just need to do some quick calculations?
_________________
juniper wrote:
I use ubuntu, which is why I am posting here.
Back to top
View user's profile Send private message
Akkara
Administrator
Administrator


Joined: 28 Mar 2006
Posts: 5174
Location: &akkara

PostPosted: Thu Feb 28, 2013 11:22 pm    Post subject: Reply with quote

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.
_________________
echo 'long long long x;' | gcc -x c -c -
Back to top
View user's profile Send private message
ManDay
Apprentice
Apprentice


Joined: 22 Jan 2008
Posts: 209

PostPosted: Fri Mar 01, 2013 1:26 pm    Post subject: Reply with quote

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 ARM-emulators 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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Off the Wall All times are GMT
Page 1 of 1

 
Jump to:  
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