🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 18: Cost & Root Comparison

Scientific Computing
Current Task

Objective

Review day: combine optimization and root finding — days 5 and 6 — on related functions.

Task: minimize a cost function and separately find the root of a related function, printing both results.

index.py
from scipy.optimize import minimize, root_scalar def cost(x): return (x[0] - 5) ** 2 def zero_crossing(x): return x - 5 opt_result = minimize(cost, x0=[0]) root_result = root_scalar(zero_crossing, bracket=[0, 10]) print(opt_result.x.round(2), root_result.root)

* Hint: Correct characters turn green, incorrect ones turn red.

Live Preview
🖼️

Verify your code to see the preview