Hi, I'm quite a beginner when it comes to writing code, but I thought
I start learning C++ by writing some code that approximated polynomial
roots with the Newton-Raphson method. The program asks for the number
of terms in the polynomial, and then stores coefficients and exponents
in an array (a bad idea, but I have no idea how to do it in a better/
more efficient way). The program then calculates f(x) and f'(x) (x
being a guess), and then evaluates x-(f(x)/f'(x)). This evaluation
becomes the new x, and after the number of iterations prompted for are
finished, the program pauses. The program seemed to work well enough
for the first two iterations, but then it never got another digit of
accuracy. I assumed (incorrectly?) that this was because the precision
of the numbers were too low to produce a more accurate estimate. I
decided to see the results of trying to do bignum arithmetic (and I
figured that it would be worth it, because without a bignum arithmetic
library it would be worthless to do more than 10 iterations of most
polynomial estimates), and then spent the next three hours figuring
out how to compile, build, and place the libraries in their correct
spots. I then read the documentation, and changed all most of my
calculations into functions with mpf numbers. There are a couple of
things that are giving me some trouble though.
The first would probably be" void mpf_set_default_prec"; if I wanted
to set the default precision to 256 bits, what should the argument be?
(I know that the documentation did cover this, but no matter how I
change the argument, there's always a syntax error)
The second is that  mpf_mul does not allow me to multiply an mpf
number by a long double. The long double I must multiply the mpf
number is inside a for loop and changes every time the loop is goes
through once. How should I work around this?
Finally, I was considering storing the mpf numbers in an array, but
I'm not completely sure how to do this. Could someone please explain
to me (or just link me) on how to manage custom arrays?
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To post to this group, send email to mpir-devel@googlegroups.com.
To unsubscribe from this group, send email to 
mpir-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/mpir-devel?hl=en.

Reply via email to