求解代数方程的思维过程?

发布于 2024-10-08 18:22:48 字数 429 浏览 4 评论 0原文

我正在开发一个图形应用程序,该应用程序基本上在 HTML5 画布上绘制方程式。我可以毫无问题地绘制符合 y=3x^(2) 等的方程。这就像插入给定的 x 值、用指数替换本机函数一样简单,瞧!

然而,理想情况下,我想绘制圆方程和其他不一定以 y=... 开头的方程。这需要实际做代数,不幸的是,这并不容易。我的问题是:解决诸如 3x+3y=15 这样的问题最合乎逻辑的方法是什么?假设我得到了一个x并且我正在求解y。您将如何创建一个函数来解决这个问题?

显然,我可以选择效率极低的方式循环遍历 y 值,直到找到满足方程的值,但让我们尽量避免这种情况。

我不是要求你为我编写脚本,我只是要求最好/最有效的思维过程来开始。

目前,该项目正在用 Javascript 编写。

谢谢!

I'm working on a graphing applications that basically graphs equations with on an HTML5 canvas. I had no problem graphing equations that were along the lines of y=3x^(2) etc. That was as easy as plugging in a given x value, substituting exponents for native functions and voila!

Ideally however, I'd like to graph equations for circles and other equations that don't necessarily start with y=.... This would require actually doing algebra, which, unfortunately is not so easy. My question is: what is the most logical way to solve a problem such as 3x+3y=15? Let's assume that I'm given an x and I'm solving for y. How would you go about creating a function that solves it?

Obviously, I could choose to be extremely inefficient and loop through y values until I find one that satisfies the equation, but let's try to avoid that.

I'm not asking for you to write the script for me, I'm just asking for the best/most efficient thought-process to get started.

Currently, this project is being written in Javascript.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

老旧海报 2024-10-15 18:22:54

您要查找的内容的正确名称:http://en.wikipedia.org/wiki/Computer_algebra_system

The proper name for what you are looking for: http://en.wikipedia.org/wiki/Computer_algebra_system

她如夕阳 2024-10-15 18:22:53

y=3x^(2) 不是线性的,它的二次方,3x+3y=15 实际上是线性的。

这取决于您想要达到的复杂程度,编写一些东西来将诸如 3x+3y=15 这样的线性方程重新排列成其标准线性形式 (y=5-xy=5-x3x+3y=15 /code>),但它变得越来越难,虽然可能有服务器端库,但我不确定 JS。

y=3x^(2) is not linear its quadatric, 3x+3y=15 is in fact linear.

It depends on how complex you want to go, it's not that challenging to write something to rearrange a linear equation like 3x+3y=15 into its standard linear form (y=5-x), but it gets harder fast and while there are probably server side libraries for it, i'm not sure about JS.

青衫儰鉨ミ守葔 2024-10-15 18:22:52

一种(近似数字)方法是将您的方程重写为 P(x) = 0 [在您的情况下 P(x) = 3(x^2) + 3(y^2) - 15] 然后使用诸如Newton-Raphson之类的数值技术来求 P(x) 的根

如果您想要以符号方式求解,则需要计算机代数系统(CAS)(非常重要)。

One (approximate numerical) way is to take your equation re-write it as P(x) = 0 [in your case P(x) = 3(x^2) + 3(y^2) - 15] and then use a numerical technique such as Newton-Raphson to find the roots of P(x)

If you want to solve symbolically, then a Computer Algebra System (CAS) is required (non-trivial).

墨洒年华 2024-10-15 18:22:52

通常,您会在等号一侧使用一个变量,在另一侧使用另一个变量来表达方程。

如果您想根据随机用户输入重写方程,则需要某种解析引擎。

请查看此处进行讨论

usually you would express the equation with one variable on one side of the equals sign and the other variable on the other.

If you want to rewrite equations form random user input, you will need some kind of parsing engine.

look here for a discussion

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文