Welcome to my Java Computer Algebra System! This began as a High School senior project. It has the ability to parse mathematical expressions into callable functions, perform exact derivative calculation, create vectors and vector functions, and apply precise functional analysis.
- MathBlock- used to store mathematical expressions
- Point - used to store points
- Relationship - used to store equations and inequalities
- mathFrom - generates MathBlocks (integrated into MathBlock)
- Vector - used to store either 2d or 3d vectors
- VectorFunc - used to store vector/parametric functions in either 2d or 3d spaces
Generates a MathBlock from a string representing a mathematical expression. MathBlock the following operators: +, -, *, /, sin(), cos(), tan(), sec(), cot(), csc(), cot(), and ln().
Examples of MathBlock strings:
"5*x"
"sin(2^x)*ln(x)"
"sin(cos(tan(sec(cot(csc(10))))))" (I mean, if you really wanted to)
Generates an empty MathBlock
Returns a copy of the MathBlock, dereferenced from the original MathBlock. Similar to clone() methods.
Returns a float that represents the value of a MathBlock. Will return error if the MathBlock contains a variable.
Puts a printout to the console that shows the structure of the MathBlock.
Returns a String representing the primary operator of a MathBlock. Throws an error for MathBlocks without a primary operator.
Returns a String that represents the MathBlock. Differs from value() in that it shows the expression, not the result. Differs from reveal() in that it is not verbose.
Prints asString() on the console.
Returns a MathBlock that represents the derivative of the MathBlock in question. Wrt represents the variable to differentiate the MathBlock by.
Returns the derivative of the MathBlock with respect to x.
Returns true if and only if the MathBlock does not contain any variables (i.e., if result() can be used).
Returns a MathBlock that is a simplified, equivalent version of the original MathBlock. DOES NOT MUTATE THE ORIGINAL MATHBLOCK.
Returns a MathBlock that is a simplified, equivalent version of the original MathBlock. Also mutates the original MathBlock to that simplified value.
Replaces all instances of variable var with the number, number.
Finds the result of a function at a certain value for a certain variable, essentially finding a point on the function at a certain x-value. MathBlock must be resolvable other than the wrt variable.
Returns an ArrayList of point classes, representing the approximate zeros of the function on the variable wrt on the interval between min and max. MathBlock must be resolvable other than the wrt variable.
Finds the approximate maximum value of the function on the interval from min to max. If the min>max, an error is thrown. MathBlock must be resolvable other than the wrt variable.
Finds the approximate minimum value of the function on the interval from min to max. If the min>max, an error is thrown. MathBlock must be resolvable other than the wrt variable.
Approximates the integral of the function along the variable wrt on the interval greater than min and less than max. MathBlock must be resolvable other than the wrt variable.
Constructs a Point class at a certain x and y value
Calculates the r value of the polar representation of a point
Calculates the theta value of the polar representation of a point
Returns true if and only if the point is a zero.
Returns true if the point is within a certain threshold of being a zero.
Returns a String representation of the point.
Calculates the value of the point on an arbitrary curvilinear system, where wrt1 is the x-equivalent and wrt2 is the y-equivalent. The curvilinear value must be between min and max, otherwise an error will be thrown. If the min>max, an error is thrown.
Generates a 2 dimensional vector.
Generates a 3 dimensional vector.
Returns a copy of the Vector, dereferenced from the original Vector. Similar to clone() methods.
Returns the magnitude of the vector.
Returns the square the magnitude of the vector.
Returns a string that represents the vector.
Adds a second vector to the original.
Subtracts a second vector from the original.
Multiplies the vector by a scalar.
Divides the vector by a scalar.
Returns the dot product of the original vector and another.
Returns the cross product of the original vector and another.
Returns a normalized vector in the same direction with a magnitude of 1.
Returns a rotated copy of the original vector. The vector is rotated in the XY plane.
Generates a 3D vector function.
Generates a 2D vector function.
Returns a copy of the VectorFunc, dereferenced from the original VectorFunc. Similar to clone() methods.
Returns a string representing the VectorFunc.
Returns the vector result at a specified value of the function.
Returns the derivative of the vector function with respect to the variable wrt.
Returns the length of the vector function with respect to a certain variable along the interval greater than min and less than max.
Determines if the relationship describes is true or not.