-
Notifications
You must be signed in to change notification settings - Fork 4.3k
{Term Entry] Python:NumPy Math Methods power #4838
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
Conversation
mamtawardhani
left a comment
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.
Thank you for contributing to Docs @cigar-galaxy82, the entry was well written! 😃
I've suggested a few changes, could you please review and modify those at your earliest convenience? Feel free to discuss any concerns, thank you! 😄
| @@ -0,0 +1,71 @@ | |||
| --- | |||
| Title: '.power()' | |||
| Description: 'The power method raises each element in the first array to the corresponding element in the second array and then calulates it.' | |||
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.
| Description: 'The power method raises each element in the first array to the corresponding element in the second array and then calulates it.' | |
| Description: 'Raises each element in the first array to the power of the corresponding element in the second array.' |
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.
Description should start with a verb, 'Calculates', 'Computes', etc.
| - 'paths/data-science-foundations' | ||
| --- | ||
|
|
||
| In the NumPy library, the **`.power()`** method raises each element in the first array to the corresponding element in the second array and then calculates it. It returns an array without commas separating the elements. To view the output with commas, use [`.repr()`](https://www.codecademy.com/resources/docs/python/built-in-functions/repr). |
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.
| In the NumPy library, the **`.power()`** method raises each element in the first array to the corresponding element in the second array and then calculates it. It returns an array without commas separating the elements. To view the output with commas, use [`.repr()`](https://www.codecademy.com/resources/docs/python/built-in-functions/repr). | |
| In the [NumPy](https://www.codecademy.com/resources/docs/numpy) library, the **`.power()`** method raises each element in the first array to the power of the corresponding element in the second array and computes the result. It returns an array without commas separating the elements. To view the output with commas, use [`.repr()`](https://www.codecademy.com/resources/docs/python/built-in-functions/repr). |
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.
Reframed the sentence and also added that the first array elements are raised "to the power of"
| ## Syntax | ||
|
|
||
| ```pseudo | ||
| numpy.round(array1, array2, out=None, where=True) |
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.
| numpy.round(array1, array2, out=None, where=True) | |
| numpy.power(x1, x2, out=None, where=True) |
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.
- the entry is for the
numpy.power()method, the syntax was having.round() - Let's stick to the official NumPy doc for the parameters: https://numpy.org/doc/stable/reference/generated/numpy.power.html
|
|
||
| - `array1`: A number or an array of numbers which will be used as a base. | ||
| - `array2`: A number or an array of numbers which will be used as exponent for elements in `array1`. | ||
| - `out`: An optional parameter that allows us to store the output array. If not provided, a new array will be created. |
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.
| - `out`: An optional parameter that allows us to store the output array. If not provided, a new array will be created. | |
| - `out`: An optional parameter that allows us to store the output array. If not specified, a new array will be allocated for the 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.
reframed it due to plagiarism issues for the second half of the sentence
|
|
||
| ## Codebyte Example | ||
|
|
||
| In this codebyte example, the `.power()` computes the power of the given elements in the in the `array1` as base with elements in `array2` as exponent for corresnpoding elements in `array1`: |
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.
| In this codebyte example, the `.power()` computes the power of the given elements in the in the `array1` as base with elements in `array2` as exponent for corresnpoding elements in `array1`: | |
| In this codebyte example, `.power()` method computes the power where each element in `array1` serves as the base raised to the power of the corresponding element in `array2`: |
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.
corrected the spelling mistakes and sentence formation
| - `array1`: A number or an array of numbers which will be used as a base. | ||
| - `array2`: A number or an array of numbers which will be used as exponent for elements in `array1`. |
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.
| - `array1`: A number or an array of numbers which will be used as a base. | |
| - `array2`: A number or an array of numbers which will be used as exponent for elements in `array1`. | |
| - `x1`: A number or an array of numbers used as the base. | |
| - `x2`: A number or an array of numbers used as the exponent for elements in `x1`. |
|
@cigar-galaxy82 please make the required changes, so this can be merged. Thank you 😃 |
|
Hi @mamtawardhani all the recommended changes are added |
minor changes
mamtawardhani
left a comment
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.
Great entry @cigar-galaxy82 😃
Ready to be merged! 🚀
|
👋 @cigar-galaxy82 🎉 Your contribution(s) can be seen here: https://www.codecademy.com/resources/docs/numpy/math-methods/power Please note it may take a little while for changes to become visible. |
Description
Added new term entry for Python:NumPy Math Methods
powerIssue Solved
Closes #4711
Type of Change
Checklist
mainbranch.Issues Solvedsection.