في التحليل العددي ، طريقة هورنر ، أو مخطط هورنر ، أو خوارزمية هورنر على إسم وليام جورج هورنر ، هي خوارزمية فعالة لتقييم كثيرات الحدود ومشتقاتها عند نقطة معينة في شكل أحادية حدود . تصف طريقة هورنر عملية يدوية يمكن بواسطتها تقريب جذور معادلة كثيرة حدوود. يمكن النظر لمخطط هورنر أيضا على أنه خواريزم سريع لقسمة كثيرة حدود على كثيرة حدود خطية بقاعدة روفيني .
هذه الطرق مسماة على اسم الرياضياتي البريطاني وليام جورج هورنر ، بالرغم من أنهن كن معروفات قبله من پاولو روفيني [1] ، وقبل ستمائة عام، من الرياضياتي الصيني چين جيوشاو [2] وقبل سبعمائة عام من الرياضياتي الفارسي شرف الدين الطوسي .[3]
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
وصف الخوارزم
لتكن دالة كثيرة الحدود
p
(
x
)
=
a
0
+
a
1
x
+
a
2
x
2
+
a
3
x
3
+
⋯
+
a
n
x
n
,
𝑝
𝑥
subscript
𝑎
0
subscript
𝑎
1
𝑥
subscript
𝑎
2
superscript
𝑥
2
subscript
𝑎
3
superscript
𝑥
3
⋯
subscript
𝑎
𝑛
superscript
𝑥
𝑛
{\displaystyle{\displaystyle p(x)=a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+\cdots+a_%
{n}x^{n},}}
حيث
a
0
,
…
,
a
n
subscript
𝑎
0
…
subscript
𝑎
𝑛
{\displaystyle{\displaystyle a_{0},\ldots,a_{n}}}
أعداد حقيقية, يراد بها حساب متعددة الحدود عن قيم معينة x , ولتكن x 0 .
لفعل ذلك, يتم تعريف تعاقب جديد من الثوابت كما يلي:
b
n
:=
a
n
b
n
-
1
:=
a
n
-
1
+
b
n
x
0
⋮
b
0
:=
a
0
+
b
1
x
0
.
subscript
𝑏
𝑛
assign
absent
subscript
𝑎
𝑛
subscript
𝑏
𝑛
1
assign
absent
subscript
𝑎
𝑛
1
subscript
𝑏
𝑛
subscript
𝑥
0
missing-subexpression
⋮
subscript
𝑏
0
assign
absent
subscript
𝑎
0
subscript
𝑏
1
subscript
𝑥
0
{\displaystyle{\displaystyle{\begin{aligned} \displaystyle b_{n}&\displaystyle%
:=a_{n}\\
\displaystyle b_{n-1}&\displaystyle:=a_{n-1}+b_{n}x_{0}\\
&\displaystyle{}\ \ \vdots\\
\displaystyle b_{0}&\displaystyle:=a_{0}+b_{1}x_{0}.\end{aligned}}}}
حينئذ b 0 هي قيمة p (x 0 ).
لمعرفة سبب عمل هذا, لاحظ أن بالإمكان كتابة كثيرةالحدود على الصورة
p
(
x
)
=
a
0
+
x
(
a
1
+
x
(
a
2
+
⋯
+
x
(
a
n
-
1
+
a
n
x
)
⋯
)
)
.
𝑝
𝑥
subscript
𝑎
0
𝑥
subscript
𝑎
1
𝑥
subscript
𝑎
2
⋯
𝑥
subscript
𝑎
𝑛
1
subscript
𝑎
𝑛
𝑥
⋯
{\displaystyle{\displaystyle p(x)=a_{0}+x(a_{1}+x(a_{2}+\cdots+x(a_{n-1}+a_{n}%
x)\cdots)).\,}}
وبالتالي, وبالتعويض المتتابع لـ
b
i
subscript
𝑏
𝑖
{\displaystyle{\displaystyle b_{i}}}
في التعبير,
p
(
x
0
)
=
a
0
+
x
0
(
a
1
+
x
0
(
a
2
+
⋯
x
0
(
a
n
-
1
+
b
n
x
0
)
⋯
)
)
=
a
0
+
x
0
(
a
1
+
x
0
(
a
2
+
⋯
x
0
(
b
n
-
1
)
…
)
)
⋮
=
a
0
+
x
0
(
b
1
)
=
b
0
.
𝑝
subscript
𝑥
0
absent
subscript
𝑎
0
subscript
𝑥
0
subscript
𝑎
1
subscript
𝑥
0
subscript
𝑎
2
⋯
subscript
𝑥
0
subscript
𝑎
𝑛
1
subscript
𝑏
𝑛
subscript
𝑥
0
⋯
missing-subexpression
absent
subscript
𝑎
0
subscript
𝑥
0
subscript
𝑎
1
subscript
𝑥
0
subscript
𝑎
2
⋯
subscript
𝑥
0
subscript
𝑏
𝑛
1
…
missing-subexpression
⋮
missing-subexpression
absent
subscript
𝑎
0
subscript
𝑥
0
subscript
𝑏
1
missing-subexpression
absent
subscript
𝑏
0
{\displaystyle{\displaystyle{\begin{aligned} \displaystyle p(x_{0})&%
\displaystyle=a_{0}+x_{0}(a_{1}+x_{0}(a_{2}+\cdots x_{0}(a_{n-1}+b_{n}x_{0})%
\cdots))\\
&\displaystyle=a_{0}+x_{0}(a_{1}+x_{0}(a_{2}+\cdots x_{0}(b_{n-1})\dots))\\
&\displaystyle{}\ \ \vdots\\
&\displaystyle=a_{0}+x_{0}(b_{1})\\
&\displaystyle=b_{0}.\end{aligned}}}}
أمثلة
قيم
f
1
(
x
)
=
2
x
3
-
6
x
2
+
2
x
-
1
subscript
𝑓
1
𝑥
2
superscript
𝑥
3
6
superscript
𝑥
2
2
𝑥
1
{\displaystyle{\displaystyle f_{1}(x)=2x^{3}-6x^{2}+2x-1\,}}
لأجل
x
=
3
𝑥
3
{\displaystyle{\displaystyle x=3\;}}
. بإخراج معاملات
x
𝑥
{\displaystyle{\displaystyle x}}
, تتابعيا، يمكن كتابة
f
1
subscript
𝑓
1
{\displaystyle{\displaystyle f_{1}}}
بالصورة
x
(
x
(
2
x
-
6
)
+
2
)
-
1
𝑥
𝑥
2
𝑥
6
2
1
{\displaystyle{\displaystyle x(x(2x-6)+2)-1\;}}
. باستعمال شكل اصطناعي لترتيب هذه الحسابات وتسريع العمليات
x
0
subscript
𝑥
0
{\displaystyle{\displaystyle x_{0}}}
|
x
3
superscript
𝑥
3
{\displaystyle{\displaystyle x^{3}}}
x
2
superscript
𝑥
2
{\displaystyle{\displaystyle x^{2}}}
x
1
superscript
𝑥
1
{\displaystyle{\displaystyle x^{1}}}
x
0
superscript
𝑥
0
{\displaystyle{\displaystyle x^{0}}}
3 | 2 -6 2 -1
| 6 0 6
|----------------------
2 0 2 5
مدخلات الصف الثالث هي مجموع المدخلات في الصفين الأول والثاني. كل مدخل في الصف الثاني يكون نتاج ضرب قيمة x (3 في هذا المثال( بمدخل الصف الثالث مباشرة إلى اليسار. المدخلات في الصف الأول هي معاملات كثيرة الحدود المراد حسابها. الجواب هو 5.
وكنتيجة لنظرية باقي كثيرة الحدود ، تكون مدخلات الصف الثالث هي معاملات كثيرة الحدود من الدرجة الثانية التي هي حاصل قسمة f1 /(x-3). الباقي هو 5. هذا يجعل طريقة هورنر مفيدة في قسمة كثيرة الحدود المطولة .
بقسمة
x
3
-
6
x
2
+
11
x
-
6
superscript
𝑥
3
6
superscript
𝑥
2
11
𝑥
6
{\displaystyle{\displaystyle x^{3}-6x^{2}+11x-6\,}}
على
x
-
2
𝑥
2
{\displaystyle{\displaystyle x-2}}
:
2 | 1 -6 11 -6
| 2 -8 6
|----------------------
1 -4 3 0
يكون حاصل القسمة
x
2
-
4
x
+
3
superscript
𝑥
2
4
𝑥
3
{\displaystyle{\displaystyle x^{2}-4x+3}}
.
لتكن
f
1
(
x
)
=
4
x
4
-
6
x
3
+
3
x
-
5
subscript
𝑓
1
𝑥
4
superscript
𝑥
4
6
superscript
𝑥
3
3
𝑥
5
{\displaystyle{\displaystyle f_{1}(x)=4x^{4}-6x^{3}+3x-5\,}}
و
f
2
(
x
)
=
2
x
-
1
subscript
𝑓
2
𝑥
2
𝑥
1
{\displaystyle{\displaystyle f_{2}(x)=2x-1\,}}
. بقسمة
f
1
(
x
)
subscript
𝑓
1
𝑥
{\displaystyle{\displaystyle f_{1}(x)\,}}
على
f
2
(
x
)
subscript
𝑓
2
𝑥
{\displaystyle{\displaystyle f_{2}\,(x)}}
باستعمال مخطط هورنر.
2 | 4 -6 0 3 | -5
---------------------------|------
1 | 2 -2 -1 | 1
| |
|----------------------|-------
2 -2 -1 1 | -4
الصف الثالث هو مجموع الصفين الأول والثاني، مقسوما على 2. كل مدخل في الصف الثاني هو حاصل ضرب 1 مع مدخل الصف الثالث إلى اليسار. الإجابة تكون:
f
1
(
x
)
f
2
(
x
)
=
2
x
3
-
2
x
2
-
x
+
1
-
4
(
2
x
-
1
)
.
subscript
𝑓
1
𝑥
subscript
𝑓
2
𝑥
2
superscript
𝑥
3
2
superscript
𝑥
2
𝑥
1
4
2
𝑥
1
{\displaystyle{\displaystyle{\frac{f_{1}(x)}{f_{2}(x)}}=2x^{3}-2x^{2}-x+1-{%
\frac{4}{(2x-1)}}.}}
المصادر
مؤلفات
William George Horner. A new method of solving numerical equations of all orders, by continuous approximation. In Philosophical Transactions of the Royal Society of London , pp. 308–335, July 1819.
Spiegel, Murray R. (1956). Schaum's Outline of Theory and Problems of College Algebra . McGraw-Hill Book Company.
Donald Knuth . The Art of Computer Programming , Volume 2: Seminumerical Algorithms , Third Edition. Addison-Wesley, 1997. ISBN 0-201-89684-2. Pages 486–488 in section 4.6.4.
Thomas H. Cormen , Charles E. Leiserson , Ronald L. Rivest , and Clifford Stein . Introduction to Algorithms , Second Edition. MIT Press and McGraw-Hill, 2001. ISBN 0-262-03293-7. Problem 2-3 (pg. 39) and page 823 of section 30.1: Representation of polynomials.
Kripasagar, Venkat (March 2008). "Efficient Micro Mathematics – Multiplication and Division Techniques for MCUs". Circuit Cellar magazine (212): p. 60. CS1 maint: date and year (link )
وصلات خارجية