sturm vs fsolve

Librairie C++ de calcul formel/ C++ symbolic computation library

Modérateur : xcasadmin

jocaps
Messages : 118
Inscription : lun. avr. 17, 2017 4:32 pm

sturm vs fsolve

Message par jocaps » mar. juin 23, 2020 11:48 am

Hi,

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

giac("printpow(1)")
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?

Jose

parisse
Messages : 5084
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: sturm vs fsolve

Message par parisse » mer. juin 24, 2020 5:29 pm

sturm works only on exact input. You can call exact inside sturm to convert your coefficients to rationals. I'll add auto-exact conversion.

jocaps
Messages : 118
Inscription : lun. avr. 17, 2017 4:32 pm

Re: sturm vs fsolve

Message par jocaps » jeu. juin 25, 2020 3:51 am

Thanks for the hint Bernard!

Répondre