Package math.matrix.util
Class LinearSystemGenerator
java.lang.Object
math.matrix.util.LinearSystemGenerator
Objects of this class have the ability to generate a
system of linear equations, randomly.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
The absolute value of the largest possible number that may be found in the system.private int
The number of unknowns in the system.private String
The letter of alphabet that will start the name of the variables that will be used to build the linear system. -
Constructor Summary
ConstructorsConstructorDescriptionLinearSystemGenerator
(int size, int maximumPossibleNumberInSystem, String startingLetterOfUnknownName) -
Method Summary
Modifier and TypeMethodDescriptionprivate String
Builds the liinear system.private double
int
int
getSize()
static void
void
setMaximumPossibleNumberInSystem
(int maximumPossibleNumberInSystem) void
setSize
(int size) void
setStartingLetterOfUnknownName
(String startingLetterOfUnknownName)
-
Field Details
-
maximumPossibleNumberInSystem
private int maximumPossibleNumberInSystemThe absolute value of the largest possible number that may be found in the system. -
size
private int sizeThe number of unknowns in the system. -
startingLetterOfUnknownName
The letter of alphabet that will start the name of the variables that will be used to build the linear system. The system will geerate the variables as x1,x2...... where x is any uppercase or lowercase letter of the alphabet
-
-
Constructor Details
-
LinearSystemGenerator
public LinearSystemGenerator(int size, int maximumPossibleNumberInSystem, String startingLetterOfUnknownName) - Parameters:
size
- The number of unknowns that the system will have.maximumPossibleNumberInSystem
- The absolute value of the largest possible number that may be found in the system.startingLetterOfUnknownName
- The letter of the alphabet that will start the name of the unknown.
-
-
Method Details
-
setStartingLetterOfUnknownName
-
getStartingLetterOfUnknownName
-
setSize
public void setSize(int size) -
getSize
public int getSize() -
setMaximumPossibleNumberInSystem
public void setMaximumPossibleNumberInSystem(int maximumPossibleNumberInSystem) -
getMaximumPossibleNumberInSystem
public int getMaximumPossibleNumberInSystem() -
generateUnknowns
- Returns:
- an ArrayList containing the unknowns
-
generateCoefficient
private double generateCoefficient()- Returns:
- a double number randomly generated.
-
buildSystem
Builds the liinear system.- Returns:
- the system after build
-
main
-