Thank you for (mis)placing your faith in me. But if you want a better quality
of help you should write to the list and not to any one individual.
On Saturday 23 March 2002 02:44, brendan conroy wrote:
> OK here goes, Im pretty sure the error is in the monic function, thanks for
> your time on this
>
> <?
> function grobmonic($g)
> {
>
> for($c=0;$c<count($g);$c++)
> {
> $g[$c]=monic($g[$c]);
> }
> return $g;
> }
> ?>
>
>
> <?
> function monic($p)
> {
> print_r($p);
> if(gmp_cmp($p[0][0],$p[0][1])!=0)
> {
> $temp[0]=$p[0][1];
> $temp[1]=$p[0][0];
> $p=prodmono($temp,$p);
> }
> return $p;
> }
> ?>
>
>
>
>
> <?
> function prodmono($p1,$p2)
> {
>
> for($a=0;$a<count($p2);$a++)
> {
>
> $num=gmp_mul($p1[0],$p2[$a][0]);
>
> $den=gmp_mul($p1[1],$p2[$a][1]);
> $g=gmp_gcd($num,$den);
> if(gmp_cmp($g,1)!=0)
> {
> $num=gmp_divexact($num,$g);
> $den=gmp_divexact($den,$g);
> }
> $res[$a][0]=$num;
> $res[$a][1]=$den;
> $k=$i=$j=2;
> while($i<count($p1) && $j<count($p2[$a]))
> {
> if($p1[$i]<$p2[$a][$j])
> {
> $res[$a][$k]=$p1[$i];
> $res[$a][$k+1]=$p1[$i+1];
> $i=$i+2;
> }
> elseif($p1[$i]>$p2[$a][$j])
> {
> $res[$a][$k]=$p2[$a][$j];
> $res[$a][$k+1]=$p2[$a][$j+1];
> $j=$j+2;
> }
> else
> {
> $res[$a][$k]=$p1[$i];
> $res[$a][$k+1]=$p1[$i+1]+$p2[$a][$j+1];
> $i=$i+2;
> $j=$j+2;
> }
> $k=$k+2;
> }
> while($i<count($p1))
> {
> $res[$a][$k]=$p1[$i];
> $res[$a][$k+1]=$p1[$i+1];
> $i=$i+2;
> $k=$k+2;
> }
> while($j<count($p2[$a]))
> {
> $res[$a][$k]=$p2[$a][$j];
> $res[$a][$k+1]=$p2[$a][$j+1];
> $j=$j+2;
> $k=$k+2;
> }
> }
> return $res;
> }
> ?>
>
>
>
>
> From: Jason Wong <[EMAIL PROTECTED]>
>
> >To: [EMAIL PROTECTED]
> >Subject: Re: [PHP] Desperate!!!!!!! Resource id #24 -
> >error???????????
> >Date: Sat, 23 Mar 2002 02:18:58 +0800
> >
> >On Saturday 23 March 2002 01:53, brendan conroy wrote:
> > > Hi guys,
> > > Thanks for reading this. I desperatley need help with this
> >
> >error. I
> >
> > > just finished a huge project thats taken me months, my code works, but
> >
> >the
> >
> > > code its attached to has an error. The project is due Monday and
> >
> >naturally
> >
> > > enough the guy who wrote the code with the error is gone on holiday for
> >
> >the
> >
> > > weekend- typical.
> >
> >Let's see the code that "its attached to".
> >
> >
> >--
> >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> >
> >/*
> >Slang is language that takes off its coat, spits on its hands, and goes to
> >work.
> >*/
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php