Vous êtes sur la page 1sur 5

JOURNAL OF COMPUTING, VOLUME 3, ISSUE 5, MAY 2011, ISSN 2151-9617

HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 42

Solving equations numerically and by MATLAB code using the


generated function with three terms (second order equation)
Sameh Abdelwahab Nasr Eisa

Abstract— we can solve equations numerically using a lot of methods and also using the second order equation like Muller
method. In this paper I used the generated function idea which depends on polynomials to convert each subinterval to second
order equation using the linear equations system in order to get approximation accurate solution. I made a MATLAB code that
simulate this method and deduced wonderful results included in this paper.

Index Terms— Numerical solution for solving equations, solving equations generally by computer, MATLAB code program to
simulate the idea and solve any equation.

——————————  ——————————

1 INTRODUCTION

A ny equation can be considered as a variable function


and by equating It with zero we form the equation. In
f(x3) = a0+ a1* x3+ a2 * x32
After solving the above three equations we get the values
this paper I used the generated function which depends of a0, a1, a2 then we have for this interval g(x) that
On the polynomials by using linear equations system to replaces it.
Deduce a solution directly by the programs and g(x) = a0 + a1x + a2x2
Computers.
n  2 USING THE GENERATED FUNCTION WITH THREE
F(x) = g(x) = 
n 0
anxn TERMS TO FIND A NUMERICAL SOLUTION FOR
SOLVING EQUATION USING THE LINEAR
F(x) = g(x) = a0x0+ a1x1+ a2x2 …… EQUATIONS SYSTEM
We can use the properties of the generated function Our idea is to deduce a g(x) with three terms to replace
g(x) that published recently to limit the series to number of each subinterval from the wide range from the function
terms (wide interval) that we expect it contains the wanted
g(x) = a0 + a1x or solutions.
2
g(x) = a0 + a1x + a2x or Now we will define the logical steps to make this
2 3 4
g(x) = a0 + a1x + a2x + a3x + a4x or else… operation.
This limitation can only used if we take interval from the
function and replace this interval with g(x) with 2 or 3 or 4 3 THE LOGICAL STEPS FOR ACHIEVING THE
……terms. SOLUTION FOR ANY EQUATION BY THIS METHOD

We have to put in our consideration that narrower First step: we will divide the wide range (wide interval)

intervals can be replaced with low number of terms. From the function f(x) = 0 that we expect the solutions

If we want to replace the interval with g(x) with three exist on it in to subintervals.

g(x) = a0 + a1x + a2x2 Second step: each subinterval will be converted to the

Then we have to substitute with three different points over form

the interval distributed equally over the interval. F(x)  g(x) = a0+ a1x1+ a2x2

f(x1) = a0+ a1* x1+ a2 * x12 And to deduce a0, a1, a2 we have to solve the below three
f(x2) = a0+ a1* x2+ a2 * x22 equations using the linear equations system
f(x1) = a0+ a1* x1+ a2 * x12
————————————————
f(x2) = a0+ a1* x2+ a2 * x22
 Graduated engineer from Alexandria university, Egypt, Electrical
department, sector of communications and electronics f(x3) = a0+ a1* x3+ a2 * x32
JOURNAAL OF COMPUTING, VOLUME
V 3, ISSUE 5, MAY
M 2011, ISSN 2151-9617
HTTPS:///SITES.GOOGLE.COM
M/SITE/JOURNALOFCOMPUTING/
WWW.JO OURNALOFCOMPUTING.ORG 43

