Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses


by schorn (Sexton)
on Feb 13, 2003 at 10:17 UTC ( [id://234940] : monkdiscuss . print w/replies, xml ) Need Help??

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 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 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
    If you go here, you find at the top of the page that it is submitted by tilly at November the 16th of 2000. So clearly it hasn't been submitted by one of your students.

    Hope it helps,

    -- JaWi

    "A chicken is an egg's way of producing more eggs."

Re: Plagiarism??
by tachyon (Chancellor) on Feb 13, 2003 at 14:17 UTC

    Although lack of attribution is correctly frowned upon in academic circles and your student deserves whatever he gets I recall a story from my student days.

    The professor of engineering set his students a problem. "Given that to cook a side of beef medium rare the core temperature of the roast must reach 45 C how long will it take to cook 2Kg of meat to medium rare in a 200 C oven with the meat starting at room temperature (22 C)?

    Student 1 was the practical type so he just rang his mom, posed the question and got the answer 1 1/2 hours dear. Have you met a girl?

    Student 2 was of the more experimental bent and also rich so he simply cooked up a series of pieces of meat for 1/2 1 1/2 and 2 hours and sampled them to arrive at the answer of 1 1/2 hours.

    Student 3 was a little more on the deeply experimental side. He purchased a meat thermometer, performed the experiment, and came up with the answer.

    Student 4 was the theoretician. He looked a the specific heat capacity of meat, heat transfer rates through solids and came up with an answer (he was wrong of course because his model was insufficiently accurate and failed to account for the insulating effect of the fat) so had to eat a very rare roast so added a SWAG* to get his answer.

    Question: Who will make the better engineer?

    * SWAG (n) Scientific Wild Arsed Guess




      ...he just rang his mom, posed the question and got the answer 1 1/2 hours dear. Have you met a girl?
      Oh how true :-)

      Seriously though it does come down to your brief. This reminds me of a spot quiz that my girlfriend's students were set on their IT for humanities course. The entire group were set the task of finding answers to a whole lot of general questions (How many computers in the computer lab, whats the classmark of a particular library book, how mutch does the local print shop charge for photocopies etc.) and given an hour to find them using whatever resources they wished. They could even have asked the supervisors the answers if they liked and that would have been ok, that was the brief.

      However I aggree with tachyon, this student was definatly outside his brief. He was expected to present his own work as is usual for a programming assignment. He chose to ...ahem... present someone else's. Not smart, and also not the way to learn.

      Remember that amateurs built Noah's Ark. Professionals built the Titanic.

      Question: Who will make the better engineer?

      Student 3 because he's strictly by-the-book, knows what to do, how to do it and follows through.

      However student 1 (once hired) will get more raises because he knows how to find the pertinent information in a timely manner. ;-)

          However student 1 (once hired) will get more raises because he knows how to find the pertinent information in a timely manner. ;-)

        ...until his manager discovers that all he's doing is asking his colleagues, his friends, and random people on the internet to do his work for him, because he never learned to reason independently in school.

        Bah. Loaded question, anyway. The whole learn-it-yourself/use-references-dumbass debate pretty much inevitably turns into one giant excluded middle fallacy.

        F o x t r o t U n i f o r m
        Found a typo in this node? /msg me
        The hell with paco, vote for Erudil!

Re: Plagiarism??
by Nitrox (Chaplain) on Feb 13, 2003 at 13:59 UTC
    ...he took some of the program from open source code...

    Some? It appears that your student couldn't be bothered enough to even rename the variables.

    On the other hand, your student has shown great discipline in regards to the motto "Don't reinvent the wheel". Although he should have given credit to the source.


      Although he should have given credit to the source.

      That of course is the essence of plagiarism.


      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Plagiarism??
by Marza (Vicar) on Feb 13, 2003 at 18:33 UTC

    It would depend on the assigment. Since he is a student, the motto "don't reinvent the wheel" does not apply here. He is there to learn how to do this stuff.

    How else will he know how to modify somebody elses script which does not do all that is needed for a task.

    Personally, it looks like he copied it and put his name on it. He didn't even rewrite stuff to suit "his" programming style.

    Even in a work setting, can he put his name on it if he didn't do anything to the code?

    When I was taking classes, I sometimes borrowed a snippet or two. I gave the authors credit and the professors didn't downgrade me. As one said, "you had to learn what the code does inorder to use it."

    Your students case, I doubt he understands the code.

    HEY! Why not make him walk through the code and explain it! If he can explain what it does, then you can lecture him on plagurism. If he can't then you can knock him for being a cheater.

