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

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 close merge delete

1

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

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
123456
sage: with open('a.txt','r') as f:
....:
sage: type(a)
<class 'sage.rings.integer.Integer'>
sage: a
123456


Sort by » oldest newest most voted

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)
4


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" ?

HTH,

more

2

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.