There is no bug and the result is not that strange.
(4) gives the symbolic expression, but (5) doesn't
evaluate the expression at 1. The (5) compiles
x - p/p'
again and returns 1-p/p'
You can use eval:
(18) -> eval(N x,x,1)
16
(18) ──
11
Type:
Fraction(Polynomial(Integer))
(19) -> eval(N x,x,1.0)
(19) 1.4545454545_454545455
Type:
Fraction(Polynomial(Float))
Or in my opinion, since you are using it for Newton iteration,
which mean numeric computation, this way is better:
(20) -> N2 := compiledFunction(N x, x)$MakeUnaryCompiledFunction(FRAC POLY
INT, DFLOAT, DFLOAT)
Compiling function %A with type DoubleFloat -> DoubleFloat
(20) theMap(MKUCFUNC;unaryFunction;SM;2!0,655)
Type: (DoubleFloat ->
DoubleFloat)
(21) -> N2(1)
(21) 1.4545454545454546
Type:
DoubleFloat
You can change the FRAC POLY INT above into EXPR INT for
functions other than polynomial.
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.