Wanted: A calculator that can handle really big integers and fractions

Click For Summary

Discussion Overview

The discussion revolves around the search for calculators capable of handling very large integers and fractions, particularly in the context of evaluating infinite series and algebraic expressions. Participants explore various tools and programming languages that might meet these needs.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant is seeking a calculator for complex algebraic expressions involving large fractions, specifically for the series \sum_{n=1}^{\infty}\frac{1}{n^{2s+1}}.
  • Another suggests using arbitrary precision online calculators, providing an example of a calculation that yields a fraction.
  • Python is proposed as a solution, highlighting its built-in support for big integers and fractions.
  • Concerns are raised about the limitations of mpir.org, with a participant questioning whether it truly supports arbitrary size integers.
  • A participant cites Wolfram Alpha as a useful online calculator, sharing a specific result from it.
  • There is a discussion about the capabilities of mpir and GMP, with participants examining header files to clarify their functionality regarding large integers.
  • One participant mentions using Sieclator, an arithmetic calculator, for occasional interactive use, and shares links to additional resources.

Areas of Agreement / Disagreement

Participants express differing views on the capabilities of mpir and GMP, with some asserting that they support arbitrary size integers while others remain uncertain. There is no consensus on the best tool or approach for handling large integers and fractions.

Contextual Notes

Some participants express uncertainty about the specific capabilities of various tools and libraries, particularly regarding their handling of large numbers and fractions. There are references to specific programming constructs and data structures that may not be fully understood by all participants.

Who May Find This Useful

This discussion may be useful for individuals interested in computational mathematics, programming with large numbers, or those seeking tools for advanced arithmetic operations in scientific contexts.

Svein
Science Advisor
Insights Author
Messages
2,316
Reaction score
813
TL;DR
I need a calculator that can handle fractions with really large denominators
I am trying to get one step further with my search for \sum_{n=1}^{\infty}\frac{1}{n^{2s+1}}. Part of the way is to calculate some algebraic expressions containing fractions with really huge numbers (as in (\frac{1}{5^{9}}+\frac{1}{7^{9}}-\frac{1}{17^{9}}-\frac{1}{19^{9}})\div (\frac{2}{6^{9}}-\frac{2}{18^{9}})). Does anybody know of such a calculator or do I have to write it myself?

Yes, I know about mpir.org, but they are based on 64-bit numbers which is too small for me (since 5, 7, 17 and 19 are all prime numbers, adding the fractions will end up in a really huge denominator).
 
Computer science news on Phys.org
Perhaps one of the arbitrary precision online calculators will do?

Example from my first search hit (notice result is a fraction):
[CODE title="https://apfloat.appspot.com/"](1/(5^9)+1/(7^9)-1/(17^9)-1/(19^9))/(2/(6^9)-2/(18^9))
80281486442205051414723549292278888963072/29680713166750710362839900905033947265625[/CODE]
 
  • Like
Likes   Reactions: davenn
Why not use python? Big integers are baked in.

As an example:

Python:
$ python

>>> 2**500
3273390607896141870013189696827599152216642046043064789483291368096133796404674554883270092325904157150886684127560071009217256545885393053328527589376L

>>> 2**5000
141246703213942603683520966701614733366889617518454111681368808585711816984270751255808912631671152637335603208431366082764203838069979338335971185726639923431051777851865399011877999645131707069373498212631323752553111215372844035950900535954860733418453405575566736801565587405464699640499050849699472357900905617571376618228216434213181520991556677126498651782204174061830939239176861341383294018240225838692725596147005144243281075275629495339093813198966735633606329691023842454125835888656873133981287240980008838073668221804264432910894030789020219440578198488267339768238872279902157420307247570510423845868872596735891805818727796435753018518086641356012851302546726823009250218328018251907340245449863183265637987862198511046362985461949587281119139907228004385942880953958816554567625296086916885774828934449941362416588675326940332561103664556982622206834474219811081872404929503481991376740379825998791411879802717583885498575115299471743469241117070230398103378615232793710290992656444842895511830355733152020804157920090041811951880456705515468349446182731742327685989277607620709525878318766488368348965015474997864119765441433356928012344111765735336393557879214937004347568208665958717764059293592887514292843557047089164876483116615691886203812997555690171892169733755224469032475078797830901321579940127337210694377283439922280274060798234786740434893458120198341101033812506720046609891160700284002100980452964039788704335302619337597862052192280371481132164147186514169090917191909376L

>>> 2**50000  // is left to the OP to try out.
...
 
  • Like
  • Wow
Likes   Reactions: jim mcnamara and FactChecker
Svein said:
Yes, I know about mpir.org, but they are based on 64-bit numbers.
Is that true? mpir is based on GMP and that caters for arbitrary size integer (numerator, denominator) pairs.

If you just want an online calculator then Wolfram Alpha is the obvious first stop - the answer is apparently $$ \frac{80,281,486,442,205,051,414,723,549,292,278,888,963,072}{29,680,713,166,750,710,362,839,900,905,033,947,265,625} $$
if I copied it correctly.

For many other online calculators and libraries in your favourite language (most of which link in GMP), search for "arbitrary precision rational arithmetic" (or just e.g. "rational arithmetic python").

jedishrfu said:
Why not use python? Big integers are baked in.
Well Big Integers are not very helpful here, but fortunately Python also has Fractions baked in :biggrin:
 
pbuk said:
Is that true? mpir is based on GMP and that caters for arbitrary size integer (numerator, denominator) pairs.
You may well be right, I just scanned through a couple of the header files and only found paragraphs dealing with long and long long.
 
Svein said:
You may well be right, I just scanned through a couple of the header files and only found paragraphs dealing with long and long long.
You didn't see this?
C:
typedef struct
{
  int _mp_alloc;        /* Number of *limbs* allocated and pointed
                   to by the _mp_d field.  */
  int _mp_size;            /* abs(_mp_size) is the number of limbs the
                   last field points to.  If _mp_size is
                   negative this is a negative number.  */
  mp_limb_t *_mp_d;        /* Pointer to the limbs.  */
} __mpz_struct;
The data will be in dynamically allocated memory pointed to by mp_d
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
760
  • · Replies 24 ·
Replies
24
Views
3K
Replies
9
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K