Ask Your Question

Solving Quartic Equation with a Coefficient of $1$ MB Space

asked 2020-03-19 08:54:00 -0500

I have an equation of $4$ degree (Quartic equation)and a coefficient of this equation takes $1$ megabyte space in a text file. I want to solve this Quartic equation using computer. If the the equation has rational solution, I want to get rational solution with the exact numerator and the exact denominator (not the approximation). Is it possible?

There are are programming languages (e.g. MAGMA), computer algebra systems (e.g. PARI/GP, SageMath etc, here PARI is C library, can be called from a high-level language application ,for instance, written in C, C++, Pascal, Fortran, Perl, or Python).

If possible, then which programming language or computer algebra systems or library or softaware will be best to solve the Quartic equation as described above? What are the additional issues (configurations of RAM, Processor)?

edit retag flag offensive close merge delete



Upload the text file somewhere (a pastebin?). Also consider the rational root theorem.

rburing gravatar imagerburing ( 2020-03-24 17:09:10 -0500 )edit

If the file a.txt contains just the string 123456, then you may create the corresponding integer in Sage by doing:

sage: !cat a.txt
sage: with open('a.txt','r') as f:
....:     a = Integer(
sage: type(a)
<class 'sage.rings.integer.Integer'>
sage: a
Sébastien gravatar imageSébastien ( 2020-03-25 09:59:09 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2020-03-24 15:28:06 -0500

Emmanuel Charpentier gravatar image

As long as you are able to express your giant coefficients in Sage form, that should be both pretty trivial and pretty pointless.

Pretty trivial:

sage: var("a,b,c,d,e")
(a, b, c, d, e)
sage: E=a*x^4+b*x^3+c*x^2+d*x+e==0
sage: %time S=solve(E,x)
CPU times: user 4.7 s, sys: 273 ms, total: 4.97 s
Wall time: 4.31 s
sage: len(S)

You can then S2=S.subs({a:whatever, b:you, c:want, d:to, e:substitute}) to get your expressions.

Pretty pointless: with coonstant coefficuients, this explicit solution of the quartic doesn't \LaTeX on a single A4 portrait page. Unless your giant coefficients have very specialshape, simplifying "miraculously" the expressions of the roots, your result will be unusable pe se.

However, they can be manipulated by Sage for further processing. Wouldn't it be easier ti denote the (unexpressed, but knon existing) roots of your quartic by variables, and use that in the "further processing" ?


edit flag offensive delete link more


Apparently, this attempt to answer has displeased someone, who didn't took the pain to explain why he/she was displeased. Too bad...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2020-03-24 18:01:10 -0500 )edit

Sorry Emmanuel, it's me. Personally, I think it is not necessary to add judgements ("trivial", "pretty pointless") to an answer. Most probably, this is not trivial nor pointless for the person asking the question. If you remove those, I will remove my down vote.

Sébastien gravatar imageSébastien ( 2020-03-25 02:23:14 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2020-03-19 08:54:00 -0500

Seen: 43 times

Last updated: Mar 24