Duoas 1,025 Postaholic Featured Poster

If you are going to give a seminar it is a good idea to know what you are talking about.

Do you know what a linked list is? Do you know how to implement one in the abstract? Can you implement one in C/C++/Pascal/whatever you like? Do you know the difference between singly-linked and doubly-linked lists? Do you know the advantages and disadvantages of using a linked list?

Do you know what recursion is? Do you know its pitfalls? Do you know how to convert a recursive procedure to one that uses a loop? (While you are at it, read up on tail-call recursion.)

Here is a recapitulation of the very first post (with some errors fixed):

program a;
type
  pStudent = ^tStudent;
  tStudent = record
    name: string;
    next: pStudent
    end;

function getStudentsFromUser: pStudent;
  var
    head: pStudent;
    curr: pStudent;
    name: string;
  begin
  head := nil;
  writeln( 'Enter student names, one per line.' );
  writeln( 'When done, enter a blank line' );

  { Get the first name }
  readln( name );
  name := trim( name );

  while name <> '' do
    begin
    { Add a new student to the list }
    if head = nil
      then begin
           { Create the first node in the list }
           new( head );
           curr := head
           end
      else begin
           { Tack a new node on the existing list }
           new( curr^.next );
           curr := curr^.next
           end;

    { Fill the node with data }
    curr^.name := name;
    curr^.next := nil;

    { Get the …
Duoas 1,025 Postaholic Featured Poster

If that is right. I could be wrong. Perhaps the set() method is only supposed to set the degree of the polynomial? void Polynomial::set( int degree ); I don't know the details of your homework assignment.

Duoas 1,025 Postaholic Featured Poster

Watch your types.

Going off of dubydapreek's revision:

  • Lines 7..11: Useless. Get rid of them. (You don't need to copy b to a before you copy b to a.)
  • Lines 27..28: You should be allocating an array of (double *).
  • Lines 31..32: You should be allocating an array of (double).

As a rule, when using malloc(), it should look something like: [B]type[/B] *foo = ([B]type[/B] *)malloc( n *sizeof( [B]type[/B] ) ); where "type" is whatever type you need it to be. In your case, "type" is first (double*) then it is (double).

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

If all you want is a color cube then yes, all you need to do is increment it like a binary number.

If you are not storing it as a packed integer value, then you only need three loops:

for red := min to max
    for green := min to max
      for blue := min to max
        output (red, green, blue)

(BTW, in both cases this is the "interpolate each component".)

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

The prototype for the method should look like this: void Polynomial::set( const double coefficients[], unsigned count ); This takes an array of "count" coefficients.

Does this help? (If not, what is the type of coef in P.set(coef); ?)

Duoas 1,025 Postaholic Featured Poster

You've got a name collision with the preprocessor.

At the top, you said #define poly Then below you say: vector<term> poly; which becomes: vector<term> ; Hence the grief.

In general, make sure that you guard your include files by using the same name as the file, but in all caps: #ifndef POLY_H #define POLY_H ...


You've got a lot of other errors in there too... Take them one at a time and try to see where you've made an error. You'll get through it.

The very first error, though, I'll help you with. Poly.cpp, line 10: you are trying to do something you can't: while (stream>> != ';') This is invalid syntax.

I'll show you the right way.

  1. You aren't testing if you are at EOF.
  2. You should peek for ';', because if it isn't you don't want to have actually read the character...
  3. Once you find ';', you'll want to read it.

So, something like the following might help:

while (stream)  // (while not EOF)
  {
    if (stream.peek() == ';')  // are we at the end of the poly?
      { // yes
        stream.get();  // read the ';'
        break;  // end the loop
      }
      ...  // normal stuff follows
  }

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Halt is abnormal program termination. In Unix and DOS, programs normally terminate with exit code zero. You can say halt( 1 ); to terminate abnormally with exit code 1. The exit code tells the program that executed your application (like Windows or the command shell) whether or not your program terminated normally. (Exit code 0 is success; anything else is error.) Except in shell scripts or other cases where anyone cares, the OS will typically ignore the return code.

For the bitmap, start a new project of the type "Windows Application" (or whatever the IDE calls it) and drop a TImage, a TButton, and a TOpenDialog on the main form. Double click the TButton and you'll be placed inside a procedure named something like "TForm1.Button1Click". Add the following:

procedure TForm1.Button1Click( Sender: TObject );
  begin
  if OpenDialog1.Execute then  // if user selects a filename
    try
      // Try to load and display it
      Image1.Picture.LoadFromFile( OpenDialog1.FileName )
    except
      // On error, complain.
      MessageDlg( "fooey!", mtWarning, [mbOK], 0 )
    end
  end;

Hope this gets you started. Make sure to find some good documentation. It makes all the difference.

Duoas 1,025 Postaholic Featured Poster

Please use code tags.

I've commented out the lines you don't need:

program Untitled;
uses windows;

var
  t: text;
  s: string[255];
  i: integer;

begin
  assign( t, 'untitled');
  reset( t );
  if IOResult <> 0 then
    begin
    MessageBox ( 0, 'File not found!', 'Error', Mb_ok );
    halt( 1 )
    end;

  i := 1;
  while not eof( t ) do
    begin
    readln( t, s );
    writeln( 'line ', i, ': ', s );  // use writeln, not write
//    readln;
//    Reset( t );
    inc( i )
    end;

//  halt ( i );
  close( t )
end.

The reason you never get to EOF is because each time through the loop you were reset ting the file back to the first line. Don't do that.

Also, don't halt your program to terminate normally...

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

That's a tall order. You'll have to google for some image processing components.
You might want to take a look at ImageMagick.

If you just want to convert an RGB tuple to a single grayscale value, it is something like:

function toGrayScale( red, green, blue: cardinal ): cardinal;
  begin
  result := trunc( (red * 0.3) + (green * 0.59) + (blue * 0.11) )
  end;

Good luck.

Duoas 1,025 Postaholic Featured Poster

Neither of those files contain main(). They only describe a single object. (The header describes what it looks like and the cpp describes how it works.) That is correct.

Duoas 1,025 Postaholic Featured Poster

Yes, cin.get() just reads one character, and throws it away (well, returns it, but you didn't save the return value).

Your input function looks much better.

As to the error: I don't know. I don't have your most recent code so I can't investigate on my own. But I think that the problem is a variation on the last problem...

Duoas 1,025 Postaholic Featured Poster

What?

Post your code.

Duoas 1,025 Postaholic Featured Poster

First, this belongs in the C++ forum.

I'm not getting unresolved external symbol errors, but they might be mistaken for some mismatched templated function arguments ("no matching function for call to xxx").

Password.cpp: Lines 55, 68, 91
The fstream.open() function takes a (const char *), not a (std::string). Fix it thus: in.open(FileName[B].c_str()[/B]); Password.cpp: Line 90
Watch the character case of your identifiers. if ([B]adminPW[/B] == Decrypt(EncryptedPass, EncryptionKey)) Password.cpp: Line 99
Again, you've supplied arguments that don't match the function. getline() takes a character for a delimiter, not a string. Alas. getline(in, NameCheck, [B]' '[/B]); This compiles and runs for me. I can't test further because I don't have your test input file, and my brain is too tired right now to read through your code to figure out what it should look like.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Or, if you happen to be running Windows, you'll need to google the RunOnce registry value or stick either your program or a link to it in the Startup folder of the start menu.

What you are trying to do is OS-specific. So, if you aren't running Win or Linux, then what OS are you using?

Duoas 1,025 Postaholic Featured Poster

I think what you are looking for is the overrideredirect flag. This tells the wm to buzz-off.

It is generally used for pop-up windows (like balloon pop-ups, menus, etc.).
It is generally a Bad Idea for use with your main application window.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

That using namespace std; is a bad idea in a header file. Keep it in cpp files.

The problem on line 28 is that C++ doesn't permit you to define sub-functions. Ideally, you should have a file named LISTS.cpp that looks like this:

#include "LISTS.h"

LIST::LIST()
{
  // my constructor here
}

...

Then in your main program (which I'll call "myprog.cpp"):

#include "LISTS.h"
using namespace std;

int main()
{
  LIST::LIST aList;  // Create a new list object named 'aList'

  ...
}

Compile normally:

D:\foo> gcc myprog.cpp LISTS.cpp

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Don't forget to readln inside the loop.

Duoas 1,025 Postaholic Featured Poster

How about you read the forum rules before you start making a fool of yourself?

My help to you has been exemplary. And more than you need.

Duoas 1,025 Postaholic Featured Poster

A good place to start actually is to force the input to take a certain form.

For example, you could say that input must be of the form: [B]-[/B][I]42[/I] [B]x ^[/B][B]-[/B][I]3[/I] where the '-' signs are optional (of course).

You could then just read assuming information is present:

istream& operator>> (istream& stream, Polynomial& poly)
{
    term t;  // You must declare a variable here...

    if (stream.peek() == '+') stream.get();  // skip any '+'s

    stream >> t.co;    // read the coefficient
    stream.get();      // read the 'x'
    stream.get();      // read the '^'
    stream >> t.expo;  // read the exponent

    poly.poly.push_back( t );

    return stream;
}

Now you can go back and add in stuff to check whether or not something is present.
For example, you can modify it to check to see if an exponent is there before trying to read one.
You can check to see whether an 'x' is there before trying to read it.

Then you can type terms of the form 3x instead of 3x^1 and -7 instead of -7x^0 .

Oh yeah, don't forget that in C++ you don't need to say struct term t; you can just say term t; but you must always name a variable. "term" is a type. "t" is a variable. Don't mix them.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

The Bloodshed Dev C++ is an IDE. It uses MinGW (GCC).

I personally like the GCC.
Stroustrup likes the Microsoft C++.
Borland C++ is good too (but not always the best at standards-compliance).

Enjoy.

Duoas 1,025 Postaholic Featured Poster

Is your other thread not good enough for you?

Duoas 1,025 Postaholic Featured Poster

You need to write three separate lines of text for each number, right? But all the numbers must be horizontally arranged? So, get yourself three string variables and set them to the empty string to begin with:

var s1, s2, s3: string;
begin
  s1 := '';
  s2 := '';
  s3 := '';

Now, each number routine (zero, one, two, etc.) can add itself to the end of the strings.

procedure zero;
  begin
  s1 := s1 +' _ ';
  s2 := s2 +'| |';
  s3 := s3 +'|_|'
  end;

When done, you can print the strings with writeln:

writeln( s1 );
  writeln( s2 );
  writeln( s3 );

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

In MAL, no. Just use sw $s2, B You really need to get yourself a good MIPS reference.
The one on Wikipedia is pretty good.

Duoas 1,025 Postaholic Featured Poster

How non-standard are you willing to go?

The standard way, you will have to re-write your program to take a whole number and create a string for each part of the number.

For example, if given the number '42', you would make the strings

1:  '      _ '
2:  ' |_|  _|'
3:  '   | |_ '

If your numbers are always three lines high, this is easy enough. Just adjust your functions to append the correct stuff to the end of the strings instead of using writeln.

Then, once you are done calling the zero, one, two, etc. functions, writeln each of the three strings to the screen.


BTW, use a case statement instead of a zillion ifs.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Getting input is probably going to be the toughest part of the assignment. For each term, you have to read something that looks like this (where green is optional) [B]-[/B] [I]12[/I] [B]x[/B] [B]^[/B][I]-2[/I] So, you might want to peek to see if there is a '-' or '+' sign, and make note of it. If there is, read it.

Then try to read a number.

Then the x.

Then check to see if there is a '^'. If so, read it and another number.

Now you have your two numbers. Adjust the first based on whether or not there was a '-' sign in front of it.

Stick your two numbers into a term struct, and push_back() the struct on your poly vector.

For trying to read those numbers, you may want to check out the fail() and clear() members of the input stream.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Sorry about that missing return 0; . Thanks twomers!

The reason I made a pause() function is two-fold:

  1. A regular cin.ignore(); is dangerous, because you don't know how it will leave the state of input. Remember, console input is usually line-buffered, meaning that the user must press ENTER at the end of everything he types.
    What if he presses some key other than ENTER?
  2. It explicitly instructs the user in what he is expected to do. A program that just stops is both non-obvious and frightening to users. If you ever run your program again a year from now, you'll understand. Having to re-read your own code to see why the program stopped, or why you had to press ENTER, is evidence of bad UI.

A good UI always tells the user exactly what is expected, then presumes that the user may do something stupid anyway. My pause() function does both.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Ahhh.... :D

Duoas 1,025 Postaholic Featured Poster

> sorry, i didnt read it properley

I do that all the time... :$

Duoas 1,025 Postaholic Featured Poster

More explicitly, even though int a[5]; and int *a; both declare a to be a pointer to an integer, the first is constant, meaning that you cannot change the value of a (it cannot be used as an lvalue).

You will save yourself some accidental grief if you keep different types of variables in different declarations. (It doesn't save that much space to combine them all together.)

int a[] = {10,20,30,40,50};  /* an array of int */
  int j;                       /* an int */
  int *p;                      /* a pointer to int */

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Umm, when did I mention other languages?

Perhaps I just agree with Ritchie and Stroustrup that main(void) is awful. That's my opinion, however.

My post was motivated on this: since int main() int main(void) are considered more-or-less equivalent (from our perspective, because they are most definitely not equivalent in actuality), and not all C compilers can trip through the second easily, why bother correcting correct code?

hey_shishir, sorry you've had to put-up with this. However, the forum announcements make it quite clear that we won't do your homework for you. You are plenty bright enough to think about how to test a number to see whether or not it is divisible by 3. Give it your best shot, and if it still doesn't work right, post back here with what you have got and we'll help you fix it.

Duoas 1,025 Postaholic Featured Poster

iamthwee, you've missed the point.

The OP's Polynomial class is based on a vector of term structs. (He made this change in his second post.) Each term in a polynomial (which he represents with the struct term) has exactly one coefficient and one exponent.

I am full aware that there are many ways to solve this problem. The problem with the link you provided is two-fold:

  1. it doesn't match the structure the OP uses; the link uses a fixed array of terms, the OP does not.
  2. it gives away an answer for free; if the OP were to use it he would learn nothing (and as a professor I would fail him for cheating)

I wasn't criticizing you. I would rather help the OP figure out his problem in his own way rather than re-design his code for him. That's all.

Duoas 1,025 Postaholic Featured Poster

Exactly.

You should actually call finish() no matter what. But it only needs to do something if count is 1 or 2.

Duoas 1,025 Postaholic Featured Poster

C was designed with the BCPL concept that the programmer knows what he is doing, even if he wants to shoot himself in the foot (or, in C++, blow his whole leg away).

This design structure led to the problem is that it is not always possible to keep track of where the array ends. Consider:

#include <stdio.h>

void print( char string[], int length ) {
  int i;
  for (i = 0; i < length; i++)
    putchar( string[ i ] );
  }

int main() {
  char salutation[] = "Hello world!";
  print( salutation, 500 );
  return 0;
  }

If you compile and run this code you'll probably get a segmentation fault (a memory access violation).

Inside main(), the compiler knows that salutation shouldn't be indexed past 12, and any attempt to do so should result in a compile-time error.

However, once you pass it off to print(), you've thrown away all the information about the actual size of the array. You could easily call print() many times, each time with a different array of a different length.

Predictably, char string[] is really the same as char *string . The compiler has no way of knowing how long the array addressed by string[] is. It relies entirely upon you, the programmer, to make sure that you don't go too far.

So, in C languages (that includes C++), it is the programmer's responsibility to make sure he/she never permits array overruns.


It is entirely …

Duoas 1,025 Postaholic Featured Poster

Please pay attention.

I said that your professor should have given you an array of three unsigned chars: unsigned char c[ 3 ]; What he actually gave you was three distinct chars: char c1, c2, c3; In both cases, you have three chars that you need to fill before you can use E(k). Everytime the user uses output(plaintext[current_index]); then the output() method should place x's value into one of c1, c2, or c3. Which one it is depends on count.

Think about it:

c[0]   c[1]   c[2]
c1     c2     c3       <-- one of these gets the value in [B]x[/B]

If count is zero, then c1 gets the value.
If count is one, then c2 gets the value.
Et cetera.

So, what do you do when all the c's have values (that is, what do you do when count becomes three)?

Duoas 1,025 Postaholic Featured Poster

I know nothing about APPE. Everything I found online refers to weaves and knits... ???

In any case, it appears to be a server error. Check that the server you are connecting to actually supports APPE. (I know Medusa doesn't.)

If you actually know what half this means, you know more than I.

Duoas 1,025 Postaholic Featured Poster

Yes, it is the same. And (at least by what I see now) his code does start with randomize.

In computers, there is no such thing as a truly random number. Delphi's random number generator is notoriously wimpy.

You'll have to google "delphi random number generator" or something similar for a better answer.

Good luck.

Duoas 1,025 Postaholic Featured Poster

c[] is an array.
x is not.

Duoas 1,025 Postaholic Featured Poster

...and main( void ) is a C99 monstrosity.

Duoas 1,025 Postaholic Featured Poster

iamthwee, how do you get more than one coefficient per term? His struct is fine as is.

Also, the sort() method is not redundant. I called it "normalize", but the thing it does is about the same. By having a routine that normalizes/sorts the polynomial, other activities become a lot easier.

orangejuice2005, you'll have to give me a day to look over your latest. My brain needs sleep now...

Duoas 1,025 Postaholic Featured Poster

Uh, no. The char x is just a char, not an array of char.

Duoas 1,025 Postaholic Featured Poster

MIPS assembly language is confusingly structured into SAL, MAL, and TAL modes. I will assume MAL (based on your latest code). Your professor should have mentioned what you have been using so far.

You are getting an error because you can't have a reference to memory in an add instruction. Everything to be added must be in stored registers. The last thing to be added may be a constant (or "immediate", like 12). So, add $t0, $a0, $a1 is OK, as is add $t0, $a0, 12 However add $t0, 4($a0), $a0 is not, because you are trying to reference memory.

You need to be very careful of what the values in a register mean. For each register, are you using it to hold a number or an address? It makes a difference. Hence, add $t0, 4($a0), $a0 makes no sense, since you are trying to add a value stored at (address $a0+4) to the (value $a0). The register $a0 should be treated as either a number or an address, but not both.

Be careful to remember that in MIPS assembly, the register used to store the arithmetic result is always listed first. Hence, add $t0, $t1, $t2 means
$t0 := $t1 + $t2

Finally, you'll need to get the address of the array A before you can use lw and sw. Example:

.data
x: .word 98, 3

.text
main:
	la	$t0, x		# $t0 := address of x[]
	lw	$s0, 0($t0)	# $s0 := value of …
Duoas 1,025 Postaholic Featured Poster

The loop belongs in main(), and each time through the loop you need to call output() once.

In the output() method there should not be any loops. I think the assignment would have been more clear had your professor named c1, c2, and c3 as unsigned char c[ 3 ]; So inside output() you can set c[ count ] = x; and count++; Then, if count > 2 you need to encrypt the c[0], c[1], and c[2] (or, as your professor has named them, c1, c2, and c3, and reset count to 0.

Hope this helps.

kylcrow commented: Extremely patient and helpful. Thanks again. +1
Duoas 1,025 Postaholic Featured Poster

You can tell because it is looking for a function that takes two arguments, both (std::string&)s.
However, the documentation for strstr() says that each argument must be a (char *).

Fix it by extracting the (char *)s from the (std::string)s: a=strstr(string1.c_str(), string2.c_str()); There is, BTW, a C++ way to do this: int index = string1.find( string2, 0 ); This way is better (and safer).

Also, don't use system("PAUSE") if you can avoid it. Look here.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

That depends on whether or not you are using SAL.

Duoas 1,025 Postaholic Featured Poster

How many bits fit in a byte? How many bits to you need for a block to encrypt?

[ p1 ][ p2 ][ p3 ]

Each 'slot' or 'bin' or 'byte' holds a character of the plaintext.

For example:

Imagination is more important than knowledge... --Albert Einstein
123123123123...

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Are you using SAL (or are you supposed to be using MAL or TAL)? I'll assume SAL.

Remember that the result is stored in the first item listed. For example: add $t0, $a0, 12 adds the value of register a0 and the value 12 together, and stores the result in register t0.

Your math looks good. Add A[0] and A[1], then subtract 6. Just work on getting the instructions written correctly.

Once you have loaded the answer in to register t1, you can store the result in B. move B, $t1 You can prove that B has the correct value by printing it put B Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Consider how a block cipher works. In this case, you need three inputs to apply the encryption.

I presume (and hope) that your professor has covered a block cipher in class. As you haven't described the cipher here, I'll just pretend that you know how to use it.

So, you have three slots that need to be filled before the encryption can be done. Your professor has named them c1, c2, and c3. Your professor has also provided you with a way to keep count of how many slots are filled.

The plaintext is output one character at a time. Every output() should fill the next slot. Once the slots are filled, encrypt them, output the result, and clear the slots for use again.

The finish() should take care of the case that there are only one or two slots filled when you run out of plaintext to output(). Therefore, finish() should supply the appropriate values for the unfilled slots and encrypt and output as usual. What should finish() do if there are zero slots filled when it is called? Think about it.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Heh, I appreciate your efforts to help.

Alas, I've done both things suggested in those threads.

The dpkg-reconfigure script is useful for changing to a pre-defined keyboard layout.
The install-keymap script is rather crude, and puts the result in the wrong place anyway...
:-/

Fooey. :confused:

Duoas 1,025 Postaholic Featured Poster

Start small and work your way up. For example, you could start with just creating and displaying a polynomial. Then you could add a method to read a polynomial. Then add polynomials. Etc. Each step of the way test it out in main(). Once you are done, you can move the stuff into separate .h and .cpp files.

The introduction of a term class was brilliant! Good job!

I removed the initialize() method (it won't work and you don't need it).
The sort() method is not a constructor.
I've also renamed get_term() to number_of_terms(), as a more descriptive name.
Don't forget to end a struct or class type with a semicolon.

Also, indentation and formatting will help considerably when you read your code. For example:
[code=C++]

//------------------------------------------------
// The stuff that follows would go in your Poly.h
// file when you are done testing it

#include <iostream>
#include <vector>
using namespace std;

struct term
{
	int co;
	int expo;
};

class Polynomial
{
	friend istream& operator>> (istream& stream, Polynomial& poly);
	friend ostream& operator<< (ostream& stream, Polynomial& poly);

	public:

		// The list of terms in the polynomial
		// (not necessarily ordered)
		vector<term> poly;

		// default constructor
		Polynomial();
		
		// empties the polynomial of all terms
		void reset();

		// sort the terms from the highest to lowest exponent
		void sort();

		// add two polynomials
		Polynomial operator+( const Polynomial& p );

		// returns the number of terms in the polynomial
		int number_of_terms();
};

//------------------------------------------------
// The …
Dukane commented: excellent response +2
orangejuice2005 commented: Thnx for the continued support and patience! +1
Duoas 1,025 Postaholic Featured Poster

On lines 7 and 9 you forgot to say [b]p1.[/b]coef.begin() , etc.

Line 17 should have a == , not a = .

Your iterators have terrible names. Try
iter --> icoef1
iter2 --> iexpo1
iter3 --> icoef2
iter4 --> iexpo2
This will help.

Now, just remember, every time you increment an iterator to p1 you have to increment both.

if (I want to see the next term in p1) {
  icoef1++;
  iexpo1++;
  }

Likewise for p2's iterators.

Now you'll have to think about how to loop through the polynomials. Remember, you can only sum terms that have the same exponent. Are your polynomials stored in canonical form? (Meaning, that exponents start high and get smaller left to right, as: 4x^4 + 2x^2 - 7x ? How you find matching terms will be easier if it is.)

You will have to find matching exponents and add the coefficients, then push_back() the resulting coef/expo values in p3.

Hope this helps.

(Personally, I would forget the hard stuff and just make a routine that normalizes a polynomial. For example, given 4x^2 +3 and 2x^4 +2x^2 -7 , you could just concatenate the two into one: 4x^2 +3 +2x^4 +2x^2 -7 then normalize it into: 2x^4 +6x^2 -4 )