auf dem Wiki-Artikel aus, dass Sie auf dem Laufenden, ich glaube, Sie die Werte der hypergeometric Funktion mit diesem Code annähern kann, die ich schrieb:
Als nächster Schritt kann es möglich sein, den Fehler des abzuschätzen Annäherung.
/**
* The generalized hypergeometric function is a convergent power series \sum_{i=0}^{\infty} c_i x^i
* where the coefficients satisfy c_{n+1}/c_n = A(n)/B(n) for some polynomials A and B in n.
* It is customary to factor out the leading term, so c_0 is assumed to be 1
*/
public class HypergeometricFunction {
private final int degreeOfApproximation;
private final double[] coefficientsOfA;
private final double[] coefficientsOfB;
private final double[] coefficientsOfHypergeometricFunction;
public HypergeometricFunction(int degreeOfApproximation, double[] coefficientsOfA, double[] coefficientsOfB) {
this.degreeOfApproximation = degreeOfApproximation;
this.coefficientsOfA = coefficientsOfA;
this.coefficientsOfB = coefficientsOfB;
this.coefficientsOfHypergeometricFunction = generateCoefficients();
}
/**
* @param x input
* @return Approximation to the hypergeometric function by taking the first
* {@code degreeOfApproximation} terms from the series.
*/
public double approximate(double x){
return evaluatePolynomial(x, coefficientsOfHypergeometricFunction);
}
private double[] generateCoefficients() {
double[] coefficients = new double[degreeOfApproximation];
coefficients[0] = 1;
for (int i = 1; i < degreeOfApproximation; i++)
coefficients[i] = (evaluatePolynomial(i, coefficientsOfA)/evaluatePolynomial(i, coefficientsOfB)) * coefficients[i - 1];
return coefficients;
}
private double evaluatePolynomial(double n, double[] coefficients) {
int length = coefficients.length;
double out = 0.0D;
for (int i = 0; i < length; i++) {
out += coefficients[i] * pow(n, i);
}
return out;
}
private double pow(double a, int b) {
double out = 1;
for (int i = 0; i < b; i++) out *= a;
return out;
}
}
Wenn die Serie konvergiert (und damit eine ordnungsgemäße hypergeometric Funktion bereitstellt), seine lim[c_i*x^i]
dann muss Null, so dass dies eine vernünftige Annäherung liefern sollte, wenn Sie degreeOfApproximation
nehmen groß genug zu sein.
Die Polynome A und B sind diejenigen, auf die im Wiki-Artikel Bezug genommen wird, und um diesen Code zu verwenden, müssen Sie Koeffizienten für diese Polynome dem Konstruktor zusammen mit dem gewünschten Grad der Approximation bereitstellen.
Hoffe, das hilft Ihnen aus.
Danke für die Antwort. Ich habe mich in dem Thema geirrt. Es sollte eine generalisierte hypergeometrische Funktion anstelle einer verallgemeinerten hypergeometrischen Verteilung sein. Das tut mir leid. – longread