Note: I am not native English speaker so please ignore any grammatical mistake. My main goal is efficiency, code cleanness and code maintainability. Is there any commonly used Algorithm for this problem? Variable variable2 = new Variable("x", 3.0, 4.0) Įquation equation = new Equation(variable) Įquation.addVariable(variable1, true) //2x+xįor (int i = 0 i < 1000000 i++)equation.solveFor(i) //Calculate Million Data Points Variable variable1 = new Variable("x", -2.0, 1.0) If ((i))builder.append("*").append(var.toString()) Final Point: Thanks to the linear interpolation calculator for finding the unknown data point for given coordinates and plot the point on graphs. However, an interpolator can be used to make quick and accurate predictions. If (entryIterator.hasNext())builder.append(entryIterator.next().getValue().toString()) At this point, there is a jump in the prediction to the most precise value that was first measured. StringBuilder builder = new StringBuilder() If ((i))ans *= var.getCoefficient() * Math.pow(x, var.getPow()) Įlse ans += var.getCoefficient() * Math.pow(x, var.getPow()) Iterator> entryIterator = ().iterator() Īns = var.getCoefficient() * Math.pow(x, var.getPow()) įor (int i = 0 entryIterator.hasNext() i++) If (typesOfVariables > 1)throw new IllegalArgumentException("provide values for all variables") *Value for every variable at any point will be different*/ * Collision chances for variables with same name but Variable newVar = new Variable(var.getSymbol(), var.getCoefficient() * variable.getCoefficient(), var.getPow() + variable.getPow()) Variable var = variableHashMap.get(variable.getSymbol()) If (multiply & ntainsKey(variable.getSymbol())) * 2: variable which are wrapped inside functions e.g sin(x) * 1: Add two variables which have same name Public void addVariable(Variable variable, boolean multiply) String expr = "2*x+3*x" Įvaluator evaluator = new Evaluator() //I have this class I have two solutions in mindġ: This is trivial and I have seen in many Applications. I want efficient algorithm, easy to use and easy to maintain data structures. I am trying to generate Data Points for graph from an equation given by user. I don't want to solve an equation and my question is not about Graphs and Trees Data Structures.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |