You are on page 1of 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 of a0, a1, a2 then we have for this interval g(x) that replaces it. g(x) = a0 + a1x + a2x2

this paper I used the generated function which depends On the polynomials by using linear equations system to Deduce a solution directly by the programs and Computers.
n 

F(x) = g(x) =

n 0

anxn

2 USING THE GENERATED FUNCTION WITH THREE
TERMS TO FIND A NUMERICAL SOLUTION FOR SOLVING EQUATION USING THE LINEAR EQUATIONS SYSTEM

F(x) = g(x) = a0x0+ a1x1+ a2x2 …… We can use the properties of the generated function g(x) that published recently to limit the series to number of terms g(x) = a0 + a1x or g(x) = a0 + a1x + a2x
2 3 2

Our idea is to deduce a g(x) with three terms to replace each subinterval from the wide range from the function (wide interval) that we expect it contains the wanted solutions.

or
4

Now we will define the logical steps to make this operation.

g(x) = a0 + a1x + a2x + a3x + a4x or else… 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 ……terms. We have to put in our consideration that narrower intervals can be replaced with low number of terms. If we want to replace the interval with g(x) with three g(x) = a0 + a1x + a2x2 Then we have to substitute with three different points over the interval distributed equally over the interval. f(x1) = a0+ a1* x1+ a2 * x12 f(x2) = a0+ a1* x2+ a2 * x22
————————————————

3 THE LOGICAL STEPS FOR ACHIEVING THE
SOLUTION FOR ANY EQUATION BY THIS METHOD

First step: we will divide the wide range (wide interval) From the function f(x) = 0 that we expect the solutions exist on it in to subintervals. Second step: each subinterval will be converted to the form F(x)  g(x) = a0+ a1x1+ a2x2 And to deduce a0, a1, a2 we have to solve the below three equations using the linear equations system f(x1) = a0+ a1* x1+ a2 * x12 f(x2) = a0+ a1* x2+ a2 * x22 f(x3) = a0+ a1* x3+ a2 * x32

 Graduated engineer from Alexandria university, Egypt, Electrical department, sector of communications and electronics

JOURNA OF COMPUTING, VOLUME 3, ISSUE 5, MAY 2011, ISSN 2151-9617 AL V M HTTPS:/ //SITES.GOOGLE.COM M/SITE/JOURNALOFCOMPUTING/ WWW.JO OURNALOFCOMPUTING.ORG

43

