Skip to content
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

🎨 [New Terms]: Java Math Methods: logarithmic functions (#902) #1181

Merged
merged 21 commits into from
Oct 31, 2022

Conversation

tanishq-singh-2407
Copy link
Contributor

Description

Type of Change

  • Adding a new entry
  • Editing an existing entry (fixing a typo, bug, issues, etc)
  • Updating the documentation

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • Under "Development" on the right, I have linked any issues that are relevant to this PR (write "Closes [Term Entries] Java Math Methods: logarithmic functions #902 in the "Description" above).

@SSwiniarski SSwiniarski added java Java entries new entry New entry or entries hacktoberfest labels Oct 27, 2022
@SSwiniarski SSwiniarski self-assigned this Oct 27, 2022
Copy link
Contributor

@SSwiniarski SSwiniarski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tanishq-singh-2301, I did a first review and left some comments.

- 'paths/computer-science'
---

The **`java.lang.Math.log()`** method returns `ln a`, the natural logarithm of a.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The **`java.lang.Math.log()`** method returns `ln a`, the natural logarithm of a.
The **`.log()`** method returns `ln a`, the natural logarithm of a.


## Example

The following example demonstrates using `.log()` to find natural logs of:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following example demonstrates using `.log()` to find natural logs of:
The following example demonstrates using `.log()` to find natural logs:


## Codebyte Example

The following example is runnable and return `ln a`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following example is runnable and return `ln a`:
The following example is runnable and returns `ln a`:

- 'paths/computer-science'
---

The **`java.lang.Math.log10()`** method returns `log a`, the logarithm of `a` with base 10.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The **`java.lang.Math.log10()`** method returns `log a`, the logarithm of `a` with base 10.
The **`.log10()`** method returns `log a`, the logarithm of `a` with base 10.


## Example

The following example demonstrates using `.log10()` to find logs (with base 10) of:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following example demonstrates using `.log10()` to find logs (with base 10) of:
The following example demonstrates using `.log10()` to find logs (with base 10):


```shell
The result of log10(10) is: 1
The result of log10(-6) is: NaN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The result of log10(-6) is: NaN
The result of log10(-6.0) is: NaN

```shell
The result of log10(10) is: 1
The result of log10(-6) is: NaN
The result of log10(0) is: -Infinity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The result of log10(0) is: -Infinity
The result of log10(0.0) is: -Infinity

This will produce the following output:

```shell
The result of log(10) is: 2.303
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The result of log(10) is: 2.303
The result of log(10.0) is: 2.302585092994046


```shell
The result of log(10) is: 2.303
The result of log(-6) is: NaN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The result of log(-6) is: NaN
The result of log(-6.0) is: NaN

```shell
The result of log(10) is: 2.303
The result of log(-6) is: NaN
The result of log(0) is: -Infinity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The result of log(0) is: -Infinity
The result of log(0.0) is: -Infinity

Copy link
Contributor

@SSwiniarski SSwiniarski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tanishq-singh-2301, this looks ready for review two.

@HishamT HishamT self-requested a review October 30, 2022 21:38
@HishamT HishamT self-assigned this Oct 30, 2022
Copy link
Collaborator

@HishamT HishamT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @tanishq-singh-2301, I have finished the review of your entry and left some comments. 😁

- 'paths/computer-science'
---

The **`.log()`** method returns `ln a`, the natural logarithm of a.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The **`.log()`** method returns `ln a`, the natural logarithm of a.
The **`Math.log()`** method returns the natural logarithm of a number.

Math.log(a);
```

- The `.log()` method takes one parameter `a`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- The `.log()` method takes one parameter `a`.
The `Math.log()` method takes one parameter `a`.

```

- The `.log()` method takes one parameter `a`.
- If `a` is `NaN`, then return value is `NaN`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- If `a` is `NaN`, then return value is `NaN`.
If `a` is `NaN`, the return value is `NaN`.


- The `.log()` method takes one parameter `a`.
- If `a` is `NaN`, then return value is `NaN`.
- If `a` is `negative number`, then return value is `NaN`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- If `a` is `negative number`, then return value is `NaN`.
If `a` is a negative number, the return value is `NaN`.

- The `.log()` method takes one parameter `a`.
- If `a` is `NaN`, then return value is `NaN`.
- If `a` is `negative number`, then return value is `NaN`.
- If `a` is `positive number`, then return value is `double`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- If `a` is `positive number`, then return value is `double`.
If `a` is a positive number, the return value is a `double`.

@@ -0,0 +1,71 @@
---
Title: '.log()'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Title: '.log()'
'Math.log()'

Math.log(a);
```

- The `.log()` method takes one parameter `a`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not necessary as the function has been previously explained.

Math.log1p(a);
```

- The `.log1p()` method takes one parameter `a`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not necessary as this function has been explained previously.

```

- The `.log1p()` method takes one parameter `a`.
- If `a` is `NaN`, then return value is `NaN`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 23-27 should be the same as the ones in the entry for the previous two functions.


## Example

The following example demonstrates using `.log1p()` to find natural logs:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following example demonstrates using `.log1p()` to find natural logs:
The following example demonstrates using `Math.log1p()` to find natural logs:

@Dusch4593
Copy link
Contributor

Hey @tanishq-singh-2301 did you have any questions or need any help with implementing the latest round of feedback? As a reminder, today is the last today to merge your PRs and have them count toward Hacktoberfest. 👀

Copy link
Collaborator

@HishamT HishamT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Dusch4593
Copy link
Contributor

@tanishq-singh-2301 This looks ready to merge. I just made some changes across many commits prior to merging (cc: @HishamT @SSwiniarski):

  • Revised the lists in the "Syntax" sections.
    • I noticed that the claimed return value for a=0/-0 didn't seem quite right.
  • Consolidated to a single ```java snippet in the "Example" section.
    • Java is not currently supported in Codebytes. 😢
    • Adjusted the ```shell output snippets to reflect the revised code.

@Dusch4593 Dusch4593 merged commit 06f8a4c into Codecademy:main Oct 31, 2022
@Dusch4593 Dusch4593 added the hacktoberfest-accepted Indicates the PR was approved, merged, and pertains to Hacktoberfest label Oct 31, 2022
@github-actions
Copy link

👋 @tanishq-singh-2301
You have contributed to Codecademy Docs, and we would like to know more about you and your experience.
Please take a minute to fill out this four question survey to help us better understand Docs contributions and how we can improve the experience for you and our learners.
Thank you for your help!

@Dusch4593
Copy link
Contributor

Congrats and thank you so much for contributing to Codecademy Docs, @tanishq-singh-2301! 🚀 🥳

The entries should now be live.

Screen Shot 2022-10-31 at 5 17 46 PM

Looking forward to your next contribution to Docs! 😄

@tanishq-singh-2407 tanishq-singh-2407 deleted the tanishq-902 branch October 31, 2022 21:30
@Dusch4593
Copy link
Contributor

Hey @tanishq-singh-2301! 👋🏻

I was wondering if you'd be open to creating a new PR to make some edits to the 3 entries you recently contributed?

  • On line # 2 in each file, can we change the Title to .log(), .log10(), and .log1p() in log.md, log10.md, and log1p.md respectively?

@tanishq-singh-2407
Copy link
Contributor Author

sure!

@tanishq-singh-2407
Copy link
Contributor Author

There pr-link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest hacktoberfest-accepted Indicates the PR was approved, merged, and pertains to Hacktoberfest java Java entries new entry New entry or entries status: review 1️⃣ completed status: review 2️⃣ completed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Term Entries] Java Math Methods: logarithmic functions
4 participants