math-skill 1.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.en-US.md +280 -0
  2. package/README.md +280 -278
  3. package/agents/math-critic.md +235 -203
  4. package/commands/abstraction.md +13 -34
  5. package/commands/algorithmic-thinking.md +13 -34
  6. package/commands/ask.md +20 -21
  7. package/commands/axiomatization.md +13 -34
  8. package/commands/causal-inference.md +13 -34
  9. package/commands/discrete-combinatorial.md +13 -34
  10. package/commands/game-theory.md +13 -34
  11. package/commands/induction-analogy.md +13 -34
  12. package/commands/information-theory.md +13 -34
  13. package/commands/logic-deduction.md +13 -34
  14. package/commands/modeling.md +13 -37
  15. package/commands/optimization.md +13 -33
  16. package/commands/probability-statistics.md +13 -36
  17. package/commands/symmetry-invariance.md +13 -34
  18. package/commands/topological-thinking.md +13 -33
  19. package/commands/transformation.md +13 -33
  20. package/knowledge-base/overview.md +228 -230
  21. package/package.json +71 -59
  22. package/references/agentic-workflow.md +53 -0
  23. package/references/books/abstract-algebra.md +120 -0
  24. package/references/books/algebraic-geometry-rising-sea.md +167 -0
  25. package/references/books/differential-geometry.md +136 -0
  26. package/references/books/matrix-analysis.md +142 -0
  27. package/references/books/micro-lie-theory.md +112 -0
  28. package/references/books/optimization-ml.md +160 -0
  29. package/references/books/smooth-manifolds.md +101 -0
  30. package/references/gpu-friendly-math.md +65 -0
  31. package/skills/abstraction/SKILL.md +119 -264
  32. package/skills/algorithmic-thinking/SKILL.md +136 -371
  33. package/skills/axiomatization/SKILL.md +149 -213
  34. package/skills/causal-inference/SKILL.md +149 -374
  35. package/skills/discrete-combinatorial/SKILL.md +129 -286
  36. package/skills/game-theory/SKILL.md +121 -318
  37. package/skills/induction-analogy/SKILL.md +150 -310
  38. package/skills/information-theory/SKILL.md +138 -242
  39. package/skills/logic-deduction/SKILL.md +133 -280
  40. package/skills/math-research-activator/SKILL.md +134 -0
  41. package/skills/{meta-selector → math-research-activator}/original-texts.md +104 -104
  42. package/skills/modeling/SKILL.md +137 -318
  43. package/skills/optimization/SKILL.md +133 -292
  44. package/skills/probability-statistics/SKILL.md +149 -312
  45. package/skills/symmetry-invariance/SKILL.md +137 -358
  46. package/skills/topological-thinking/SKILL.md +126 -273
  47. package/skills/transformation/SKILL.md +122 -264
  48. package/docs/CLAUDE.md +0 -187
  49. package/skills/meta-selector/SKILL.md +0 -188
  50. /package/{docs → references}/inspiration.md +0 -0
