1. Building Blocks of Deep Learning
Activity 1.01: Solving a Quadratic Equation Using an Optimizer
Solution
Let's solve the following quadratic equation:
We already know that the solution to this quadratic equation is x=5
.
We can use an optimizer to solve this. For the optimizer, x
is the variable and the cost function is the left-hand side expression, which is as follows:
The optimizer will find the value of x
for which the expression is the minimum – in this case, it is 0
. Please note that this will work only for quadratic equations that are perfect squares, such as in this case. The left-hand side expression is a perfect square that can be explained with the following equation:
Now, let's look at the code for solving this:
- Open a new Jupyter Notebook and rename...