manual:chapter3:symbolic

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
manual:chapter3:symbolic [2021/03/22 13:37]
claudio
manual:chapter3:symbolic [2021/03/22 13:52]
claudio [Using rules and attributes, examples]
Line 106: Line 106:
  
 ==== Using rules and attributes, examples ==== ==== Using rules and attributes, examples ====
 +
 +Here are a few examples where using attributes is useful to decide whether to apply a rule or not.
  
 ^ Rule ^ Effect ^ ^ Rule ^ Effect ^
-| ''%%'%%ABS(.xX₂₂):->.xX%%'%%'' | Simplify absolute value of an expression that is known to be real >=0 |+| ''%%'%%ABS(.xX:R∞≥0:):->.xX:R∞≥0:%%'%%'' | Simplify absolute value of an expression that is known to be real ≥0 | 
 +| ''%%'%%ABS(.xX:R∞<0:):->-.xX:R∞<0:%%'%%'' Simplify absolute value of an expression that is known to be real ≤0 | 
 + 
 +The above rules, for example, it can be applied to expressions with different attributes in its variables giving different results:
  
 ^ Test cases ^ Result ^ Explanation ^ ^ Test cases ^ Result ^ Explanation ^
-| ''Y*ABS(X₂₃)'' | ''Y*X₂₃'' | The expression matches because ''X'' is known to be a real >0 | +| ''Y*ABS(X)'' | ''Y*ABS(X)'' | No rules are applied because X doesn't fit within the subsets defined in the rules | 
-| ''Y*ABS(-4)'' | ''Y*ABS(-4)'' | The expression doesn't match because ''-4'' is known to be a real <0 | +| ''Y*ABS(X:R>0:)'' | ''Y*X'' | The expression matches the first rule because ''X'' is known to be a real >0 | 
-| ''Y*ABS(X₂₃+1)'' | ''Y*(X₂₃+1)'' | The expression matches because ''X+1'' is known to be a real >0 | +| ''Y*ABS(-4)'' | ''Y*(-(-4))'' | The expression matches the second rule because ''-4'' is known to be a real <0 | 
-| ''Y*ABS(X₂₃-1)'' | ''Y*ABS(X₂₃-1)'' | The expression doesn't match because ''X-1'' could be <0 for 0<x<1 | +| ''Y*ABS(X:R>0:+1)'' | ''Y*(X+1)'' | The expression matches the first rule because ''X+1'' is known to be a real >0 | 
-| ''Y*ABS%%((X₂₃-1)%%^2)'' | ''Y*(X₂₃-1)^2'' | The expression matches because ''(X-1)^2'' is known to be >=0 |+| ''Y*ABS(X:R>0:-1)'' | ''Y*ABS(X-1)'' | The expression doesn't match either rule because ''X-1'' could be <0 for 0<x<1 | 
 +| ''Y*ABS%%((X:R>0:-1)%%^2)'' | ''Y*(X-1)^2'' | The expression matches because ''(X-1)^2'' is known to be >=0 
 +| ''Y*ABS%%((X-1)%%^2)'' | ''Y*(X-1)^2'' | The expression matches because ''(X-1)^2'' is known to be >=0 regardless of X |
  
  
  • manual/chapter3/symbolic.txt
  • Last modified: 2021/03/22 13:52
  • by claudio