FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Python f(x) & grad
NewsDevOps

Python f(x) & grad

via Dev.to Tutorialslackman1mo ago

s = [10.0] for _ in range(5): s.append(s[-1] * 0.98) s = [10.0, 9.8, 9.6] loss = lambda x: (x**2) + 20 grad = lambda x: x*2 w = 9.8 print(loss(w), grad(w)) 极值点, 导数为0, grad递减 At the extremum point, the derivative is zero, and the gradient is decreasing import matplotlib.pyplot as plt import numpy as np w = [10.0] for _ in range(100): w.append(w[-1] * 0.98) x = np.array(w) y = np.pow(x,2) + 20 y_grad = x * 2 plt.figure(figsize=(10, 6)) plt.xlim(10,0) plt.scatter(x, y, label = 'f(x)', color='blue') plt.scatter(x, y_grad, label = "grad(x)", color='red') plt.grid() plt.legend() plt.tight_layout() plt.show()

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
32 views

Related Articles

The Outbox Pattern: A Consistent Approach to Distributed Transactions
News

The Outbox Pattern: A Consistent Approach to Distributed Transactions

Medium Programming • 3d ago

6o6 v1.1: Faster 6502-on-6502 virtualization for a C64/Apple II Apple-1 emulator
News

6o6 v1.1: Faster 6502-on-6502 virtualization for a C64/Apple II Apple-1 emulator

Lobsters • 3d ago

ChemBERTa-2: Towards Chemical Foundation Models
News

ChemBERTa-2: Towards Chemical Foundation Models

Dev.to • 3d ago

Test title
News

Test title

Dev.to Tutorial • 3d ago

Legacy PC design misery
News

Legacy PC design misery

Lobsters • 3d ago

Discover More Articles