Пример #1
0
QString restpolynomial::EqDegFactor(unboundInt d){
    restpolynomial f, tmp(*this);
    f = tmp;

    unboundInt chara= f.charac();
    unboundInt one(1), count;
    unboundInt clara = chara;

    rest eins(one,chara);
    const rest zero(chara);

    rest minusOne(chara-one,chara);

    restpolynomial n(chara), m(chara), hilf(eins), master(zero), g(eins);
    QString res, hehe;
    int i=1, j=1;

    master = hilf;
    master = master.mult(minusOne);
    master.shift(j);

    while(clara.larger(j)){
        j++;
        if (clara.larger(j)){master.expand(zero);}
        else{master.expand(eins);}
    }

    while (f.degree() >= (2*i)){
        g = rgcd(f,master);

        if (g.degree()> 0){
            hehe = g.CanZas(i,d);
            res.append(hehe);
        }
        f = f/g;
        i++;

        clara = chara*clara;

        j= 1;
        master = hilf;
        master = master.mult(minusOne);
        master.shift(j);

        while(clara.larger(j)){
            j++;
            if (clara.larger(j)){master.expand(zero);}
            else{master.expand(eins);}
        }
        f.normalize();
    }

    if (f.degree()>0){
        hehe = f.CanZas(f.degree(),d);
        res.append(hehe);
    }
    return res;
}
Пример #2
0
 QString numPoly::factors(){
     bool cplx = false;
     numCplx eins(1,0);
     numCplx minusEins(-1,0);
     numPoly tmp(*this);
     tmp = tmp.normalize();
     numPoly help(eins), trx;
     QString res ="";
     if(tmp.degree()==-1){res= "0";}
     else{
     numCplx z, barz, test;

     //check for real or numCplx numPolys/////////////////
     QList<numCplx>::Iterator iter = mons.begin();
     while(iter != mons.end()){
         if (iter->val.imag() != 0){
             cplx = true;
             break;
         }
         iter++;
     }

     while (tmp.degree()> 0){

         z = tmp.newton();

         //if((100000*z.val.real() < 1) && (100000*z.val.real() > -1)){z.val.real() =0;}
         //if((100000*z.val.imag() < 1) && (100000*z.val.imag() > -1)){z.val.imag() =0;}

         if(cplx || (100000*z.val.imag() < 1) && (100000*z.val.imag() > -1)){
             trx = help.mult(minusEins*z);
             trx.expand(eins);
         }
         else
         {
             barz.val = conj(z.val);
             trx = help.mult(z*barz);
             trx.expand(minusEins*(z+barz));
             trx.expand(eins);
         }

         test = tmp.value(z);

         if((100*test.real() < 1) && (100*test.real() > -1) && (100*test.imag() < 1) && (100*test.imag() > -1)){
             res.append(trx.print(6));
         }
         else{res.append("no");}
         res.append(", ");
         tmp = tmp/trx;
     }
     res = res.left(res.size()-2);
     }
     return res;
 }
Пример #3
0
int main(void)
{
	/* Uebung 4.1 */
    MyString eins("eins");
	{
        MyString zwei("zwei");
		MyString drei = zwei;
        MyString vier(zwei);
        eins = zwei;
        std::cout << "eins:" << eins.Get() << std::endl;
    }
    MyString test("test");

	std::cout << "eins:" << eins.Get() << std::endl; 

    // Uebung 4.2
    PrivatKunde kunde("Heinz Denker","Denkeralm Strasse 1, Denkerdorf","336537","UniBwM","7777");
    kunde.KundenDatenAusgeben();

    // Ende?

    return 0;
}