WEBVTT 00:00.270 --> 00:04.920 After a certain point in your life you solve so many quadratic equations that you're done today look 00:04.920 --> 00:07.750 over this thing and do it with pen and paper anymore. 00:07.830 --> 00:09.010 You just want to write. 00:09.020 --> 00:10.980 This is going to be sent in by magic. 00:10.980 --> 00:11.970 You have the answer. 00:11.970 --> 00:14.760 So let's try to create this program with Python. 00:14.790 --> 00:20.360 From my perspective program to get mathematics I think that connected you know to create complex programs. 00:20.380 --> 00:23.240 You need mathematics to structure your way of thinking. 00:23.310 --> 00:28.980 And the final solution on the other hand programming it and more specifically the process of mathematics 00:28.980 --> 00:34.650 to solve very complex equations that are nearly impossible or actually impossible to solve with pen 00:34.650 --> 00:38.180 and paper then just think about that when you think that you can. 00:38.250 --> 00:44.670 This whole notion of the quadratic equation just by right Think of it being called a b and c this is 00:44.670 --> 00:48.040 a red it is an attempt to read my mind. 00:48.390 --> 00:50.970 Okay what about this equation. 00:50.970 --> 00:56.700 Believe me you can solve this equation with a computer two just by adding theory one seeks to and 5 00:57.000 --> 01:00.020 but for educational reasons we wanted to start small. 01:00.060 --> 01:02.150 Let's assume that you took over this equation. 01:02.180 --> 01:09.440 So a sequel to one me to quote or minus three and see sequel to the discriminant is the sequel to one. 01:09.510 --> 01:11.910 And this solutions are one into two. 01:12.050 --> 01:15.750 Jay Z but I kind of calculated this came out in Nevada. 01:15.870 --> 01:22.990 And then you're in that classical equation in order to find the solution is a part of her final program. 01:23.040 --> 01:24.320 Is this procedure. 01:24.360 --> 01:27.340 But you should consider one or two more cases. 01:27.500 --> 01:29.450 I tried to create this part in Python. 01:29.530 --> 01:32.220 Okay first we need to initialize the three variables. 01:32.220 --> 01:38.050 This can be done by the user but here will allow us to write them down in order to make the whole procedure 01:38.070 --> 01:38.700 faster. 01:38.880 --> 01:46.170 So a sequel to one B C code two minus 3 and C sequel to 2. 01:47.710 --> 01:57.370 Then we need to calculate the discriminant that is equal to be square minus 4 and multiplied by 8 multiplied 01:57.370 --> 01:58.990 by C. 02:00.630 --> 02:02.300 Then we can prove the result. 02:04.270 --> 02:06.270 So the results are correct. 02:06.280 --> 02:12.470 In addition we will calculate that X one part of this equation we need to use this Cuero the D. 02:12.850 --> 02:18.840 Fortunately Python has already embedded the equation is to add a T that could do the trick. 02:19.240 --> 02:23.580 But first we need to import our maths library. 02:25.060 --> 02:27.390 And then we can call this square in a function. 02:27.570 --> 02:35.500 For example we can divide maths dot s q r t o f d and we can print it out. 02:39.880 --> 02:47.100 So everything is okay without having said X1 said signal to this equation. 02:47.260 --> 02:49.630 And we're going to bring those out. 02:49.700 --> 02:51.740 The same goes for X too. 02:54.690 --> 02:57.840 And as you can see the results are the same with their analysis. 02:57.870 --> 02:58.440 And then he makes. 02:58.440 --> 03:03.540 Now we want to go to the next level and create the whole body that can create a different part for a 03:03.540 --> 03:04.500 different case. 03:04.500 --> 03:10.180 For example this could mean the variables you see go to zero you will have only one that result in d 03:10.220 --> 03:11.640 d is less than zero. 03:11.640 --> 03:13.480 You will have imaginaries out. 03:13.490 --> 03:19.650 Also don't forget that if a sequel to zero you should not do use the classical equation because you 03:19.650 --> 03:23.540 will have a division with zero people who meant this in python. 03:23.540 --> 03:26.460 We're going to use that statement to become legend. 03:26.490 --> 03:27.580 But he was a reader. 03:27.990 --> 03:31.600 So if there is greater than zero. 03:33.590 --> 03:39.860 LS if there is equal to zero and outs. 03:42.830 --> 03:47.930 Then we will use this same algorithm inside there greater than zero. 03:48.150 --> 03:50.190 In the case of a deer is equal to zero. 03:50.190 --> 03:53.760 We have only one solution to all times. 03:54.280 --> 03:59.100 So X and you should go to this end we will print it. 03:59.850 --> 04:01.710 Finally followed their less than zero. 04:01.710 --> 04:04.020 With live complex algorithms. 04:04.050 --> 04:08.820 So Z 1 is equal to complex. 04:09.170 --> 04:11.280 Ever have two numbers. 04:11.280 --> 04:13.760 Very 0 1 and they manteno. 04:14.460 --> 04:24.570 So they really want is equal to minus be divided by 2 multiplied by the imaginary is security. 04:26.960 --> 04:30.590 Death divided by 2 multiplied by 8. 04:30.960 --> 04:33.430 And we've been preens there said 1. 04:34.650 --> 04:37.680 Then this same goes for the Z 2. 04:38.250 --> 04:44.760 So now we can use the algorithm for the previous quote Recent work of these results. 04:44.970 --> 04:47.550 Then if we use these quotations 04:50.490 --> 04:52.010 we will have these result. 04:52.360 --> 04:58.790 Okay the problem is that we forgot that here we need to minus two here because there is less than zero. 05:00.550 --> 05:02.930 As you can see here I'll give the correct result.