where
e x1 and x3 arre the limits off the subinterv
val (first and about the sttep width we take over x-a
axis to define each
end p
points of it) an point between them in half
nd x2 is a midp width and the
subinterval w e number of the operation
ns we
of the
e distance ove
er x-axis betwe
een x1, x3. made to co
over the who
ole range we
e expect that the
Third ave g(x) and now we will put it in the
d step: we ha solution exisst inside it be
eside the accu
uracy of the rresult
form and its relati on with the ste
ep width.
1 2
g((x) = a0+ a1x + a2x = 0
4.1. The ste
ep width and
d number of subintervals
s
And w
we will solve itt using the fam
mous role

The step w ill define the number of su


ubintervals we
e will
take to cove
er the entire range and th
he accuracy o
of the
results too.
Simply if we want to
o cover sin(xx) from x=3 to
o x=6
In our case this rule
e will be with step = 1 the we will get g1(x) fro
om x=3 to x=4
4 and
make the fo
our steps we d
discussed beffore and the ssame
for g2(x) fro
om x=4 to x=5 m x=5 to x=6. The
5 & g3(x) from
Now we have one or two values of x the values x1,2. same if we want to cove
er sin(x) with sstep = 0.5 orr 0.25
Forth
h step: in this step we check the values frrom the …….
previo
ous step and make a consid
deration or exc
ception for 4.2. Step w
width and the
e accuracy off the results
the re
esults.
Narrower su
ubintervals giive higher acccuracy and w
wider
ss any comple
We will dismis ex or pure imag
ginary
because the rule
subintervals give lowerr accuracy b
answ
wer because we
w speak about real numbers
s and
depends on the coefficien
nts deduced frrom g(x) which
h has
solutiions.
the propertyy that tell us th
hat narrower in
ntervals give h
higher
We know thatt the subinterval that we ope
erate over it
accuracy an
nd that was cle
ear in the pap
per published a
about
ed between x1 and x3 and by equating g(x
locate x) that
the generate
ed function cha
aracteristics.
replaces it with zerro we try to get approximated solution
If we ha
ave
for the value or values of x that figured out from
m the
sin((x) - x2 = 0
interssection betwee
en the subinte
erval and the x-axis
x which
And we expe
ect the solutio
on in the range
e between x=2
2 and
make
e y=0.
x=5.
We have to pu
ut the above paragraph
p in our
If we ta
ake the step = 1 then we ge
et g1(x) from xx=2 to
consiideration beca
ause we will ch
heck if the resu
ults values
x=3 and solvve it and the same for g2(xx) from x=3 to
o x=4
of x from the third step
s located between x1 and
d x3 then it
and the sam
me for g3(x) fro
om x=4 to x=5.
will be considered as one of the solutions. So we
w have to
If we ta
ake the step = 0.5 then we get g1(x) from
m x=2
be su
ure that x1 < x < x3 to take th
his solution oth
herwise the
to x=2.5 and
d solve it and tthe same for g
g2(x) from x=2
2.5 to
solutiion will be dism
missed.
x=3 and the same for g3((x) from x=3 to
o x=3.5…...an
nd the
Fifth step: now we he subinterval we
e done from th
same for g6((x) from x=5.5
5 to x=6.
ated on it in the past 4 steps
opera s and now we will repeat
We willl find that the solution base
ed on step width =
the sa or the next subinterval until we cover all
ame 4 steps fo
0.5 will give results more accurate than
n solution base
ed on
wide range that we consider the possible solutions
the w s
step width = 1 because th
he g(x) with three terms ded
duced
locate
ed inside it.
of 0.5 is betterr in its result frrom g(x) with three
over width o
terms deducced over width at the properties of
h of 1 that wha
4 THE CHOICE OF
O THE STEP WIDTH
the generate
ed function told
d us.
The most importan
nt property fo
or this solution
n method is
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 5, MAY 2011, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 44

4.3. Function with high rate of change or has We can choose the step width by compare the error
frequency values of g(x) with the original curve and if we have high
error then we will substitute in the rule with high error
Functions with high rate of change or high frequency must result then we can't expect accurate results.
take small steps to ensure the accuracy. We can't take
step=1 for functions like sin(100x) or exp(10x) in the other
hand we can take step = 1 for function like ln(x).

5 MATLAB PROGRAM CODE SIMULATE THIS METHOD FOLLOWED BY MULTIPLE EQUATIONS SOLVED BY IT
AND COMPARED WITH OTHER NUMERICAL METHODS RESULTS

I made a MATLAB code that simulate the steps I mentioned in this paper for making a numerical solution for an input
equation that we give it to the program and the program use this steps with g(x) with three terms and step width = 1/8
to ensure the accuracy. I made a table after the code with multiple equations that I solved with this code and compares
it with the result from some computers programs that used other numerical methods.

5.1. The MATLAB code

s=[]; % 5 empty matrices for future storage in the program %


h=[];
k=[];
y=[];
q=[];
starting=-10; % we input the starting point of the range %
ending=10; % we input the ending point of the range %
t=starting;
j=starting:1/16:ending;
% we input the equation to be solved in the range from the starting to the ending
points but with no =0 %
equation= j.^4-j.^2-10;
% in the below lope we get g(x) with three terms for each subinterval to substitute
in the role and solve it %
for i=1:2:length(equation)-2
m=[1 t t^2; 1 t+(1/16) (t+(1/16))^2; 1 t+(1/8) (t+(1/8))^2];
f=[equation(i);equation(i+1);equation(i+2)];
sol=m\f;
a0=sol(1);
a1=sol(2);
a2=sol(3);
% c & v are the solutions from the rule %
c=(-1*a1+(((a1^2 -4*a0*a2)^0.5)))/(2*a2);
v=(-1*a1-(((a1^2 -4*a0*a2)^0.5)))/(2*a2);
% we check in the below loops the solutions to be sure that they are not
complex or out of the subinterval limits like we mentioned in the third section
the forth step in this paper %
if isreal(c)==1
q=c;

if q<(t+1/8) && q>=t


k=q;
y=[y k];
end

end
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 5, MAY 2011, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 45

if isreal(v)==1
s=v;

if s<(t+1/8) && s>=t


h=s;
y=[y h];
end

end
t=t+1/8;% we move to the next subinterval to make the same %
end
y
% after we done from the range the matrix y that stores all the solutions will
shown up after we activate the code%

5.2. Multiple equations solved by the above code

Equation to be solved The range Solutions with the Solutions with numerical
method in this paper methods used in computer
with step = 1/8 using program like winplot and
the code I made MATLAB
x^4-x^2-10=0 -5,5 -1.9240,1.9240 -1.9239, 1.9239
sin(x)-x^2+3=0 -3,5 -1.4183 ,1.9793 -1.41831,1.97932
sin(5*x^2) – x^2=0 -1,1 -0.7208,0,0.7208 -0.72052,0,0.72052
exp(x)-x^3=0 -3,10 1.8572,4.5364 1.85718,4.53640
exp(x^2)-exp(x)-x^6=0 -5,5 -2.1313,-1.3369, -2.13076,-1.33703,
0,2.1818 0,2.18158
(x-100)^6-10^(x-100)=0 50,110 99.2501 99.25008
x^4-x^2-10=0 -4,4 -1.9240,1.9240 -1.92394,1.92394

operations and that can made when we deal with


5 THE IMPORTANCE OF THIS METHOD functions with low rate of change to ensure that we will
get acceptable results and the other option is about
First: in this method we make the process with the
making high number of subintervals to ensure the
same results or higher than the other numerical methods
accuracy which give us the flexibility to trade of between
but with little number of subintervals and that from the
the above option and our needing.
computational mathematics point of view is a progress.
Second: in a lot of other numerical methods we
make operations on numbers and get the result in number REFERENCES
form unlike this method we get variable function g(x)
[1] C. T. Kelley, Solving Nonlinear Equations with
which replace any subinterval and make the normal
Newton's Method, no 1 in Fundamentals of Algorithms,
solution process on it then we get the result. This gives SIAM, 2003. ISBN 0-89871-546-6.
the scientists the ability to push this method in some
[2] Dennis G. Zill, Michael R . Cullen, A d v a n c e d
applications that the scientists prefer the variable form to E n g i n e e r i n g Mathematics, Fourth Edition, Jones
push it again in another operation or application. and Bartlett Publ., MA (2010).
Third: in this method we have two options one of
[3] Erwin Kreyszig, Advanced Engineering
them to make low number of subintervals an so the Mathematics, Seventh Edition, Ohio State
University, Columbus, Ohio (2005).
JOURNAAL OF COMPUTING, VOLUME
V 3, ISSUE 5, MAY
M 2011, ISSN 2151-9617
HTTPS:///SITES.GOOGLE.COM
M/SITE/JOURNALOFCOMPUTING/
WWW.JO OURNALOFCOMPUTING.ORG 46

[4] F. Rouillier and P. Zimmerman n, Efficient iso


olation of
polynnomial's real ro
oots, Journal of
o Computational and
Applied Mathematics 162 (2004))

[5] Ka
aw, Autar; Kalu 8). Numerical Methods
u, Egwu (2008
with A
Applications (1
1st ed.).

eader, Jeffery J. (2004). Num


[6] Le merical Analys
sis and
Scienntific Computaation. Addison Wesley.

[7] Muller, David E.., "A Method fo


or Solving Alge
ebraic
Equaations Using an n Automatic Computer,"
C MTAAC, 10
(19566), 208-215.

ewton Method
[8] P. Deuflhard, Ne ds for Nonlineaar Problems.
e Invariance and
Affine a Adaptive Algorithms.
A Springer
Seriees in Computational Mathem
matics, Vol. 35.. Springer,
Berlin
n, 2004. ISBN 3-540-21099--7.

[9] S..A Nasr Eisa , on the interpoolation using polynomials


p
seriess (the generatted function), International
I jo
ournal of
pure and applied mathematics
m (IJPAM), volum me 68, No.2
(20111), 145-164..

[10] T
Tjalling J. Ypm
ma, Historical development
d of
o the
Newtton-Raphson method,
m SIAMM Review 37 (44), 531–551,
1995.

Sameeh Abdelwaha ab Nasr Eisa:: fresh graduaated engineer


talentted in mathemmatics and published a lot of mathematics
researrches in internaational scientiffic journals.

4-th FFloor, 3, Shawwkat Str.


(In fro
ont of the 5-th
h Egyptian Ch
hannel)
Alexa andria City, EGYPT
E
Cell pphone:002-01224795880