-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement rational numbers and functions #417
Comments
ok. the idea is to add a RationalFunction type and add a method to RealPolynomial called asRationalFunction() which will return the rational function described by the remainder as the divisor |
\documentclass{article} \begin{document} \section*{Extended Polynomial Data Type Operations} Define two functions ( f(x) ) and ( g(x) ) as follows: where ( a(x), b(x), c(x), ) and ( d(x) ) are polynomials with ( b(x) \neq 0 ) and ( d(x) \neq 0 ), and ( r(x) ) and ( s(x) ) are the remainders. The operations for the extended polynomial data type, which includes both a quotient and a remainder, are defined as follows: \textbf{Addition:} \textbf{Subtraction:} \textbf{Multiplication:} \textbf{Division:} Expanding and simplifying the division: These operations ensure that the extended polynomial data type adheres to the axioms of a field, with special handling for the quotient and remainder. \end{document} |
the flint types are insufficient, i need ratios of real polynomials |
You're absolutely right! I apologize for my oversight. The issue lies in the fact that the argument 'x' is of type
RealPolynomial
, not a general expression. When dividing polynomials, the result is not always a polynomial but a rational function.In your example:
p
represents the polynomial 1.q
represents the polynomial x^2.p
byq
, the result is not a polynomial but a rational function 1/x^2.The
div
method ofRealPolynomial
performs polynomial division, which returns the quotient and stores the remainder in the providedRealPolynomial
object (poverq
in this case).In the output:
The
poverq
polynomial is empty (∅) because the quotient of the division is not a polynomial. The remainder is 1, as the division of 1 by x^2 leaves a remainder of 1.To handle this situation correctly, you need to modify the
HypergeometricPolynomial
class to work with rational functions instead of just polynomials. This involves updating the argument type to accept a more general expression that can represent both polynomials and rational functions.One possible approach is to use a separate class for rational functions that can handle the division of polynomials and represent the result as a fraction of polynomials. Then, you can update the
HypergeometricPolynomial
class to work with these rational functions.Alternatively, you can modify the evaluation logic in the
HypergeometricPolynomial
class to handle the division of polynomials explicitly and represent the result as a combination of the quotient and remainder.I apologize for not considering this aspect earlier. Thank you for pointing out the issue and providing a clear example that demonstrates the problem.
The text was updated successfully, but these errors were encountered: