Skillpedia
تعلّم الآلة51k · #3579

sympy

ما الذي تفعله

تتيح هذه المهارة إجراء حسابات رياضية دقيقة باستخدام الرموز بدلاً من الأرقام التقريبية. تساعد في الجبر والتفاضل والتكامل وحل المعادلات، وحتى في الفيزياء.

متى تستخدمها

  • ✓عندما تحل معادلات مثل «x + 5 = 10» بدقة.
  • ✓عندما تحسب المشتقات أو التكاملات لدوال رياضية.
  • ✓عندما تبسّط تعبيرات رياضية معقدة.

رابط المهارة

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/sympy/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/sympy/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“حل المعادلة x^2 - 4 = 0 لإيجاد x.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تخبر الذكاء الاصطناعي بما تمثله الرموز (مثل «x» أو «y») ثم تكتب التعبير أو المعادلة الرياضية. يستخدم الذكاء الاصطناعي أداة SymPy لحساب النتيجة الدقيقة.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

SymPy - Symbolic Mathematics in Python

Overview

SymPy is a Python library for symbolic mathematics that enables exact computation using mathematical symbols rather than numerical approximations. This skill provides comprehensive guidance for performing symbolic algebra, calculus, linear algebra, equation solving, physics calculations, and code generation using SymPy.

Installation

Reviewed against current official documentation and executed with SymPy 1.14.0 on Python 3.13.3 (2026-10-01). Core SymPy requires Python 3.9+; the tested NumPy 2.5.3 / SciPy 1.18.1 stack needs Python 3.12+. SymPy 1.14.0 requires mpmath>=1.1,<1.4; use the compatible 1.3.0, not the newer 1.4.x release. See verification and official sources for coverage.

# Install SymPy using uv
uv pip install "sympy==1.14.0"

# Optional: for lambdify and plotting examples
uv pip install numpy scipy matplotlib

Check your version:

import sympy
print(sympy.__version__)

When to Use This Skill

Use this skill when:

  • Solving equations symbolically (algebraic, differential, systems of equations)
  • Performing calculus operations (derivatives, integrals, limits, series)
  • Manipulating and simplifying algebraic expressions
  • Working with matrices and linear algebra symbolically
  • Doing physics calculations (mechanics, quantum mechanics, vector analysis)
  • Number theory computations (primes, factorization, modular arithmetic)
  • Geometric calculations (2D/3D geometry, analytic geometry)
  • Converting mathematical expressions to executable code (Python, C, Fortran)
  • Generating LaTeX or other formatted mathematical output
  • Needing exact mathematical results (e.g., sqrt(2) not 1.414...)

Core Capabilities

Seven capability areas are documented in references/core_capabilities.md:

  1. Symbolic computation basics — symbols, expressions, simplification, substitution.
  2. Calculus — differentiation, integration, limits, series.
  3. Equation solving — solve, solveset, linear and nonlinear systems, ODEs.
  4. Matrices and linear algebra — see references/matrices-linear-algebra.md.
  5. Physics and mechanics — see references/physics-mechanics.md.
  6. Advanced mathematics — see references/advanced-topics.md.
  7. Code generation and output — see references/code-generation-printing.md.

Deeper treatment of the first three is in references/core-capabilities.md.

Working with SymPy: Best Practices

1. Always Define Symbols First

from sympy import symbols
x, y, z = symbols('x y z')
# Now x, y, z can be used in expressions

2. Use Assumptions for Better Simplification

from sympy import symbols, sqrt
x = symbols('x', positive=True, real=True)
sqrt(x**2)  # Returns x (not Abs(x)) due to positive assumption

Common assumptions: real, positive, negative, integer, rational, complex, even, odd

3. Use Exact Arithmetic

from sympy import Rational, S
# Correct (exact):
expr = Rational(1, 2) * x
expr = S(1)/2 * x

# Approximate (appropriate for measured/numerical inputs):
expr = 0.5 * x  # Creates approximate value

4. Numerical Evaluation When Needed

from sympy import pi, sqrt
result = sqrt(8) + pi
result.evalf()    # 5.96371554103586
result.evalf(50)  # Request 50 decimal digits; cannot recover precision lost in inputs

5. Convert to NumPy for Performance

from sympy import symbols, lambdify
import numpy as np
x = symbols("x")
expr = x**2 + 1
# Slow for many evaluations:
for x_val in range(1000):
    result = expr.subs(x, x_val).evalf()

# Fast:
f = lambdify(x, expr, 'numpy')
results = f(np.arange(1000))

6. Use Appropriate Solvers

  • solveset: Algebraic equations (primary)
  • linsolve: Linear systems
  • nonlinsolve: Nonlinear systems
  • dsolve: Differential equations
  • solve: General purpose; supports some problems solveset does not

…

الأسئلة الشائعة

ما الفرق بين هذه المهارة والآلة الحاسبة العادية؟

الآلات الحاسبة العادية تستخدم أرقاماً تقريبية (مثل 3.14159). أما هذه المهارة فتستخدم رموزاً دقيقة (مثل π أو الجذر التربيعي للعدد 2) للحصول على إجابات دقيقة.

هل يمكنني استخدام الأرقام والرموز معاً؟

نعم، يمكنك الجمع بين الأرقام والرموز. مثلاً، يمكنك أن تطلب تبسيط «2*x + 3*x».

هل تستطيع حل أي نوع من المسائل الرياضية؟

هي قوية جداً في الجبر والتفاضل والتكامل وبعض مجالات الفيزياء، لكنها قد لا تحل المسائل المعقدة جداً أو المتخصصة للغاية.

التفاصيل

الوصف الأصلي من المؤلف

Performs exact symbolic mathematics with SymPy for algebra, calculus, equation solving, symbolic linear algebra, physics, and lambdify or LaTeX code generation. Use when a task needs symbolic results, explicit assumptions, or exact arithmetic; use NumPy or SciPy for purely numerical workloads.

repo: K-Dense-AI/scientific-agent-skills

الشعبية

نجوم GitHub
51k
الترتيب
#3579
الترخيص
MIT
آخر تحديث
15‏/10‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة