From: Andrey I. <and...@ma...> - 2025-03-17 13:34:54
|
Alan Barnes wrote: > I note that using alternative power-series package tps, one gets: > > 1: ps(sqrt((x-y)^2), z,0); > > |x - y| > > which is an improvement, but of course this is only correct if x-y is real. However, after > > on precise_complex; > > both power-series packages produce (sqrt(x^2-2x*y+y^2) as the first term which is correct, but somewhat messy if x-y is real . I find that 1: on precise_complex; sometimes works 2: taylor(sqrt((1-z)^2), s, 0, 1); 2 2 sqrt((z - 1) ) + O(s ) and provide a desired workaround 3: taylor(sqrt((1-z)^2), s, 0, 1) where {sqrt((1-z)^2)=>1-z}; 2 - z + 1 + O(s ) Strangely, however, it fails in a more realistic example 4: taylor(sqrt((1-z)*(1-s*z)), s, 1, 0); z - 1 + O(s - 1) ps, nevertheless, continues to work 5: pstruncate(ps(sqrt((1-z)*(1-s*z)), s, 1), 0) where {sqrt((1-z)^2)=>1-z}; - z + 1 Best regards, Andrey |