How can I convert the fact10alpha to a numeric to use it in the computations???
That is the core of the problem: you cannot. SAS simply can not deal with numbers that fall outside of what can be handled with 8 bytes real.
Get the right tool for this kind of math and do it there. SAS is not the right tool.
To deal with numbers of the order of 1e395 as an integer without loss of precision you would need a machine representation of around 165 bytes (against SAS use of floating point 8 bytes - which does not allow even 2**64 precision). Using scientific notation does not change this requirement.
The example using Proc Groovy demonstrates there are other tools (Java, in this instance - I showed my age in mentioning Fortran) which can accommodate very large numbers. You should use those tools.
Any attempt to carry out numerical analysis on this scale in SAS is an exercise in futility.
Richard
Again, the question is "what are you trying to accomplish." It looks like you are trying to fnd the roots of a tenth-degree polynomial with coefficients given by some alternating expression that involves ... binomial coefficients? Looks like there is an "n choose k" term, or in your notation, "alpha choose i," but there are other terms as well.
What is the polynomial, and why are you trying to find its roots?
By the way, I wouldn't trust the result of the POLYROOT function on a polynomial with such huge coefficients. How do I know that the coefficients are huge? Well, you can compute the coefficients without computing factorials of the large numbers. Note that
(alpha + p)! = alpha! * (alpha+1) * (alpha+2) * ... * (alpha + p)
so that the term (alpha + 10)! in the numerator cancels most of the terms of (alpha + i)! in the denominator.
You are left with a numerator that is the simple product: (alpha + i + 1) * ... * (alpha + 10).
The denominator simplifies to (10 + 1)! * i!
From these computations, the coefficients of the i_th term of the polynomial are roughly of the order +/-alpha##(10-i). You can use the PROD function to compute the coefficients exactly, but again I emphasize that this is NOT something I recommend. Instead, I recommend understanding the purpose of finding the roots.
I try to find the roots to calculate the nodes and weights of the Gauss-Laguerre integration.
Do you mean that
xi= (Fact10alpha*((-1)**i
will be
xi=numerator/ denominator
numerator= (alpha+i+1)* (alpha+1)* (alpha+2)* (alpha+3)* (alpha+4)* (alpha+5)* (alpha+6)* (alpha+7)* (alpha+8)* (alpha+9)* (alpha+10)* ((-1)**i
denominator=(fact(10-i
Close. I think it's
numerator= (alpha+i
denominator=(fact(10-i
What is the integral you are trying to solve?
I'm very grateful to you for drawing my attention to cancel the factorials in the numerator and denominator.
I work in the quality control area. I try to compute the ARL of the EWMA chart using marcov chain approach. I need to solve integral of variable follows chi squared.
What do you mean by using the PROD function to compute the coefficients exactly?????? And if you don't trust the result of the POLYROOT function on a polynomial with such huge coefficients, Is there another way to find the roots of a polynomial with such huge coefficients??????
Ahh, this is good information! You are trying to accurately compute the average run length (ARL) for an EWMA control chart. This can be a difficult computation.
Have you looked at the EWMAARL function in the DATA step? There is an example of computing average run lengths in the documentation for the EWMACHART statement of the MACONTROL procedure in SAS/QC software.
But i try to compute the ARL of the EWMA with unknown parameters. Also, I will develop the EWMA to the AEWMA chart. I'm already designed the program but I want to know Is there another way to find the roots of a polynomial with such huge coefficients to complete the program?????
I need to move on to other responsibilities, so I'll let others advise you further. If you want to compute the roots of a tenth-order polynomial in SAS 9.2, you can try to use the POLYROOT function. Other choices are described in this article:
Finding the root (zero) of a function in SAS
Good luck.
Thanks so much Mr/Rick . I'm waiting for your reply because I want to compute the roots of a twenty fifth- order polynomial.
Do you know if there is a module in SAS for the Halley's method?????
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.