File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed
Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -150,30 +150,30 @@ pf = rational.partial_fractions(x)
150150## 🔧 Advanced Features
151151### Mutability Control
152152
153- ``` python
153+ ``` python
154154# Immutable (default)
155- f = Expression(" x^2" )
156- g = f + 1 # f unchanged, g is new Expression object
157-
155+ f = Expression(" x^2" )
156+ g = f + 1 # f unchanged, g is new Expression object
157+
158158# Mutable Mode (f is modified in-place)
159- f = Expression(" x ^2" , mutable = True )
159+ f = Expression(" (x-1)x ^2" , mutable = True )
160160f += 1
161- f.diff ()
162- ```
161+ f.expand ()
162+ ```
163163
164164
165165### Flexible String Parsing
166166
167- ``` python
167+ ``` python
168168# Natural mathematical notation
169- expr = Expression(" 2x^2 + ln(|x-1|)" )
169+ expr = Expression(" 2x^2 + ln(|x-1|)" )
170170
171171# LaTeX input support
172- expr = Expression(r " \f rac{x^ 2+ 1}{x-1}" )
172+ expr = Expression(r " \f rac{x^ 2+ 1}{x-1}" )
173173
174- # Implicit multiplication
174+ # Implicit multiplication
175175expr = Expression(" 2x sin(x)" )
176- ```
176+ ```
177177
178178
179179### Signal System for Reactive Programming
@@ -183,7 +183,8 @@ def on_change(expr): # runs whenever an operation changes f
183183 print (f " Expression changed to: { expr} " )
184184f = Expression(" x^2" )
185185f.on_self_mutated.connect(on_change)
186- f.on_self_cloned.connect(on_change)
186+ f.on_self_cloned.connect(on_change)
187+ f += 1 # on_change() is called
187188```
188189
189190
You can’t perform that action at this time.
0 commit comments