Python Forum
Natural Logarithm in Python
Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Natural Logarithm in Python
#7
So what do you get when compared to a manual calculation?
If you get the same thing then what you have written could be OK (I'm not making any judgement on this - trying to show you how you can check your own work)? (And yes - there is a mistake if the formula you wrote in the OP is correct)
If not then try just one term and make sure that is correct. Then try adding another and so on.
Extra credit/learning: it is generally good practice to perform some level of error checking, especially on any value that is being input by a person. Without getting in to complex numbers, what happens if you (accidentally) enter a negative number and pass that to the 'log' function? Is that what you want to happen? If not then, once you have the code doing the correct thing with known valid numbers, what do you want to do when someone enters an invalid number?
Susan
Reply


Messages In This Thread
Natural Logarithm in Python - by yg89 - Mar-27-2017, 08:15 PM
RE: Natural Logarithm in Python - by nilamo - Mar-27-2017, 08:18 PM
RE: Natural Logarithm in Python - by yg89 - Apr-06-2017, 01:06 AM
RE: Natural Logarithm in Python - by yg89 - May-01-2017, 12:39 AM
RE: Natural Logarithm in Python - by volcano63 - May-01-2017, 01:35 AM
RE: Natural Logarithm in Python - by yg89 - May-03-2017, 01:48 AM
RE: Natural Logarithm in Python - by volcano63 - May-03-2017, 05:39 AM
RE: Natural Logarithm in Python - by AussieSusan - May-03-2017, 03:17 AM
RE: Natural Logarithm in Python - by yg89 - May-07-2017, 12:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Natural language processing project maaaa2401 1 1,874 Dec-04-2020, 07:26 PM
Last Post: Larz60+
  a generator that computes squares of first 20 natural numbers mdshamim06 1 8,990 Oct-01-2019, 10:38 AM
Last Post: buran
  need help in natural language processing irsyadfm 7 4,606 Aug-07-2019, 07:42 AM
Last Post: tkorol
  natural logarithm print atux_null 5 3,723 Oct-20-2017, 02:14 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020