I am a science research teacher, and I could really use your help on a plagiarism issue.
A student of mine just recently submitted a computer science /math project on continued fractions with code almost identical to that found at your page http://perlmonks.thepen.com/dlcode/41961.txt. I've also shown the text below. My student says that although he took some of the program from open source code (without telling us he had done so) he can't imagine how his whole project seems to be identical to that found on your site. I found out about this when several other students pointed out this site to me and expressed their concerns that my student had simply copied your code. My student had completed his project in the last week and had posted his code on an open server for his own convenience.
I need to verify that the code at http://perlmonks.thepen.com/dlcode/41961.txt could not have been posted by one of my own students in the last several days. Can you tell me when this code was posted and could anyone have posted this code, or edited this code, on your site.
Thanks so much,
A student of mine just recently submitted a computer science /math project on continued fractions with code almost identical to that found at your page http://perlmonks.thepen.com/dlcode/41961.txt. I've also shown the text below. My student says that although he took some of the program from open source code (without telling us he had done so) he can't imagine how his whole project seems to be identical to that found on your site. I found out about this when several other students pointed out this site to me and expressed their concerns that my student had simply copied your code. My student had completed his project in the last week and had posted his code on an open server for his own convenience.
I need to verify that the code at http://perlmonks.thepen.com/dlcode/41961.txt could not have been posted by one of my own students in the last several days. Can you tell me when this code was posted and could anyone have posted this code, or edited this code, on your site.
Thanks so much,
#! /usr/bin/perl -w use strict; while (1) { print "Please enter a number or expression: "; my $num = eval(scalar <STDIN>); print "How many iterations: "; chomp(my $count = <STDIN>); print "Doing $count iterations of approximations to $num.\n"; my $f = ret_frac_iter($num); for (1..$count) { my ($n, $m) = $f->(); my $approx = $n/$m; print "$n/$m = $approx\n"; } print "\n"; } # Takes a number, returns the best integer approximation and (in list # context) the error. sub best_int { my $x = shift; my $approx = sprintf '%.0f', $x; if (wantarray) { return ($approx, $x - $approx); } else { return $approx; } } # Takes a numerator and denominator, in scalar context returns # the best fraction describing them, in list the numerator and # denominator sub frac_standard { my $n = best_int(shift); my $m = best_int(shift); my $k = gcd($n, $m); $n /= $k; $m /= $k; if ($m < 0) { $n *= -1; $m *= -1; } if (wantarray) { return ($n, $m); } else { return "$n/$m"; } } # Euclidean algorithm for calculating a GCD. # Takes two integers, returns the greatest common divisor. sub gcd { my ($n, $m) = @_; while ($m) { my $k = $n % $m; ($n, $m) = ($m, $k); } return $n; } # Takes a list of terms in a continued fraction, and converts it # into a fraction. sub ints_to_frac { my ($n, $m) = (0, 1); # Start with 0 while (@_) { my $k = pop; if ($n) { # Want frac for $k + 1/($n/$m) ($n, $m) = frac_standard($k*$n + $m, $n); } else { # Want $k ($n, $m) = frac_standard($k, 1); } } return frac_standard($n, $m); } # Takes a number, returns an anon sub which iterates through a set of # fractional approximations that converges very quickly to the number. sub ret_frac_iter { my $x = shift; my $term_iter = ret_next_term_iter($x); my @ints; return sub { push @ints, $term_iter->(); return ints_to_frac(@ints); } } # terms of a continued fraction converging on that number. sub ret_next_term_iter { my $x = shift; return sub { (my $n, $x) = best_int($x); if (0 != $x) { $x = 1/$x; } return $n; }; }
Edited by mirod on 2003-02-13: added br/code/readmore tags
Edited by broquaint on 2003-02-14: turned URIs into links
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Plagiarism??
by JaWi (Hermit) on Feb 13, 2003 at 10:24 UTC | |
Re: Plagiarism??
by tachyon (Chancellor) on Feb 13, 2003 at 14:17 UTC | |
by vagnerr (Prior) on Feb 13, 2003 at 17:59 UTC | |
by Mr. Muskrat (Canon) on Feb 13, 2003 at 18:15 UTC | |
by FoxtrotUniform (Prior) on Feb 13, 2003 at 18:48 UTC | |
by Vennis (Pilgrim) on Feb 18, 2003 at 14:57 UTC | |
Re: Plagiarism??
by Nitrox (Chaplain) on Feb 13, 2003 at 13:59 UTC | |
by CountZero (Bishop) on Feb 13, 2003 at 14:17 UTC | |
Re: Plagiarism??
by Marza (Vicar) on Feb 13, 2003 at 18:33 UTC | |
Re: Plagiarism??
by hossman (Prior) on Feb 13, 2003 at 18:51 UTC | |
Re: Plagiarism??
by Anonymous Monk on Feb 13, 2003 at 20:37 UTC | |
Re: Plagiarism??
by grinder (Bishop) on Feb 13, 2003 at 22:25 UTC | |
Re: Plagiarism??
by tmiklas (Hermit) on Feb 14, 2003 at 09:55 UTC | |
Re: Plagiarism??
by Elgon (Curate) on Feb 13, 2003 at 18:35 UTC | |
by Anonymous Monk on Feb 13, 2003 at 20:42 UTC | |
by Elgon (Curate) on Feb 13, 2003 at 20:52 UTC | |
by Anonymous Monk on Feb 13, 2003 at 21:17 UTC | |
Re: Plagiarism??
by LameNerd (Hermit) on Feb 14, 2003 at 00:01 UTC |
Back to
Perl Monks Discussion