从两点找到所有可能的二次方程 [英] Finding all possible quadratic equations from two points

查看:144
本文介绍了从两点找到所有可能的二次方程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到在特定情况下可以找到的所有可能的二次方程.

在这种情况下,有两个静态笛卡尔点,然后有一个动态整数值.这两个点是所有二次方程式都必须经过的点才能合格,并且整数值会改变函数的形状,从而改变形状.我的意思的示例可以在这里找到:

https://jsfiddle.net/4o5pch1q/4/

现在,我有这些系数的等式:

xtwo = (75 - slider) / 50;
xone = (slider - 25) / 50;
xzero = (slider - 25) / 25;

但是我需要一个更具适应性的方程式

基本上,我想找到一个表达所有可以从上述情况下找到的方程的通用方程.

这是我到目前为止所拥有的:

a * x 1 2 + b * x 1 + c = 0

a * x 2 2 + b * x 2 + c = 0

a * x 1 2 + b * x 1 = a * x 2 2 + b * x 2

b = a *(x 1 2 -x 2 2 )/(x 2 -x 1 )

a * x 1 2 + a *(x 1 2 -x 2 2 )/(x 2 -x 1 )* x 1 + c = 0

但这似乎无处可做.

解决方案

抛物线函数(带有垂直轴)的一般形式为

f(x) = ax² + bx + c

您强加点(x₁,y₁)(x₂,y₂)必须属于该函数的图.

也就是说,

y₁ = ax₁² + bx₁ + c
y₂ = ax₂² + bx₂ + c

我们从中获得

c = y₁ - ax₁² - bx₁
y₂ = ax₂² + bx₂ + (y₁ - ax₁² - bx₁) = a(x₂²-x₁²) + b(x₂-x₁) + y₁

有了这个限制,我们可以摆脱参数bc:

    y₂ - y₁ - a(x₂² - x₁²)   y₂-y₁
b = ────────────────────── = ───── - a(x₁+x₂)
           x₂ - x₁           x₂-x₁

                y₂-y₁                       y₂-y₁
c = y₁ - ax₁² - ─────x₁ + a(x₁+x₂)x₁ = y₁ - ─────x₁ + ax₁x₂
                x₂-x₁                       x₂-x₁

所以我们有

             ┌ y₂-y₁            ┐                y₂-y₁
f(x) = ax² + │ ───── - a(x₁+x₂) │x + y₁ - ax₁² - ─────x₁ + a(x₁+x₂)x₁
             └ x₂-x₁            ┘                x₂-x₁ 

简单一点,

       ┌          y₂-y₁ ┐                
f(x) = │a(x-x₂) + ───── │(x-x₁) + y₁
       └          x₂-x₁ ┘                

变化a您将获得所有可能的功能.

I'm trying to find all of the possible quadratic equations that can be found within a certain scenario.

In this scenario, there are two static Cartesian points, and then there is a dynamic integer value. The two points are points that all quadratic equations must go through in order to qualify, and the integer value changes something in the function that changes the shape. An example of what I mean can be found here:

https://jsfiddle.net/4o5pch1q/4/

Right now, I have these equations for the coefficients:

xtwo = (75 - slider) / 50;
xone = (slider - 25) / 50;
xzero = (slider - 25) / 25;

but I need a more adaptable equation

Basically, I want to find the general equation that expresses all equations that can be found from the above scenario, please.

Here's what I have so far:

a * x12 + b * x1 + c = 0

a * x22 + b * x2 + c = 0

a * x12 + b * x1 = a * x22 + b * x2

b = a * (x12 - x22) / (x2 - x1)

a * x12 + a * (x12 - x22) / (x2 - x1) * x1 + c = 0

But that doesn't seem to lead anywhere.

解决方案

The general form of the parabolic functions (with a vertical axis) is

f(x) = ax² + bx + c

You impose that the points (x₁,y₁) and (x₂,y₂) must belong to the graph of the function.

That is,

y₁ = ax₁² + bx₁ + c
y₂ = ax₂² + bx₂ + c

From these we obtain

c = y₁ - ax₁² - bx₁
y₂ = ax₂² + bx₂ + (y₁ - ax₁² - bx₁) = a(x₂²-x₁²) + b(x₂-x₁) + y₁

With that restrictions, we can get rid of the parameters b and c:

    y₂ - y₁ - a(x₂² - x₁²)   y₂-y₁
b = ────────────────────── = ───── - a(x₁+x₂)
           x₂ - x₁           x₂-x₁

                y₂-y₁                       y₂-y₁
c = y₁ - ax₁² - ─────x₁ + a(x₁+x₂)x₁ = y₁ - ─────x₁ + ax₁x₂
                x₂-x₁                       x₂-x₁

So we have

             ┌ y₂-y₁            ┐                y₂-y₁
f(x) = ax² + │ ───── - a(x₁+x₂) │x + y₁ - ax₁² - ─────x₁ + a(x₁+x₂)x₁
             └ x₂-x₁            ┘                x₂-x₁ 

Simplifying a little,

       ┌          y₂-y₁ ┐                
f(x) = │a(x-x₂) + ───── │(x-x₁) + y₁
       └          x₂-x₁ ┘                

Varying a you get all the possible functions.

这篇关于从两点找到所有可能的二次方程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