-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
gaussian_quadrature #662
gaussian_quadrature #662
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #662 +/- ##
==========================================
- Coverage 94.66% 94.65% -0.01%
==========================================
Files 290 291 +1
Lines 23161 23200 +39
==========================================
+ Hits 21925 21961 +36
- Misses 1236 1239 +3 ☔ View full report in Codecov by Sentry. |
sorry about all the commits guys i was rushing |
fn get_gaussian_quadrature_points_weights(num_points: usize) -> (Vec<f64>, Vec<f64>) { | ||
// Hardcoded values for Gaussian Quadrature points and weights | ||
match num_points { | ||
1 => (vec![0.0], vec![2.0]), | ||
2 => (vec![-1.0 / 3.0, 1.0 / 3.0], vec![1.0, 1.0]), | ||
3 => ( | ||
vec![-0.7745966692414834, 0.0, 0.7745966692414834], | ||
vec![0.5555555555555556, 0.8888888888888888, 0.5555555555555556], | ||
), | ||
_ => unimplemented!("Gaussian Quadrature not implemented for this number of points"), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would highly suggest to generalize it for any number of points/order. It also seems that it uses Legendre polynomials. It also could be more general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm,i am kinda cofused here ,can you please tell me more information about what i should add?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's start with basic stuff: it would be great to call gaussian_quadrature
with order
being 20
and obtain a valid result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, i see what you mean,sorry for being late ,been kinda busy,thanks for the explanation my man.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i keep trying to add the options but the result just keeps getting more complicated and wrong ,my purpose in here wat to give an example of another numerical approach to integrals,after some research 3 is the most command order for this method (and most accurate) ,mind if i leave it like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should go for the general case.
@todi-mih are you still working on this? If not, please close this PR. |
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel. Thank you for your contributions! |
This algorithm implements Gaussian Quadrature, a numerical integration technique, to approximate the definite integral of a given function over a specified interval. The gaussian_quadrature function takes the interval [a, b], a function f(x) to integrate, and the number of points to use in the quadrature.