;ò ¾ tDc@sUdkZdkZd„Zd„Zd„Zd„Zd„Zd„Zd„ZdS(NcCs|djodSndSdS(s.sign of x, i.e. +1 or -1; returns 1 for x == 0iiiÿÿÿÿN(sx(sx((sA/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/mathutils.pyssign s cCs&ti|ti||dƒƒSdS(s$Return the arc hyperbolic sine of x.iN(smathslogsxssqrt(sx((sA/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/mathutils.pysasinh'scCs&ti|ti||dƒƒSdS(s&Return the arc hyperbolic cosine of x.iN(smathslogsxssqrt(sx((sA/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/mathutils.pysacosh,scCsV||d|}|djogSnti|ƒ}d| |d| |gSdS(s.gives the real roots of x**2 + a1 * x + a0 = 0iif0.5N(sa1sa0sDsmathssqrtsSD(sa1sa0sDsSD((sA/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/mathutils.pys_realroots_quadratic1s  cCs!d|||d}d||d|d|||d} |||| | }|djo›ti|ƒ} | | djo| | dd }n| | dd  }| | djo| | dd }n| | dd  }|||d gSn |djoQ|djo| d gSqti| ƒ }d||d | |d gSnÂti| ƒ}| |d} | djo d} n2| d jo ti} nti| |dƒ} gi} tdƒD]@}| d|ti| dd|tid ƒ|d ƒqÖ~ Sd S( s:gives the real roots of x**3 + a2 * x**2 + a1 * x + a0 = 0if9.0i iif54.0iif3.0iÿÿÿÿN(sa1sa2sQsa0sRsDsmathssqrtsSDsSsTsSQsargsthetaspisacossappends_[1]srangesiscos(sa2sa1sa0sQsDsisSQsTsSsRs_[1]sargsthetasSD((sA/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/mathutils.pys_realroots_cubic:s4*   #    c Cst| ||d|d|||||||ƒ}gi}|D]N}||d|d|djo||d|djo||ƒqIqI~}| ogSnt |ƒ}||d|djo¢t d|t i ||d|d|ƒd|t i ||d|ƒƒt d|t i ||d|d|ƒd|t i ||d|ƒƒSnŸt d|t i ||d|d|ƒd|t i ||d|ƒƒt d|t i ||d|d|ƒd|t i ||d|ƒƒSdS(sFgives the real roots of x**4 + a3 * x**3 + a2 * x**2 + a1 * x + a0 = 0iiif0.5N(s_realroots_cubicsa2sa1sa3sa0syssappends_[1]sysminsy1s_realroots_quadraticsmathssqrt(sa3sa2sa1sa0s_[1]sy1sysys((sA/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/mathutils.pys_realroots_quartic_s;e ¢cGs| o dgSnyAd|d}gi}|dD]}|||ƒq6~}Wn!tj ot|dŒSnXt|ƒ}|djogSn{|djo|d gSn^|djot |ŒSnC|djot |ŒSn(|djot |ŒSn t dƒ‚dS( s”returns the roots of a polynom with given coefficients polynomial with coefficients given in cs: 0 = \sum_i cs[i] * x^(len(cs)-i-1) if1.0iiiisGrealpolyroots solver currently limited to polynoms up to the power of 4N( scssfsappends_[1]scsArithmeticErrors realpolyrootsslensns_realroots_quadratics_realroots_cubics_realroots_quartics RuntimeError(scsscsfsns_[1]((sA/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/mathutils.pys realpolyrootsos( 3      ( smathstypesssignsasinhsacoshs_realroots_quadratics_realroots_cubics_realroots_quartics realpolyroots( sasinhs_realroots_quarticssigns realpolyrootss_realroots_quadraticsmathsacoshstypess_realroots_cubic((sA/mnt/gmirror/ports/graphics/py-PyX/work/PyX-0.10/pyx/mathutils.pys?s    %