[GSoC] Functions: Fixes incorrect evaluation caused due to subfactorial in limit_seq expression #19515
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #9308
Brief description of what is fixed or changed
Incorrect limit_seq evaluation takes place because of subfactorial in limit_seq expression.
Ideally, we should have
_eval_rewrite_as_factorial()
and_eval_rewrite_as_gamma()
functionalities forsubfactorial
.This is implemented using the equation:
For further details: https://en.wikipedia.org/wiki/Derangement#Limit_of_ratio_of_derangement_to_permutation_as_n_approaches_%E2%88%9E
After this, we can simply rewrite the
subfactorial
term present inlimit_seq expression
togamma
, so that the evaluations take place correctly.Other Comments
Regression Test has been added.
Release Notes
_eval_rewrite_as_factorial()
and_eval_rewrite_as_gamma()
functionalities forsubfactorial