简体   繁体   中英

increasing the precision of finding roots of a polynomial in matlab

我有一个多项式取决于matlab中的xy ,当我发现它的根是不同的x ,有时多项式中的根的替换值几乎不是零,这是什么问题?

Numerical issues may arise when x and y are poorly scaled. If, for example, your root (x,y) has very large values, machine precision might prevent you from getting the precise root. Try scale your function to a compact domain around (0,0) (usually [-1,1]x[-1,1] is a good starting point).

%// let mx and my be upper bounds to |x| and |y| respectively
nx = x / mx; %// change of variables
ny = y / my;
%// express your polynom in nx and ny and solve for them
%// let nrx and nry be a root of the polynom in the new changed variables, then:
rx = nrx * mx; %// root in original varialbes
ry = nry * my;
%// if you want to verify that the roots indeed brings your polynom to zero, you should try it in the scaled domain with rnx, rny.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM