0% found this document useful (0 votes)
3 views4 pages

Solution_via_Graphs_Codes

The document explains how to find solutions to equations by plotting the graphs of two functions and identifying their points of intersection. Several examples are provided, demonstrating the process with equations such as x=exp(x), 1+x^2=exp(x), and x=cos(x), along with their respective solutions. The document concludes with the results of each example, indicating whether a solution exists and, if so, what it is.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Solution_via_Graphs_Codes

The document explains how to find solutions to equations by plotting the graphs of two functions and identifying their points of intersection. Several examples are provided, demonstrating the process with equations such as x=exp(x), 1+x^2=exp(x), and x=cos(x), along with their respective solutions. The document concludes with the results of each example, indicating whether a solution exists and, if so, what it is.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

## Solution of equations by plotting graphs:

In order to find the solution of an equation f(x)=g(x) by plotting


graphs, we proceed as follows:
(i) plot the equation y=f(x) and y=g(x) on the same graph
(ii) the point of intersection of these plots will give the
solution of the equation f(x)=g(x).
## ***********************************************
## Ex: By plotting the graph, find the solution of x=exp(x).
x <- seq(0, 1, 0.01)
y1 <- x
y2 <- exp(x)
plot(x, y2, type="l", col="blue", lwd=2, ylim=c(0,3))
lines(x, y1, type="l", col="red", lwd=2)
3.0
2.5
2.0
1.5
g

1.0
0.5
0.0

0.0 0.2 0.4 0.6 0.8 1.0

x
Clearly, NO SOLUTION
## ------------------------------------------------------------------
## Ex: By plotting the graph, find the solution of 1+x^2=exp(x).
x <- seq(-1, 1, 0.01)
y1 <- 1+x*x
y2 <- exp(x)
plot(x, y1, type="l", col="blue", lwd=2, ylim=c(0,3))
lines(x, y2, type="l", col="red", lwd=2)
3.0
2.5
2.0
1.5
y1

1.0
0.5
0.0

-1.0 -0.5 0.0 0.5 1.0

Solution : x=0
## ------------------------------------------------------------------
## Ex: By plotting the graph, find the solution of 1-x^2=exp(x).
x <- seq(-1, 1, 0.01)
y1 <- 1-x*x
y2 <- exp(x)
plot(x, y1, type="l", col="blue", lwd=2, ylim=c(0,2))
lines(x, y2, type="l", col="red", lwd=2)
2.0
1.5
1.0
y1

0.5
0.0

-1.0 -0.5 0.0 0.5 1.0

SOLUTION x=0 and x=0.7


## ------------------------------------------------------------------
## Ex: By plotting the graph, find the solution of x=log10(x).
x <- seq(0.5, 2, 0.01)
y1 <- x
y2 <- log10(x)
plot(x, y2, type="l", col="blue", lwd=2, ylim=c(-1,2))
lines(x, y1, type="l", col="red", lwd=2)

2.0
1.5
1.0
0.5
y2

0.0
-0.5
-1.0

0.5 1.0 1.5 2.0

NO SOLUTION
## ------------------------------------------------------------------
## Ex: By plotting the graph, find the solution of x=cos(x).
x <- seq(0.0, 2*pi, length=100)
y1 <- cos(x)
y2 <- x
plot(x, y2, type="l", col="blue", lwd=2, ylim=c(-1,3))
lines(x, y1, type="l", col="red", lwd=2)
3
2
1
0
-1

0 1 2 3 4 5 6

x
SOLUTION x=0.74
## ------------------------------------------------------------------
## Ex: By plotting the graph, find the solution of x=sin(x).
x <- seq(0, 2*pi, length=100)
y1 <- sin(x)
y2 <- x
plot(x, y2, type="l", col="blue", lwd=2, ylim=c(-1,2))
lines(x, y1, type="l", col="red", lwd=2)
2.0
1.5
1.0
0.5
y2

0.0
-0.5
-1.0

0 1 2 3 4 5 6

SOLUTION x=0
## ------------------------------------------------------------------

You might also like