画函数图像的计算器
想编一个画函数图像的计算器,把输入的String转化为公式,然后画图。
可以不清楚如何转化,要用Stack吗?如果有朋友可以帮忙,非常感谢~
------解决方案--------------------画图像跟计算器扯不上关系吧?
------解决方案--------------------I think you may have to write a parser.
1, Define function formats.
2, Parse the function string and represent it using Java objects.
3, Plot the graph.
For example, let 's define polynomial function
f(x) = 5 * x^5 + 3 * x^3 + 2 * x^2 - 100;
You may use a List to represent those coefficients of the function. In the above example, those coefficients may be like this; {-100, 0, 2, 3, 0, 5}, corresponding to x^0, x^1, x^2, x^3, x^4, x^5.
After that, you have to plot the graph.