0

I have fixed some code, but it always gives me errors. Can anybody tell me its right code?

PsedoRemainder[F_, G_, ord_] :=
  Module[{polyquo, polyrem, MainVariable, Initial, Separant, l}
    polyquo = PolynomialQuotient[F, G, MainVariable]; 
    polyrem = PolynomialRemainder[F, G, MainVariable];
    MainVariable = Last[ord];
    l = Exponent[G, MainVariable];
    Initial = Last[CoefficientList[G, MainVariable]];
    Separant = D[G, MainVariable];
    polyrem[i_] := F;
    polyquo[j_] := 0;
    s := 0;
    deg[i_] := Exponent[R[i], MainVariable]; 
    Initial[i_] := Last[CoefficientList[polyrem[i], MainVariable]]
    While[deg[i] > l && [Initial]^s*F != polyquo[j]*G + polyrem[i], 
      s++;
      polyrem[{i + 1} _] := 
        Initial*R[i] - Initial[i]*[MainVariable]^(deg[i] - l)*G;
      polyquo[{j + 1} _] := 
        Initial*polyquo[j] + Initial[i]*[MainVariable]^(deg[i] - l);
      i++; j++;]
    Print[{[Initial]^s*F = polyquo[j]*G + polyrem[i], Initial[i], polyrem[i], polyquo[j]}];
    Return[polyrem, polyquo];

F = Subscript[x, 1]^2 Subscript[x, 2]^3 - Subscript[x, 2];
G = Subscript[x, 1]^3 Subscript[x, 2] - 2;
ord = [Subscript[x, 1], Subscript[x, 2]] 

The following are some explaintation

class of F:=Greatest subscript c for which x_c occurs actually in F,otherwisw 0 if F is a non-zero constant. In notation: cls(F)

MainVariable of F:=x_c if class of F is c>0,otherwise undefined.In notation :MainVariable(F)

Degree of F:=Degree of F in x_c if class of F is c>0,otherwise =0.In notation :deg(F)

For a non-constant polynomial F of class c>0, F is in normal form:= F=I*x_c^d+lower degree terms in x_c

I is called initial of F In notation: Initial(F)

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
user36509
  • 1
  • 1
  • Your code, as posted has several syntax errors -- missing commas and semicolons. 2) Your use of return is both incorrect and can be eliminated -- just make the last line in your module {R[i], Q[j], Initial[i]} 3) You have many undefined identifiers. 4} Using Initial and initial[i] is almost certainly going to cause trouble -- note that lists, vectors, and arrays are indexed with [[ ]] not [ ] in Mathematica. I strongly recommend you read our post for new users.
  • – m_goldberg Dec 22 '15 at 02:15
  • I can post code if this gets reopened. – Daniel Lichtblau Dec 22 '15 at 18:09
  • Thank you ,please tell me your code ,maybe I have more ideas about this question. – user36509 Dec 23 '15 at 01:37
  • Please format your code properly, at the moment reading (esp. after the last edit) is painful. Also make sure to include correct, working code (as far as possible). – Yves Klett Dec 23 '15 at 07:29
  • 1
    The current version of your code is still nonsense -- full of syntax errors. – m_goldberg Dec 23 '15 at 08:20
  • Indeed many errors still. Return can have a single argument only. You use square brackets as parenthesis in the Print line. You also define Initial as a value first and then redefine it as a function. – Sjoerd C. de Vries Dec 23 '15 at 10:00
  • I'd vote to leave this closed if it wasn't for Daniel. – Sjoerd C. de Vries Dec 23 '15 at 10:01
  • using Subscript makes the code very hard to read. I do not see what is the fascination with Subscripts really. – Nasser Dec 23 '15 at 12:23
  • Except now I'm away for a few days and the code is in my office. Will post on Monday. Meanwhile you might put some time into fixing the basic errors others keep noting. – Daniel Lichtblau Dec 23 '15 at 13:29
  • I get stuck on line 1: what is your intention passing an undefined local module variable MainVariable to PolynomialQuotient ? Its valid but just returns F/G – george2079 Dec 23 '15 at 16:21