Page 1 sur 1

sturm vs fsolve

Publié : mar. juin 23, 2020 11:48 am
par jocaps

I had the impression that sturm has a better runtime than fsolve when trying to find if a univariate polynomial has a root in an interval. It seems that I am wrong at least for Giac. Has anyone tried experimenting on sturm for a univariate polynomial say of degree 11? Because of my application, I use floating point numbers as coefficients, I do not know if this is the reason why sturm is extremely slow as opposed to fsolve. Any suggestions or tips would be appreciated.

Edit: It seems I am having another problem altogether. Here is a sample code in python with floating point numbers as coefficients

Code : Tout sélectionner

from giacpy import giac, sturm

f = giac("2680492.60978*t^11-341686983.33*t^10+16466062850.5*t^9-377441414896*t^8+4.07553042427e+012*t^7-1.75659265391e+013*t^6+3.40379111582e+013*t^5-2.94461942176e+013*t^4+8.14015310429e+012*t^3+3.58076018651e+012*t^2-1.96718745908e+012*t-1.561864479e+012")

print f.fsolve("t")
print sturm(f,"t",0,1)
I get the error: "poly.h/Tpow n<0 Error: Bad Argument Value" for sturm and I get no errors for fsolve. Anyone has an idea why this is the case?


Re: sturm vs fsolve

Publié : mer. juin 24, 2020 5:29 pm
par parisse
sturm works only on exact input. You can call exact inside sturm to convert your coefficients to rationals. I'll add auto-exact conversion.

Re: sturm vs fsolve

Publié : jeu. juin 25, 2020 3:51 am
par jocaps
Thanks for the hint Bernard!