where x1 and x3 ar the limits of the subinterv (first and e re f val end p points of it) an x2 is a midp nd point between them in half of the distance ove x-axis betwe x1, x3. e er een Third step: we ha d ave g(x) and now we will put it in the form g( = a0+ a1x + a2x = 0 (x) we t mous role And w will solve it using the fam
1 2

tep width we take over x-a axis to define each about the st width and the number of the operation we subinterval w e ns made to co over the who range we expect that the ole e solution exis inside it be st eside the accu uracy of the r result and its relati on with the ste width. ep

4.1. The ste width and number of subintervals ep d s
The step w ill define the number of su ubintervals we will e take to cove the entire range and th accuracy o the er he of results too. Simply if we want to cover sin(x from x=3 to x=6 o x) o

In our case this rule will be e

with step = 1 the we will get g1(x) fro x=3 to x=4 and om 4 make the fo steps we d our discussed bef fore and the s same for g2(x) fro x=4 to x=5 & g3(x) from x=5 to x=6. The om 5 m

Now we have one or two values of x the values x1,2. Forth step: in this step we check the values fr h rom the previo step and make a consid ous deration or exc ception for the re esults. ss ex ginary We will dismis any comple or pure imag answ because we speak about real numbers and wer w s soluti ions. We know that the subinterval that we ope t erate over it ed x) locate between x1 and x3 and by equating g(x that replaces it with zer we try to get approximated solution ro for the value or values of x that figured out from the m inters section betwee the subinte en erval and the x-axis which x make y=0. e We have to pu the above paragraph in our ut p consi ideration beca ause we will ch heck if the resu values ults of x from the third step located between x1 and x3 then it s d will be considered as one of the solutions. So we have to w be su that x1 < x < x3 to take th solution oth ure his herwise the soluti will be dism ion missed. Fifth step: now we done from th subinterval we e he ated on it in the past 4 steps and now we will repeat s opera the sa ame 4 steps fo the next subinterval until we cover all or the w wide range that we consider the possible solutions s locate inside it. ed

same if we want to cove sin(x) with s er step = 0.5 or 0.25 r …….

4.2. Step w width and the accuracy of the results e f
Narrower su ubintervals giive higher ac ccuracy and w wider subintervals give lower accuracy b r because the rule depends on the coefficien deduced fr nts rom g(x) which has h the property that tell us th narrower in y hat ntervals give h higher accuracy an that was cle in the pap published a nd ear per about the generate function cha ed aracteristics. If we ha ave sin( - x2 = 0 (x) And we expe the solutio in the range between x=2 and ect on e 2 x=5. If we ta the step = 1 then we ge g1(x) from x to ake et x=2 ve x=3 and solv it and the same for g2(x from x=3 to x=4 x) o and the sam for g3(x) fro x=4 to x=5. me om If we ta the step = 0.5 then we get g1(x) from x=2 ake m to x=2.5 and solve it and t same for g d the g2(x) from x=2 to 2.5 x=3 and the same for g3( from x=3 to x=3.5…...an the (x) o nd same for g6( from x=5.5 to x=6. (x) 5 We willl find that the solution base on step width = ed 0.5 will give results more accurate than solution base on n ed step width = 1 because th g(x) with three terms ded he duced over width o 0.5 is better in its result fr of r rom g(x) with three

4 THE CHOICE OF THE STEP WIDTH O
The most importan property fo this solution method is nt or n

terms deduc over width of 1 that wha the properties of ced h at the generate function told us. ed d

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 frequency
Functions with high rate of change or high frequency must 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).

We can choose the step width by compare the error values of g(x) with the original curve and if we have high error then we will substitute in the rule with high error result then we can't expect accurate results.

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

operations and that can made when we deal with

5 THE IMPORTANCE OF THIS METHOD
First: in this method we make the process with the same results or higher than the other numerical methods but with little number of subintervals and that from the 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 form unlike this method we get variable function g(x) which replace any subinterval and make the normal solution process on it then we get the result. This gives the scientists the ability to push this method in some applications that the scientists prefer the variable form to push it again in another operation or application. Third: in this method we have two options one of them to make low number of subintervals an so the

functions with low rate of change to ensure that we will get acceptable results and the other option is about making high number of subintervals to ensure the accuracy which give us the flexibility to trade of between the above option and our needing.

REFERENCES
[1] C. T. Kelley, Solving Nonlinear Equations with Newton's Method, no 1 in Fundamentals of Algorithms, SIAM, 2003. ISBN 0-89871-546-6. [2] Dennis G. Zill, Michael R . Cullen, A d v a n c e d E n g i n e e r i n g Mathematics, Fourth Edition, Jones and Bartlett Publ., MA (2010). [3] Erwin Kreyszig, Advanced Engineering Mathematics, Seventh Edition, Ohio State University, Columbus, Ohio (2005).

JOURNA OF COMPUTING, VOLUME 3, ISSUE 5, MAY 2011, ISSN 2151-9617 AL V M HTTPS:/ //SITES.GOOGLE.COM M/SITE/JOURNALOFCOMPUTING/ WWW.JO OURNALOFCOMPUTING.ORG

46

[4] F. Rouillier and P. Zimmerman Efficient iso n, olation of polyn nomial's real ro oots, Journal of Computational and o Applied Mathematics 162 (2004) ) [5] Ka Autar; Kalu Egwu (2008 Numerical Methods aw, u, 8). with A Applications (1 ed.). 1st eader, Jeffery J. (2004). Num merical Analys and sis [6] Le Scien ntific Computa ation. Addison Wesley. ., or ebraic [7] Muller, David E. "A Method fo Solving Alge ations Using an Automatic Computer," MTA 10 n C AC, Equa (1956 208-215. 6), ewton Method for Nonlinea Problems. ds ar [8] P. Deuflhard, Ne e a A Affine Invariance and Adaptive Algorithms. Springer Serie in Computational Mathem es matics, Vol. 35. Springer, . Berlin 2004. ISBN 3-540-21099n, -7. .A olation using polynomials p [9] S. Nasr Eisa , on the interpo series (the generat function), International jo s ted I ournal of pure and applied mathematics (IJPAM), volum 68, No.2 m me 1), (2011 145-164.. Tjalling J. Ypm Historical development of the ma, d o [10] T Newt ton-Raphson method, SIAM Review 37 (4 531–551, m M 4), 1995.

Same Abdelwaha Nasr Eisa: fresh gradua eh ab : ated engineer talent in mathem ted matics and published a lot of mathematics resear rches in interna ational scientif journals. fic

4-th F Floor, 3, Shaw wkat Str. (In fro of the 5-th Egyptian Ch ont h hannel) Alexa andria City, EGYPT E Cell p phone:002-012 24795880