Cosmos: Possible incorrect implementation: newton-raphson.c

Created on 31 Dec 2017  路  6Comments  路  Source: OpenGenus/cosmos

This is a(n):

  • [ ] New algorithm
  • [ ] Update to an existing algorithm
  • [X] Error
  • [ ] Proposal to the Repository

Details:

I think the Newton raphson program in c is wrongly implemented. After removing the stray characters and compiling it, it seems to always print the same output.

Enter x0, allowed error and maximum iterations
1 0.001 10
 At Iteration no.   1, x = -0.003824
 At Iteration no.   2, x =       nan
 At Iteration no.   3, x =       nan
 At Iteration no.   4, x =       nan
 At Iteration no.   5, x =       nan
 At Iteration no.   6, x =       nan
 At Iteration no.   7, x =       nan
 At Iteration no.   8, x =       nan
 At Iteration no.   9, x =       nan
 At Iteration no.  10, x =       nan

Irrespective of what is given as input, it always prints -0.003824 and nan for all further output. See if someone can fix it, or otherwise remove it.

Most helpful comment

Can I work on this issue?

All 6 comments

Can I work on this issue?

@parulagg27 Sure! Make sure that you mention this issue in your Pull Request so that this issue gets closed when you fix the issue.

@InfiniteCoder Sure.
But, I tried running the code, After removing the stray characters, it works fine here.

@parulagg27 If it works, then great! But I think this code has been plagiarized from either https://www.csee.umbc.edu/~tsimo1/CMSC455/code/newton_raph.c or http://www.codewithc.com/c-program-for-newton-raphson-method/. It seems that many of the programs in this repo might have been plagiarised. This repo needs some cleaning 馃棏

Yes! I completely agree. Many of the programs in this repo have been plagiarized. But, in that case, wouldn't it be better if we give credits to that source site. For example, if a c++ code of an algo has been copied from geeksforgeeks, we can comment out in our code in this way:
// Courtesy: geeksforgeeks
Just a suggestion. Need your opinion, @InfiniteCoder

@parulagg27 We need to make sure that,

  1. The license of the code is compatible with that of cosmos', i.e GNU GPLv3.
  2. The Author has allowed copying and redistribution of the program, most likely by mentioning a license such as GPL, MIT or CC-by-SA etc.

In most cases though, people don't put a license of their code. In such cases, by default the code becomes copyright protected .To be more specific, the author can put a license at any time, and claim copyright violation.

It surely wouldn't be fun to see cosmos taken down because of copyright violations. So I suggest we simply take down any programs with copyright violations. Of course, if the author is happy for redistribution, we can always give credits.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Josh5231 picture Josh5231  路  4Comments

ruchirchauhan picture ruchirchauhan  路  4Comments

InfiniteCoder picture InfiniteCoder  路  3Comments

skywalker212 picture skywalker212  路  3Comments

rhendz picture rhendz  路  4Comments