Question: Just the code for the functions that need filling in. (ie where it says, YOUR CODE HERE). Thanks a lot. ### Derivative of multiplication. def
Just the code for the functions that need filling in. (ie where it says, "YOUR CODE HERE"). Thanks a lot.



### Derivative of multiplication.
def multiply_derivate(self, x):
### YOUR CODE HERE
Multiply.derivate = multiply_derivate
### Derivative of division
def divide_derivate(self, x):
### YOUR CODE HERE
Divide.derivate = divide_derivate
Derivative of multiplication. def multiply_derivate(self, x): ### YOUR CODE HERE Multiply.derivate multiply_derivate ## Here you can debug your code. X = VO) e = x * x de e.derivate() de ## Tests for derivative of multiplication. X 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 VO) V(value=2) e = X # This is ugly. It is. We have not implemented 0, 1 simplifications. assert e.derivate(x) == 1 * y + x * 0 # To remedy ugliness, we now test numerically. f = x * x x.assign (3) assert f.derivate(x).eval() 6, f.derivate(x).eval() x.assign(4) assert f.derivate(x).eval() 8, f.derivate(x).eval() 3 h = 3 * x assert h. derivate(x).eval() u = x * 3 assert u.derivate(x).eval() 3 ### Derivative of division def divide_derivate(self,x): ### YOUR CODE HERE Divide. derivate = divide_derivate ## Here you can debug your code. x = VO) VO) print("x:", x) print("y:", y) e x / y e.derivate(y) ### Tests for derivative of division. 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 X = VO) VO) e = x/2 f e.derivate(x) x.assign(3) assert f.eval() 1/2 g = 1 / x assert g.derivate(x).eval() assert g.derivate(y).eval() 1 / 9 ## Miscellaneous tests. X = V(value=2) V(value=3) f = df (x + 1) * (y + 1) / (x - 1) * (y - 1) f.derivate(x) assert df.eval() -16 x.assign (0.5) y.assign(0.5) assert df.eval() = 6 ## Miscellaneous tests. X = V(value=0) f (3 x + 4) / (5 * x* x- 7 * x + 12) df 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 f.derivate(x) assert abs(df.eval() - 0.3611)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
