TYEclipse/dsh-complex0

dsh-complex

Complex-number math toolbox for DeepSeek Harness (dsh): parse and format rectangular/polar/exponential forms, arithmetic (add, subtract, multiply, divide, conjugate, reciprocal, integer power), polar conversion, principal values of exp/log/sin/cos/tan/sinh/cosh/sqrt, and complete n-th roots — zero runtime dependencies

包名
dsh-complex
版本
0.1.0
许可证
MIT
最近更新
2026年9月8日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:TYEclipse/dsh-complex

Usage

Parse and convert

complex_parse("3+4i")
→ 3+4i  (rectangular; |z| = 5, arg = 53.1301023542°, conjugate 3-4i)

complex_convert(input="3+4i", operation="to_polar")
→ |z| = 5, arg = 0.927295218 rad = 53.1301023542°  (5∠53.1301023542°; exponential 5·e^(i·0.927295218))

complex_convert(input="2∠270°", operation="to_rect")
→ -2i

Arithmetic

complex_calc(a="3+4i", b="1-2i", operation="multiply")   → 11-2i
complex_calc(a="3+4i", b="1-2i", operation="divide")     → -1+2i
complex_calc(a="1+i", exponent=8, operation="power")     → 16

Principal values and roots

complex_functions(input="3.141592653589793i", operation="exp")  → -1        (Euler identity)
complex_functions(input="-1", operation="log")                   → 3.1415926536i  (iπ, principal branch)
complex_functions(input="-4", operation="sqrt")                  → 2i
complex_functions(input="i", operation="sqrt")                   → 0.7071067812+0.7071067812i

complex_roots(input="1", n=4)   → 1, i, -1, -i
complex_roots(input="-8", n=3)  → 1+1.7320508076i, -2, 1-1.7320508076i

Conventions

  • Input grammar: a+bi (or a-bi, bi, a, bare i; j also accepted; whitespace around the operator and the suffix is tolerated; scientific notation works; the imaginary coefficient may be omitted — 1+i is 1+1i).
  • Polar input: r∠θ° with θ in degrees (the ° or deg suffix is optional; negative angles accepted; r must be ≥ 0).
  • Principal branch: arg ∈ (-π, π]; log and sqrt report their branch convention in the result note.
  • log(0) and division by zero return an honest valid: false with an explanation instead of guessing.

Configuration

plugins:
  complex:
    roundPlaces: 10   # decimal places for every output number (1–15)