Re: Plagiarism??
by hossman (Prior) on Feb 13, 2003 at 18:51 UTC
    Just to explain JaWi's answer a little better...
    • is a mirror of designed to be more search engine friendly.
    • URLs such as provide direct access towhatever people submit as the "code" attached to a node (in this case, Node Id #41961)
    • Anytime you have a Node Id for perlmonks, you can go to and enter the Node Id (41961) in the search box, to see the complete information on that node (including author, posting date, replies, etc...) from the live site.

    In the future, if someone suggests that one of your students was plagarizing code from a PerlMonks URL, but page is served by, just look for the nodeId.

Re: Plagiarism??
by Anonymous Monk on Feb 13, 2003 at 20:37 UTC

    Does the student understand the code? A simple way to find out: place the student a room and ask them to rewrite the code. Allow them access to perldoc if requested. If they can rewrite the program to work as it should, I don't see much of a problem (skip to the next paragraph). If they can't I can think of lots of fun assignments to give them (including a very complete, line by line analysis of the plagiarized code).

    Also, a couple thousand word essay on the history of copyright law in your country including what its intended purpose is would be in order. There's no reason why this can't be converted into a positive experience.

Re: Plagiarism??
by grinder (Bishop) on Feb 13, 2003 at 22:25 UTC

    An interesting question.

    We try and take as much care as possible to avoid directly answering questions that sound like homework. But it's hard to prevent people lifting code written in the past.

    You have a couple of good answers here. In terms of formulating your reponse to your student, I would like to offer you one more data point. The topic of homework was discussed in a thread a year or so ago, and Mark-Jason Dominus (you may have heard of him) posted the following response.

    Finally, I would like to commend you on having taken the time to register an account here on Perlmonks. I hope you stick around, you might find it an invigorating experience.

    print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'
Re: Plagiarism??
by tmiklas (Hermit) on Feb 14, 2003 at 09:55 UTC
    I'm a studnet myself. I know that students always try to do some workarond just not to work by themselves.
    Anyway plagiarism shoud be punished.
    One of my profesors requires that we put suitable credits everywhere, where we cite more than one sentence or something important, even if we rewrite it in our way...
    Why? Becouse being a student doesn't mean to discover new energy sources, new stars, bacterias, whatever... Being a student is to learn how to find the right knowledge source, use it (providing suitable credits or disclaimers), and to get to some useful (usually own) conclusions. The same is with profesors :-]
    In some disciplines you just can't invent something new just like that (ie. in chemistry), but Perl is not one of those (TIMTOWTDI).

    As for me this student has simply copied the code and haven't provided suitable credit - so he should not pass his project. The only good news is, that he was smart enough to know where to search for solution :-]

    Greetz, Tom.
Re: Plagiarism??
by Elgon (Curate) on Feb 13, 2003 at 18:35 UTC


    If, as appears to be the case, the code is directly copied from Tilly's work then perhaps one of the Gods should contact him (as he no longer frequents the monastery for well known reasons) and ask what punishment he thinks would be appropriate. There is a fairly hefty difference between investigating a topic and turning up something useful, which you later attribute in a report, to wholesale copying without effort.


    "What this book tells me is that goose-stepping morons, such as yourself, should read books instead of burning them."
           - Dr. Jones Snr, Indiana Jones and the Last Crusade

      Why would it matter what tilly thinks on the subject? This is a student not attributing an extremely short script, it would be more of an annoyance to tilly than anything I'm sure. The consequences should be in the hand of the teacher, not the author (unless he wants to sue him or her for restitution for the incredible harm he's suffered ;-) )

        It matters because it is Tilly's work (despite what his employers may or may not think about it) which has been plagiarised and hence he has a right to know. Perlmonks was the method of dissemination and therefore we have a duty to inform him, or at the least the administrators of this site (id est the Gods) should consider doing so if they think that it won't irritate the hell out of him - considering the vast amount of really damn'd useful stuff he contributed during his time here, I think that it would be the conscientious thing to do. The size of the script is fairly irrelevant IMHO because it is not central to the misdemeanor, namely that the kid passed off work as his own when it was not.

        If you wish to discuss this further, email me at this address and save PM bandwidth.

        "What this book tells me is that goose-stepping morons, such as yourself, should read books instead of burning them."
               - Dr. Jones Snr, Indiana Jones and the Last Crusade

Re: Plagiarism??
by LameNerd (Hermit) on Feb 14, 2003 at 00:01 UTC
    Since this is a comp science / math assigment, I'd give the student a C for the comp sci part and an F for the math part.
    The C because he merely copied the code and did not improve it or demonstrate that he tested this code.
    The F because I doubt your student understand the math being preformed.
    Average grade would be an D.