@@ -1,264 +1,122 @@
1
- ---
2
- name: transformation
3
- description: |
4
- 触发条件:
5
- 科研模式:数学推导、方程求解、信号处理等问题在当前表示下难以处理,需要通过数学变换将其转化为更简单的等价问题。
6
- 生活模式:日常问题解决中换个角度思考,将看似棘手的问题从不同视角重新审视,使困难消失或变得可解。
7
- English:
8
- Research mode: Trigger for mathematical derivation, equation solving, signal processing — when a problem is intractable in its current representation and needs mathematical transformation into an equivalent simpler problem.
9
- Life mode: Trigger for daily problem-solving, changing perspective, reframing problems — viewing a seemingly thorny problem from a different angle so the difficulty vanishes or becomes tractable.
10
- ---
11
-
12
- # 🔄 变换思想 / Transformation Thinking
13
-
14
- > "复杂问题→等价简单问题,关键是找到合适的变换和逆变换。"
15
- > "Complex problem equivalent simple problem; the key is finding the right transformation and its inverse."
16
- >
17
- > "变换的精髓不是改变问题本身,而是改变我们看问题的视角。"
18
- > "The essence of transformation is not changing the problem itself, but changing our perspective on the problem."
19
- >
20
- > —— 傅里叶变换、拉普拉斯变换、坐标变换 / Fourier Transform, Laplace Transform, Coordinate Transformation
21
-
22
- ## 核心原则 / Core Principle
23
-
24
- **同一个问题可以有不同的表示方式。选择一个好的表示(或变换),可以让困难的问题变得简单。变换的精髓不是改变问题本身,而是改变我们看问题的视角。**
25
-
26
- **The same problem can be represented in different ways. Choosing a good representation (or transformation) can make a difficult problem simple. The essence of transformation is not changing the problem itself, but changing our perspective on the problem.**
27
-
28
- > **数学形式化 / Mathematical Formalization**(科研模式参考 / Research Mode Reference)
29
- >
30
- > 设变换 T: D₁ D₂,T 有用当且仅当三个条件同时成立:
31
- > 1. T 可计算:对 D₁ 中元素 x,T(x) 可以显式求出
32
- > 2. 简化性:问题在 D₂ 中比在 D₁ 中更容易处理(如微分→乘法、卷积→乘法)
33
- > 3. T⁻¹ 存在:可以从 D₂ 的解恢复 D₁ 的原解
34
- >
35
- > Let T: D₁ D₂. T is useful iff three conditions hold simultaneously:
36
- > 1. T is computable: for x ∈ D₁, T(x) can be explicitly obtained
37
- > 2. Simplification: the problem is easier in D₂ (e.g., differentiation → multiplication, convolution → multiplication)
38
- > 3. T⁻¹ exists: the original solution in D₁ can be recovered from D₂
39
- >
40
- > 核心追问:**T⁻¹ 在什么条件下存在?** 这是变换思想最本质的数学问题——存在性决定等价性,收敛域决定有效性。
41
- >
42
- > Key question: **Under what conditions does T⁻¹ exist?** This is the most essential mathematical question of transformation — existence determines equivalence, convergence domain determines validity.
43
- >
44
- > 变换的核心性质:
45
- > - **等价性**:变换前后的问题是等价的(信息不丢失),要求 T⁻¹ 存在 / **Equivalence**: the problem before and after transform is equivalent (no information loss), requiring T⁻¹ to exist
46
- > - **简化性**:变换后的问题更容易处理 / **Simplification**: the problem is easier to handle after transform
47
- > - **可逆性**:T⁻¹ 存在且可计算时,变换是等价的而非近似的 / **Invertibility**: when T⁻¹ exists and is computable, the transform is equivalent rather than approximate
48
-
49
- ## 不适用场景 / When NOT to Use
50
-
51
- - **问题已经足够简单**——不需要变换 `[通用]` / The problem is already simple enough — no transformation needed `[General]`
52
- - **变换会丢失关键信息**(如不可逆变换且丢失的信息正是关心的)——需要选择保信息的变换 `[科研]` / Transformation loses critical information — choose an information-preserving transform `[Research]`
53
- - **只需要定性理解**——变换通常是定量工具 `[科研]` / Only qualitative understanding is needed — transformation is typically a quantitative tool `[Research]`
54
- - **收敛条件不满足**——强行变换会产生无意义结果 `[科研]` / Convergence conditions are not met — forcing a transform yields meaningless results `[Research]`
55
- - **换视角变成逃避现实**——不是所有问题换个角度就能解决,切换视角的前提是新视角确实能简化问题 `[生活]` / Perspective-switching becomes escapism — not all problems become easier from a different angle; the premise is that the new perspective genuinely simplifies `[Life]`
56
- - **新视角的结论回不到原问题**——视角切换必须可逆,否则你只是在另一个世界里自嗨 `[生活]` / Conclusions from the new perspective can't translate back — perspective switching must be reversible, otherwise you're just wandering in another world `[Life]`
57
-
58
- ## 何时使用 / When to Use
59
-
60
- ### 科研触发条件 / Research Triggers
61
-
62
- - 一个问题在当前形式下难以分析或求解 / A problem is hard to analyze or solve in its current form
63
- - 想要揭示数据的隐藏结构(如周期信号→频谱) / Revealing hidden structure in data (e.g., periodic signal → frequency spectrum)
64
- - 需要将复杂运算简化为简单运算(如卷积→乘法) / Simplifying complex operations (e.g., convolution multiplication)
65
- - 需要将非线性问题线性化 / Linearizing nonlinear problems
66
- - 需要解耦耦合变量 / Decoupling coupled variables
67
-
68
- ### 生活触发条件 / Life Triggers
69
-
70
- - 当前视角下问题显得无解或过于复杂,直觉告诉你换个角度看会不同 / The problem seems unsolvable or overly complex from the current angle, and intuition suggests a different perspective could help
71
- - 反复尝试同一方法失败,需要跳出思维惯性 / Repeated failures with the same approach — need to break out of thinking inertia
72
- - 问题包含了多个相互纠缠的要素,换个视角可能让纠缠变清晰 / Multiple intertwined factors in the problem — a different perspective may untangle them
73
- - 需要把短期困扰放到长期视野中理解 / Need to understand a short-term difficulty in a long-term perspective
74
-
75
- ## 方法流程 / Method
76
-
77
- ### 第一步:分析当前表示的困难 / Step 1: Analyze Difficulty in Current Representation
78
-
79
- #### 科研模式 / Research Mode
80
-
81
- 为什么当前形式难以处理?/ Why is the current form hard to handle?
82
- - 运算复杂?(如微分方程直接求解困难)/ Complex operations? (e.g., solving differential equations directly)
83
- - 结构不清晰?(如时域看不出周期性)/ Unclear structure? (e.g., periodicity invisible in time domain)
84
- - 变量耦合?(如多变量相互依赖)/ Coupled variables? (e.g., mutual dependencies among variables)
85
-
86
- #### 生活模式 / Life Mode
87
-
88
- 当前视角下问题的困难在哪?是什么让你觉得棘手——是太复杂、太模糊、还是方向不对?/ What is the difficulty in the current perspective? What makes it feel tricky — is it too complex, too vague, or is the direction wrong?
89
-
90
- #### 共通要点 / Common Insight
91
-
92
- 明确"困难在哪里"是选择变换的前提。不诊断困难就选变换,是盲目操作。/ Identifying "where the difficulty lies" is the prerequisite for choosing a transformation. Choosing a transform without diagnosing the difficulty is blind operation.
93
-
94
- ### 第二步:选择变换 / Step 2: Choose the Transformation
95
-
96
- #### 科研模式 / Research Mode
97
-
98
- 根据困难类型选择变换,每种变换必须检查其公式、域映射、收敛条件与简化效果。/ Choose based on difficulty type; for each transform, check formula, domain mapping, convergence conditions, and simplification effect.
99
-
100
- | 变换 / Transform | 公式 / Formula | 域映射 / Domain Mapping | 收敛/有效性条件 / Convergence/Validity | 简化效果 / Simplification |
101
- |---|---|---|---|---|
102
- | 傅里叶变换 Fourier | F(ω) = ∫₋∞⁺∞ f(t)e⁻ⁱωᵗdt | t ∈ ℝ → ω ∈ ℝ | Dirichlet条件:f绝对可积、有限极值点数、有限间断点数 | 微分→乘法,卷积→乘法 |
103
- | 拉普拉斯变换 Laplace | F(s) = ∫₀⁺∞ f(t)e⁻ˢᵗdt | t ∈ [0,∞) → s ∈ ℂ, Re(s)>α | ∃α: ∫₀⁺∞ |f(t)|e⁻αᵗdt < ∞ (Re(s)>α 时收敛) | 常系数ODE→代数方程,含初值 |
104
- | Z变换 Z-transform | F(z) = Σₙ₌₀⁺∞ f[n]z⁻ⁿ | n ∈ ℕ → z ∈ ℂ, |z|>R | ∃R: Σ|f[n]|R⁻ⁿ < ∞ (|z|>R 时收敛) | 差分方程→代数方程 |
105
- | 生成函数 Generating | G(x) = Σₙ₌₀⁺∞ aₙxⁿ | n ∈ ℕ → x ∈ ℝ, |x|<ρ | ∃ρ: Σ|aₙ|ρⁿ收敛 (|x|<ρ时) | 递推关系→微分方程 |
106
- | Legendre变换 Legendre | f*(p) = supₓ(px − f(x)) | x → p = f'(x) | f凸且可微时 p↔x 一一对应 | 凸优化→对偶问题,Lagrange力学→Hamilton力学 |
107
- | 小波变换 Wavelet | W(a,b) = ∫ f(t)ψₐᵇ(t)dt, ψₐᵇ=(1/√a)ψ((t−b)/a) | t ∈ ℝ → (a,b) ∈ ℝ⁺×ℝ | f ∈ L²(ℝ), ψ容许:∫|Ψ(ω)|²/|ω|dω<∞ | 时频局部化,多尺度分析 |
108
-
109
- #### 生活模式 / Life Mode
110
-
111
- 有没有一个完全不同的视角让问题变得简单?常见的视角切换:/ Is there a completely different perspective that makes the problem simple? Common perspective switches:
112
-
113
- - **时间→频率**(看趋势而非细节)/ **Time → Frequency**: see trends rather than details
114
- - **局部→整体**(看大图而非细节)/ **Local Global**: see the big picture rather than details
115
- - **过程→结果**(看终点而非路径)/ **Process → Outcome**: see the destination rather than the path
116
- - **表面→本质**(看结构而非外观)/ **Surface → Essence**: see structure rather than appearance
117
-
118
- #### 共通要点 / Common Insight
119
-
120
- 变换的选择必须针对第一步诊断的困难。不同困难对应不同变换。/ The transformation must target the difficulty diagnosed in Step 1. Different difficulties correspond to different transformations.
121
-
122
- ### 第三步:执行变换 / Step 3: Apply the Transformation
123
-
124
- #### 科研模式 / Research Mode
125
-
126
- 将问题变换到新的表示空间,严格按公式执行。/ Transform the problem to the new representation space, executing strictly by formula.
127
-
128
- #### 生活模式 / Life Mode
129
-
130
- 在新视角下重新描述你的问题——同一个问题用不同语言讲述时,困难可能消失了。/ Redescribe your problem under the new perspective — when the same problem is told in a different language, the difficulty may vanish.
131
-
132
- #### 共通要点 / Common Insight
133
-
134
- 变换/视角切换不是逃避问题,而是用一种更有效的语言重新表达同一个问题。/ Transformation/perspective-switching is not escaping the problem but re-expressing the same problem in a more effective language.
135
-
136
- ### 第四步:验证收敛与域条件 / Step 4: Verify Convergence and Domain Conditions
137
-
138
- #### 科研模式 / Research Mode
139
-
140
- **在应用变换结果之前,必须验证收敛条件是否满足。** / **Before applying transform results, convergence conditions must be verified.**
141
-
142
- - 傅里叶变换:检查 f(t) 是否满足 Dirichlet 条件(绝对可积 ∫|f(t)|dt < ∞,有限极值点,有限间断点);不满足则 F(ω) 无意义
143
- - 拉普拉斯变换:确定收敛域 Re(s) > α;所有运算必须在收敛域内进行,F(s) 在收敛域外无定义
144
- - Z变换:确定收敛域 |z| > R;逆变换依赖收敛域的选择
145
- - 生成函数:确定收敛半径 ρ;|x| < ρ 时级数才有意义
146
- - 小波变换:验证母小波 ψ 的容许条件 ∫|Ψ(ω)|²/|ω|dω < ∞
147
-
148
- #### 生活模式 / Life Mode
149
-
150
- 这个新视角在什么条件下才有效?不是所有问题换个角度就能解决——确认你的问题满足视角切换的前提。/ Under what conditions is this new perspective valid? Not all problems become solvable by changing angle — confirm your problem satisfies the prerequisites for perspective switching.
151
-
152
- #### 共通要点 / Common Insight
153
-
154
- 任何变换/视角切换都有适用条件。跳过这一步是最大的错误来源。/ Any transformation/perspective switch has applicability conditions. Skipping this step is the biggest source of error.
155
-
156
- ### 第五步:在变换空间求解 / Step 5: Solve in the Transformed Space
157
-
158
- #### 科研模式 / Research Mode
159
-
160
- 在新表示下,问题往往变得更简单。所有运算必须在变换的有效域内进行。/ In the new representation, the problem is often simpler. All operations must stay within the transform's valid domain.
161
-
162
- #### 生活模式 / Life Mode
163
-
164
- 在新视角下分析——原来难以看到的模式、结构、解决方案可能变得一目了然。/ Analyze under the new perspective — patterns, structures, and solutions that were hard to see may become immediately clear.
165
-
166
- #### 共通要点 / Common Insight
167
-
168
- 变换空间/新视角的价值在于让原本隐蔽的结构变得可见。/ The value of the transformed space / new perspective is making previously hidden structures visible.
169
-
170
- ### 第六步:逆变换回原空间 / Step 6: Inverse Transform Back
171
-
172
- #### 科研模式 / Research Mode
173
-
174
- 将解逆变换回原问题的语言。逆变换的存在性需要条件:/ Translate the solution back via inverse transform. Inverse existence requires conditions:
175
-
176
- - 傅里叶逆变换:f(t) = (1/2π)∫₋∞⁺∞ F(ω)eⁱωᵗdω,需要 F(ω) 绝对可积
177
- - 拉普拉斯逆变换:f(t) = (1/2πi)∫ᵧ₋ⁱ∞ᵧ₊ⁱ∞ F(s)eˢᵗds (Bromwich积分),γ > α 确保积分路径在收敛域右侧
178
- - Z逆变换:f[n] = (1/2πi)∮ F(z)zⁿ⁻¹dz,围道必须在收敛域内
179
- - 生成函数逆映射:aₙ = G⁽ⁿ⁾(0)/n!(泰勒展开系数),或 [xⁿ]G(x)
180
-
181
- #### 生活模式 / Life Mode
182
-
183
- 把新视角的结论翻译回原来的问题语言——确保换角度看问题不是逃避,而是真的找到了解决路径。/ Translate conclusions from the new perspective back into the original problem's language — ensure that perspective-switching is not escapism but a genuine solution path.
184
-
185
- #### 共通要点 / Common Insight
186
-
187
- 变换只是手段,最终答案必须在原空间。逆变换/翻译回原问题这一步不可省略。/ Transformation is only a tool; the final answer must be in the original space. The inverse transform / translation-back step cannot be omitted.
188
-
189
- ### 第七步:验证等价性 / Step 7: Verify Equivalence
190
-
191
- #### 科研模式 / Research Mode
192
-
193
- 确认变换过程没有丢失关键信息,逆变换的结果确实是原问题的解。检查:/ Confirm no critical information was lost, and the inverse result is indeed the solution. Check:
194
- - 逆变换是否在收敛域内执行 / Was inverse executed within convergence domain?
195
- - 原函数是否满足变换的前置条件 / Does the original function satisfy transform prerequisites?
196
- - 边界条件/初值条件是否被正确编码 / Were boundary/initial conditions correctly encoded?
197
-
198
- #### 生活模式 / Life Mode
199
-
200
- 验证切换视角没有丢失关键信息——新视角的结论回到原问题时,是否真的解决了原问题?/ Verify that perspective-switching did not lose critical information — when the conclusion from the new perspective returns to the original problem, does it genuinely solve it?
201
-
202
- #### 共通要点 / Common Insight
203
-
204
- 等价性是变换思想的底线。变换/视角切换必须是可验证的等价操作,而非近似或逃避。/ Equivalence is the baseline of transformation thinking. A transformation / perspective switch must be a verifiable equivalent operation, not an approximation or escapism.
205
-
206
- ## 常见错误 / Common Errors
207
-
208
- | 错误 / Error | 批评 / Critique | 正确做法 / Correct Approach |
209
- |---|---|---|
210
- | 选择不合适的变换 `[科研]` / Choosing an unsuitable transform `[Research]` | 变换没有简化问题,反而增加复杂度 / Transform adds complexity instead of simplifying | 根据问题特征选择变换 / Choose transform based on problem characteristics |
211
- | 使用不可逆变换且丢失信息 `[科研]` / Using irreversible transform that loses information `[Research]` | 变换后无法回到原问题 / Cannot return to original problem after transform | 检查变换是否可逆,或确认丢失的信息不重要 / Verify invertibility or confirm lost info is irrelevant |
212
- | 忘记逆变换 `[通用]` / Forgetting the inverse transform `[General]` | 在新空间得到解后忘记变回来 / Solution in new space not translated back | 变换只是手段,最终答案必须在原空间 / Transform is a tool; final answer must be in original space |
213
- | 变换后忽略定义域变化 `[科研]` / Ignoring domain changes after transform `[Research]` | 变换可能改变定义域或引入奇异点 / Transform may change domain or introduce singularities | 检查变换后的定义域和边界条件 / Check transformed domain and boundary conditions |
214
- | 把变换当魔法 `[通用]` / Treating transform as magic `[General]` | 变换只是换了表示,没有改变问题本质 / Transform only changes representation, not the problem itself | 变换是工具,理解力才是核心 / Transform is a tool; understanding is fundamental |
215
- | 对不可积函数用傅里叶变换 `[科研]` / Applying Fourier transform to non-integrable functions `[Research]` | ∫|f(t)|dt = ∞ 时 F(ω) 可能不存在或无意义 / F(ω) may not exist or be meaningless when ∫|f(t)|dt = ∞ | 先检查 Dirichlet 条件,不满足时考虑广义函数或Laplace / Check Dirichlet conditions first; if unsatisfied, use generalized functions or Laplace |
216
- | 忽略Laplace收敛域 `[科研]` / Ignoring Laplace convergence domain `[Research]` | F(s)仅在Re(s)>α有定义,域外运算无意义 / F(s) is defined only for Re(s)>α; operations outside are meaningless | 明确收敛域,所有运算限制在Re(s)>α内 / Specify convergence domain; restrict all operations to Re(s)>α |
217
- | 假设所有变换可逆 `[科研]` / Assuming all transforms are invertible `[Research]` | 部分变换在特定条件下不可逆(如非凸函数的Legendre变换) / Some transforms are non-invertible under certain conditions | 验证可逆条件后再执行逆变换 / Verify invertibility conditions before applying inverse |
218
- | 忽略离散变换(DFT/FFT) `[科研]` / Ignoring discrete transforms (DFT/FFT) `[Research]` | 连续变换不适用于离散数据,强行使用引入误差 / Continuous transforms unsuitable for discrete data; forced use introduces error | 对离散数据使用DFT: X[k]=Σx[n]e⁻ⁱ2πkn/N / Use DFT for discrete data |
219
- | 换视角变成逃避现实 `[生活]` / Perspective-switching becomes escapism `[Life]` | 不是换个角度看就能解决所有问题,逃避不等于变换 / Not all problems are solved by changing perspective; escapism ≠ transformation | 确认新视角确实简化了问题,而非回避了问题 / Confirm the new perspective genuinely simplifies, rather than avoids, the problem |
220
- | 新视角的结论回不到原问题 `[生活]` / Conclusions from new perspective can't translate back `[Life]` | 在新视角里找到了"答案"但无法落实到原问题的行动中 / Found an "answer" in the new perspective but can't translate it into actions for the original problem | 确保视角切换是可逆的——必须能翻译回原问题的语言 / Ensure perspective switch is reversible — must be able to translate back into the original problem's language |
221
- | 强行套用不适用的视角 `[生活]` / Forcing an inapplicable perspective `[Life]` | 不是所有视角切换都有效,前提条件不满足时换视角毫无意义 / Not all perspective switches are effective; when prerequisites fail, switching is meaningless | 先验证新视角的适用条件(第四步不可跳过) / Verify applicability conditions of the new perspective first (Step 4 cannot be skipped) |
222
-
223
- ## 操作规程 / Operating Procedure
224
-
225
- 当本 skill 被触发时,首先判断模式:/ When this skill is triggered, first determine the mode:
226
-
227
- - **科研模式**:涉及数学推导、方程求解、信号处理等定量问题 → 使用科研模式输出格式 / **Research Mode**: involves mathematical derivation, equation solving, signal processing, etc. → use Research output format
228
- - **生活模式**:涉及日常问题解决、视角切换、困难重构等定性问题 → 使用生活模式输出格式 / **Life Mode**: involves daily problem-solving, perspective switching, difficulty reframing, etc. → use Life output format
229
-
230
- ---
231
-
232
- ### 科研模式输出格式 / Research Mode Output Format
233
-
234
- 1. **当前表示的困难**:描述为什么当前形式难以处理 `[困难]: [描述]`
235
- 2. **变换选择**:`[变换]: [选择] 因为 [理由],公式为 [公式],收敛条件为 [条件],预期简化效果是 [效果]`
236
- 3. **变换执行**:描述变换后的问题形式
237
- 4. **收敛与域条件验证**:`[验证]: [条件是否满足,收敛域是什么]`
238
- 5. **变换空间中的求解**:在新表示下的解法
239
- 6. **逆变换**:将解翻译回原空间,注明逆变换条件
240
- 7. **等价性验证**:验证变换是否可逆、是否丢失信息、收敛域是否正确
241
-
242
- **输出必须包含以上 7 项,不得只输出分析性文字而不给出结论。每项必须含具体数学内容,不得仅写概述。**
243
-
244
- ---
245
-
246
- ### 生活模式输出格式 / Life Mode Output Format
247
-
248
- 1. **[当前困难]: [描述]** — 当前视角下问题的核心困难是什么 / What is the core difficulty under the current perspective
249
- 2. **[新视角]: [切换方向]** — 选择一个不同的视角(时间→频率、局部→整体、表面→本质等) / Choose a different perspective (time→frequency, local→global, surface→essence, etc.)
250
- 3. **[新视角下的分析]: [洞察]** — 在新视角下问题呈现什么新特征 / What new features does the problem reveal under the new perspective
251
- 4. **[视角有效性]: [条件]** — 这个新视角在什么条件下才有效 / Under what conditions is this new perspective valid
252
- 5. **[回到原问题]: [翻译]** — 把新视角的结论翻译回原问题语言 / Translate conclusions from the new perspective back into the original problem's language
253
- 6. **[行动建议]: [具体步骤]** — 明确写出"接下来我将……" / Explicitly write out "Next I will..."
254
-
255
- **输出必须包含以上 6 项,不得只输出感悟性文字而不给出行动建议。每项必须含具体内容,不得仅写抽象原则。**
256
-
257
- ## 与其他 skill 的关系 / Relations to Other Skills
258
-
259
- - **抽象化思想**:变换也是一种抽象——在新的结构中表示同一个对象
260
- - **对称与不变性**:变换下保持不变的性质就是对变换的对称性
261
- - **优化思想**:变换到对偶空间有时使优化更容易
262
- - **建模思想**:变换常常是模型求解的关键步骤
263
- - **算法思想**:FFT将DFT的O(N²)复杂度降为O(N log N),是变换思想在计算效率上的体现
264
- - **信息论思想**:编码即变换——信源编码将信息变换为高效表示,信道编码变换为抗干扰表示
1
+ ---
2
+ name: transformation
3
+ description: |
4
+ 触发:数学推导、方程求解、信号处理等问题在当前表示下难处理,需通过数学变换转为更简单的等价问题;或为算法/算子设计寻找等价但更 GPU 友好的表示(如卷积→GEMM、谱变换)时调用。
5
+ English: Trigger when a problem is intractable in its current representation and needs a mathematical transform into an equivalent simpler problem; or finding an equivalent but more GPU-friendly representation (e.g. convolution→GEMM, spectral transform) for algorithm/operator design.
6
+ ---
7
+
8
+ # 🔄 变换思想 / Transformation
9
+
10
+ > "复杂问题→等价简单问题,关键是找到合适的变换和逆变换。"
11
+ > "Complex problem → equivalent simple problem; the key is finding the right transformation and its inverse."
12
+ >
13
+ > —— 傅里叶变换、拉普拉斯变换、坐标变换 / Fourier, Laplace, Coordinate Transform
14
+
15
+ ## 核心原则 / Core Principle
16
+
17
+ **同一个问题可以有不同的表示方式。选择一个好的表示(或变换),可以让困难的问题变得简单。** 变换的精髓不是改变问题本身,而是改变看问题的视角。
18
+
19
+ > **数学形式化 / Mathematical Formalization**
20
+ >
21
+ > 设变换 T: D₁ → D₂,T 有用当且仅当三条件同时成立:① **可计算**:T(x) 可显式求出;② **简化性**:问题在 D₂ 中更易处理(如微分→乘法、卷积→乘法);③ **T⁻¹ 存在**:可从 D₂ 的解恢复 D₁ 原解。
22
+ >
23
+ > 核心追问:**T⁻¹ 在什么条件下存在?** 存在性决定等价性,收敛域决定有效性。性质:等价性(信息不丢失,需 T⁻¹ 存在)、简化性、可逆性(T⁻¹ 存在且可计算时为等价而非近似)。
24
+
25
+ ## GPU 友好性 / GPU-Friendliness(横切检查)
26
+
27
+ 变换的价值在算法设计中常体现为「把不友好的运算变成 GPU 友好的运算」——过 `../../references/gpu-friendly-math.md` 八维:
28
+
29
+ - **卷积→GEMM**(im2col/Winograd):把不规则卷积变成矩阵乘,吃满 Tensor Core(友好,但注意显存扩张)。
30
+ - **谱变换(FFT/DCT)**:O(N²)→O(N log N),可批量并行;但 butterfly 通信模式需注意访存。
31
+ - **对偶变换(Legendre/Fenchel)**:把约束优化变成对偶问题——若对偶更易 GEMM 化则友好。
32
+ - **变换作为压缩**:频域稀疏→只存显著系数(KV/激活压缩,友好)。
33
+ - **反模式**:变换本身需 O(n²) 全局重排且不可融合→"美但不可算";逆变换不可数值稳定(病态)。
34
+
35
+ 八维最低判定(正式术语):**张量化**看变换/逆变换是否可批量;**GEMM 可映射**看能否改写为 GEMM/conv/FFT/batched solve;**复杂度**要求变换后降阶而非升阶;**显存与 KV-Cache**检查 im2col、频域缓存、块摘要是否省而不是爆;**低精度稳定**检查逆变换、正交化、归一化;**并行与通信**看 butterfly/scan/分块通信;**稀疏结构**看频域/块稀疏是否结构化;**算子融合**看变换-核心算子-逆变换能否融合或重计算。
36
+
37
+ > 配合 `../../references/books/matrix-analysis.md`(谱/低秩)、`optimization-ml.md`(对偶)。
38
+
39
+ ## 不适用场景 / When NOT to Use
40
+
41
+ - **问题已足够简单**——不需要变换。
42
+ - **变换会丢失关键信息**(不可逆且丢失的正是关心的)——选保信息的变换。
43
+ - **只需定性理解**——变换通常是定量工具。
44
+ - **收敛条件不满足**——强行变换产生无意义结果。
45
+
46
+ ## 何时使用 / When to Use
47
+
48
+ - 问题在当前形式下难分析或求解;揭示数据隐藏结构(周期信号→频谱)。
49
+ - 将复杂运算简化为简单运算(卷积→乘法);非线性问题线性化;解耦耦合变量。
50
+ - **为算子寻找等价但更 GPU 友好的表示**(卷积→GEMM、稀疏→结构化、频域压缩)。
51
+
52
+ ## 方法流程 / Method
53
+
54
+ ### 第一步:分析当前表示的困难
55
+ 为什么当前形式难处理?运算复杂(如 ODE 直接求解难)?结构不清晰(时域看不出周期)?变量耦合?明确"困难在哪"是选择变换的前提,不诊断就选变换是盲目操作。
56
+
57
+ ### 第二步:选择变换
58
+ 根据困难类型选择,每种检查公式、域映射、收敛条件、简化效果:
59
+
60
+ | 变换 | 公式 | 域映射 | 收敛/有效性 | 简化效果 |
61
+ |---|---|---|---|---|
62
+ | 傅里叶 Fourier | F(ω)=∫f(t)e⁻ⁱωᵗdt | t∈ℝ→ω∈ℝ | Dirichlet:绝对可积、有限极值/间断点 | 微分→乘法,卷积→乘法 |
63
+ | 拉普拉斯 Laplace | F(s)=∫₀∞f(t)e⁻ˢᵗdt | t∈[0,∞)→s∈ℂ, Re(s)>α | ∃α: ∫|f(t)|e⁻αᵗdt<∞ | 常系数ODE→代数方程,含初值 |
64
+ | Z 变换 | F(z)=Σf[n]z⁻ⁿ | n∈ℕ→z∈ℂ, |z|>R | ∃R: Σ|f[n]|R⁻ⁿ<∞ | 差分方程→代数方程 |
65
+ | 生成函数 | G(x)=Σaₙxⁿ | n∈ℕ→x, |x|<ρ | ∃ρ: Σ|aₙ|ρⁿ收敛 | 递推→微分方程 |
66
+ | Legendre | f*(p)=supₓ(px−f(x)) | x→p=f'(x) | f 凸可微时 p↔x 一一对应 | 凸优化→对偶,Lagrange→Hamilton |
67
+ | 小波 Wavelet | W(a,b)=∫f(t)ψₐᵇ(t)dt | t∈ℝ→(a,b) | f∈L², ψ 容许 | 时频局部化,多尺度 |
68
+
69
+ ### 第三步:执行变换
70
+ 将问题变换到新表示空间,严格按公式执行。变换不是逃避问题,是用更有效的语言重新表达同一问题。
71
+
72
+ ### 第四步:验证收敛与域条件
73
+ **应用变换结果前必须验证收敛条件**:傅里叶检查 Dirichlet(∫|f|dt<∞);拉普拉斯定收敛域 Re(s)>α,域外 F(s) 无定义;Z 变换定 |z|>R(逆变换依赖收敛域选择);生成函数定收敛半径 ρ;小波验证母小波容许条件。跳过此步是最大错误来源。
74
+
75
+ ### 第五步:在变换空间求解
76
+ 在新表示下问题往往更简单,所有运算须在变换有效域内进行。变换空间的价值在于让原本隐蔽的结构可见。
77
+
78
+ ### 第六步:逆变换回原空间
79
+ 将解逆变换回原问题语言,逆变换存在性需条件:傅里叶逆 f(t)=(1/2π)∫F(ω)eⁱωᵗdω(需 F 绝对可积);拉普拉斯逆 Bromwich 积分 f(t)=(1/2πi)∫F(s)eˢᵗds(γ>α 在收敛域右侧);Z 逆 f[n]=(1/2πi)∮F(z)zⁿ⁻¹dz(围道在收敛域内);生成函数 aₙ=G⁽ⁿ⁾(0)/n! 或 [xⁿ]G(x)。变换只是手段,最终答案必须在原空间。
80
+
81
+ ### 第七步:验证等价性
82
+ 确认变换未丢关键信息、逆变换结果确是原问题解:逆变换是否在收敛域内执行?原函数是否满足前置条件?边界/初值条件是否正确编码?等价性是变换思想的底线——变换必须是可验证的等价操作,而非近似或逃避。
83
+
84
+ ## 常见错误 / Common Errors
85
+
86
+ | 错误 / Error | 批评 / Critique | 正确做法 / Correct Approach |
87
+ |---|---|---|
88
+ | 选择不合适的变换 | 没简化反而增加复杂度 | 根据问题特征选择变换 |
89
+ | 用不可逆变换且丢信息 | 变换后无法回到原问题 | 检查可逆性或确认丢失信息不重要 |
90
+ | 忘记逆变换 | 新空间得解后忘记变回来 | 最终答案必须在原空间 |
91
+ | 变换后忽略定义域变化 | 变换可能改定义域或引入奇点 | 检查变换后定义域与边界条件 |
92
+ | 把变换当魔法 | 变换只换表示,不改问题本质 | 变换是工具,理解力才是核心 |
93
+ | 对不可积函数用傅里叶 | ∫|f|dt=∞ 时 F(ω) 可能无意义 | 先检查 Dirichlet,不满足用广义函数或 Laplace |
94
+ | 忽略 Laplace 收敛域 | F(s) Re(s)>α 有定义 | 所有运算限制在收敛域内 |
95
+ | 假设所有变换可逆 | 部分变换特定条件下不可逆(如非凸 Legendre) | 验证可逆条件后再逆变换 |
96
+ | 忽略离散变换 DFT/FFT | 连续变换不适用离散数据 | 离散数据用 DFT: X[k]=Σx[n]e⁻ⁱ2πkn/N |
97
+ | 变换后不可算/不可融合 | 变换需 O(n²) 全局重排或病态逆 | 评估 GPU 八维,必要时选可融合/数值稳定的等价变换 |
98
+
99
+ ## 操作规程 / Operating Procedure
100
+
101
+ 输出必须包含:
102
+
103
+ 1. **当前表示的困难**:`[困难]: [描述]`
104
+ 2. **变换选择**:`[变换]: [选择] [理由],公式 [公式],收敛条件 [条件],预期简化 [效果]`
105
+ 3. **变换执行**:变换后的问题形式
106
+ 4. **收敛与域条件验证**:`[验证]: [条件是否满足,收敛域]`
107
+ 5. **变换空间求解**:新表示下的解法
108
+ 6. **逆变换**:解翻译回原空间,注明逆变换条件
109
+ 7. **等价性验证**:是否可逆、是否丢信息、收敛域是否正确
110
+ 8. **[GPU 可行性]**(若用于算子设计)— 变换是否把运算变成 GEMM/可融合/数值稳定,过八维门
111
+
112
+ **输出不得只给分析而无结论。**
113
+
114
+ ## 与其他 skill 的关系 / Relations to Other Skills
115
+
116
+ - **抽象化思想**:变换也是一种抽象——在新结构中表示同一对象。
117
+ - **对称与不变性**:变换下保持不变的性质就是对变换的对称性。
118
+ - **优化思想**:变换到对偶空间有时使优化更容易。
119
+ - **建模思想**:变换常是模型求解的关键步骤。
120
+ - **算法思想**:FFT DFT O(N²) 降为 O(N log N),是变换思想在计算效率上的体现。
121
+ - **信息论思想**:编码即变换——信源编码变换为高效表示,信道编码变换为抗干扰表示。
122
+ - **现代数学激活**:`../../references/books/matrix-analysis.md`(谱/低秩变换)、`algebraic-geometry-rising-sea.md`(Plücker 坐标压缩 KV、热带门控)、`optimization-ml.md`(对偶变换)。
package/docs/CLAUDE.md DELETED
@@ -1,187 +0,0 @@
1
- # Math Skill 使用指南 / User Guide
2
-
3
- ## 简介 / Introduction
4
-
5
- Math Skill 是一个将数学思维应用到科研和生活的 Claude Code 技能包。包含**十六种数学思想武器**(十五种专业武器 + 一个武器选择器),每个都配有详细的方法论、双路径操作规程(科研模式和生活模式)和数学出处。
6
-
7
- ## 安装 / Installation
8
-
9
- 直接粘贴下面这段给 Claude Code 或其他终端型 AI 助手即可:
10
-
11
- ```
12
- 请帮我安装 math-skill:https://github.com/the-thinker0/math-skill,并教我如何使用
13
- ```
14
-
15
- 如果你更了解自己的环境,也可以指定安装方式(npm / git clone / 本地路径)。
16
-
17
- ## 使用方法 / Usage
18
-
19
- ### 模式选择 / Mode Selection
20
-
21
- 每个思想武器都有两种模式:
22
-
23
- - **科研模式 / Research Mode**:保留完整数学符号与推导,适用于数学推导、论文审查、算法设计、实验设计优化
24
- - **生活模式 / Life Mode**:只保留思维框架的核心步骤,用日常语言替代数学符号,适用于日常决策、人际互动、时间管理、生活规划
25
-
26
- 系统会根据问题性质自动选择模式。你也可以在命令中指定:
27
- - 科研问题 → 自动使用科研模式
28
- - 生活问题 → 自动使用生活模式
29
-
30
- ### 手动触发命令
31
-
32
- Math Skill 通过特定命令手动触发,**不会在每次对话开始时自动加载**。使用以下命令:
33
-
34
- | 命令 | 思想武器 | 适用场景 |
35
- |------|---------|---------|
36
- | `/ask` | 🧭 武器选择器 | 不确定该用哪个工具时,自动推荐1-3个最合适的思想武器 |
37
- | `/axiomatization` | 📐 公理化思想 | 审查理论假设、构建理论框架 |
38
- | `/abstraction` | 🧩 抽象化思想 | 提取本质结构、简化复杂问题 |
39
- | `/logic-deduction` | 🧠 逻辑演绎 | 检查论证严谨性、发现逻辑漏洞 |
40
- | `/modeling` | 🌉 建模思想 | 构建模型、预测现象 |
41
- | `/optimization` | ⚖️ 优化思想 | 资源分配、决策优化 |
42
- | `/probability-statistics` | 🎲 概率与统计 | 量化不确定性、数据分析 |
43
- | `/transformation` | 🔄 变换思想 | 换个角度、简化难题 |
44
- | `/symmetry-invariance` | ⚛️ 对称与不变性 | 寻找不变量、分类研究对象 |
45
- | `/induction-analogy` | 📈 归纳与类比 | 从特殊到一般、跨领域借鉴 |
46
- | `/algorithmic-thinking` | 🖥️ 算法与计算思想 | 判断可行性、设计求解步骤 |
47
- | `/information-theory` | 📡 信息论思想 | 量化不确定性、评估信息价值 |
48
- | `/game-theory` | 🎯 博弈论思想 | 多方互动决策、机制设计 |
49
- | `/causal-inference` | 🔗 因果推断思想 | 区分因果与相关、评估干预效果 |
50
- | `/topological-thinking` | 🌀 拓扑思想 | 连通结构分析、形状分类 |
51
- | `/discrete-combinatorial` | 🧮 离散与组合思想 | 计数、枚举、发现有限结构规律 |
52
-
53
- ### 使用示例 / Examples
54
-
55
- ```
56
- # 不知道该用哪个工具?先问选择器
57
- /ask 我面对一个复杂的人际矛盾,不知道从哪个角度切入...
58
-
59
- # 科研场景:审查论文的理论基础
60
- /axiomatization 这篇论文声称从三个假设推导出了一个新定理,但我怀疑它的假设集合可能不自洽...
61
-
62
- # 科研场景:检查证明的逻辑
63
- /logic-deduction 这篇论文的定理 3.2 的证明中,从第 5 行到第 6 行的推导看起来有跳跃...
64
-
65
- # 生活场景:时间分配(自动使用生活模式)
66
- /optimization 我需要在论文写作、课程作业和社交之间分配时间,论文 deadline 还有两周...
67
-
68
- # 生活场景:换个角度(自动使用生活模式)
69
- /transformation 我一直无法解决和室友的矛盾,在当前的沟通方式下僵局似乎无法打破...
70
- ```
71
-
72
- ### 语言切换 / Language Switching
73
-
74
- **默认输出语言为中文。** 如需英文输出,在命令后追加 "in English":
75
-
76
- ```
77
- /optimization How should I allocate my research time? in English
78
- ```
79
-
80
- ### 组合使用 / Combining Skills
81
-
82
- 多个思想武器可以组合使用:
83
-
84
- ```
85
- # 不确定该用哪些?先问选择器
86
- /ask 我需要分析一个涉及多方互动和资源分配的问题...
87
-
88
- # 然后按推荐顺序调用
89
- /game-theory 分析各方策略互动...
90
- /optimization 在博弈框架下寻找最优资源分配...
91
- ```
92
-
93
- ## 十六思想武器速查 / Quick Reference
94
-
95
- ### 🧭 武器选择器
96
-
97
- 当不确定该用哪个思想武器时,根据问题特征推荐最合适的1-3个工具。推荐基于问题特征决策树(互动性、不确定性、约束性、结构性、动态性),而非关键词匹配。
98
-
99
- ### 📐 公理化思想
100
-
101
- 从最少假设出发,通过严格逻辑构建理论体系。科研模式:审查论文假设合理性、构建理论框架。生活模式:分析隐含前提、识别未声明的假设。
102
-
103
- ### 🧩 抽象化思想
104
-
105
- 抓住本质特征,忽略非本质细节。科研模式:提炼数学结构、发现跨领域共性。生活模式:简化复杂生活问题、透过现象看本质。
106
-
107
- ### 🧠 逻辑演绎
108
-
109
- 从真命题出发,严格推理新真命题。科研模式:检查证明严谨性。生活模式:识别逻辑谬误、理性辩论。
110
-
111
- ### 🌉 建模思想
112
-
113
- 现实问题 → 模型 → 解释现实。科研模式:构建数学模型。生活模式:规划预算、路线、风险评估。
114
-
115
- ### ⚖️ 优化思想
116
-
117
- 约束条件下寻找最优解。科研模式:凸性分析、KKT条件、对偶理论。生活模式:核心追求、现实限制、满意选择。
118
-
119
- ### 🎲 概率与统计
120
-
121
- 量化不确定性,从数据提取规律。科研模式:假设检验、回归分析。生活模式:风险评估、解读新闻数据。
122
-
123
- ### 🔄 变换思想
124
-
125
- 复杂问题 → 等价的简单问题。科研模式:Fourier/Laplace变换。生活模式:换个视角看问题。
126
-
127
- ### ⚛️ 对称与不变性
128
-
129
- 寻找变化中的不变性质。科研模式:群论、Galois理论、Noether定理。生活模式:识别不变模式、规律被打破的信号。
130
-
131
- ### 📈 归纳与类比
132
-
133
- 从特殊到一般,从已知到未知。科研模式:数学归纳证明。生活模式:从经验中学习、跨领域借鉴。
134
-
135
- ### 🖥️ 算法与计算思想
136
-
137
- 将问题转化为可执行步骤,评估代价,判断可行性。科研模式:复杂度分析、NP-hard判定。生活模式:设计高效流程、评估计划可行性。
138
-
139
- ### 📡 信息论思想
140
-
141
- 信息是不确定性的减少。科研模式:熵计算、信道容量。生活模式:评估信息价值、减少冗余。
142
-
143
- ### 🎯 博弈论思想
144
-
145
- 最优策略取决于他人的选择。科研模式:Nash均衡计算、机制设计。生活模式:谈判策略、分析他人反应。
146
-
147
- ### 🔗 因果推断思想
148
-
149
- 相关≠因果,但因果可形式化。科研模式:DAG建模、do-演算。生活模式:区分原因与借口、反事实思考。
150
-
151
- ### 🌀 拓扑思想
152
-
153
- 连续变形下不变的性质。科研模式:持续同调、拓扑数据分析。生活模式:理解连通结构、识别盲区。
154
-
155
- ### 🧮 离散与组合思想
156
-
157
- 计数、枚举、发现有限对象的规律。科研模式:生成函数、图论分析。生活模式:系统性枚举、鸽巢推理。
158
-
159
- ## 知识体系 / Knowledge Base
160
-
161
- `knowledge-base/overview.md` 提供了完整的数学知识体系概述,包括:
162
-
163
- - 三大基础支柱(代数、几何、分析)
164
- - 主要分支(数论、概率统计、拓扑、离散数学、应用数学)
165
- - 知识层次(地基、代数、综合、前沿)
166
- - 与其他学科的联系
167
- - 思维武器与数学分支的映射(含武器选择器)
168
-
169
- ## 数学审视 / Math Critic
170
-
171
- `agents/math-critic.md` 定义了一个子 agent,兼具审视与实现能力。审视维度与十六种数学思想武器一一对应(含工具选择审视),但不机械遍历——根据问题性质选择最相关的3–5个维度深入检查。若不确定该审视哪些维度,先调用 `/ask` 让武器选择器推荐。
172
-
173
- ## 验证 / Validation
174
-
175
- 运行验证脚本检查所有文件完整性:
176
-
177
- ```bash
178
- # Linux/macOS
179
- bash tests/validate.sh
180
-
181
- # Windows PowerShell
182
- .\tests\validate.ps1
183
- ```
184
-
185
- ## License
186
-
187
- MIT License. See `LICENSE` for details.