OpenGenus / cosmos

World's largest Contributor driven code dataset | Used in Quark Search Engine, @OpenGenus IQ, OpenGenus Visual Project
http://internship.opengenus.org
GNU General Public License v3.0
13.57k stars 3.69k forks source link

Possible incorrect implementation: newton-raphson.c #3170

Open InfiniteCoder opened 6 years ago

InfiniteCoder commented 6 years ago

This is a(n):

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.

parulagg27 commented 6 years ago

Can I work on this issue?

InfiniteCoder commented 6 years ago

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

parulagg27 commented 6 years ago

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

InfiniteCoder commented 6 years ago

@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 🗑

parulagg27 commented 6 years ago

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

InfiniteCoder commented 6 years ago

@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.