np.linalg.solve() से Equations हल करना
solve linear equations के एक system में unknown values ढूंढता है।
In this page:
Syntax
x = np.linalg.solve(A, b)
np.linalg.solve()
np.linalg.solve(A, b) एक square, non-singular A के लिए x return करता है ऐसे कि A x = b। यह खुद inverse compute करने से ज़्यादा stable और faster है। A की हर row एक equation है और हर column एक unknown।
Note:
np.allclose(A @ x, b) से अपना answer check करें।
उदाहरण: np.linalg.solve()
import numpy as np
# 2x + y = 5 and x + 3y = 10
A = np.array([[2, 1], [1, 3]])
b = np.array([5, 10])
x = np.linalg.solve(A, b)
print(x)
print(np.allclose(A @ x, b))
# Output:
# [1. 3.]
# True
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- solve की बजाय inv(A) @ b इस्तेमाल करना
- एक singular matrix pass करना
- equation layout गलत पाना
चैप्टर सारांश
- solve(A, b), A x = b solve करता है
- A square और non-singular होना चाहिए
- Inverting से ज़्यादा stable
- A @ x से verify करें
🔒
Chapter Quiz — Complete all 6 topics to unlock
0/6 topics done
Complete these topics first: