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 Both sides next revision
manual:chapter3:symbolic [2018/12/14 11:49]
claudio [Algebraic Rules]
manual:chapter3:symbolic [2019/01/24 07:57]
claudio
Line 34: Line 34:
 | Wildcard | Meaning | | Wildcard | Meaning |
 | ''.iVAR'' | Match a single integer number | | ''.iVAR'' | Match a single integer number |
 +| ''.oVAR'' | Match a single odd integer number |
 +| ''.eVAR'' | Match a single even integer number |
 | ''.nVAR'' | Match a single number (not necessarily an integer) | | ''.nVAR'' | Match a single number (not necessarily an integer) |
 | ''.NVAR'' | Match the largest possible numeric sub-expression | | ''.NVAR'' | Match the largest possible numeric sub-expression |
Line 53: Line 55:
 | ''%%'%%.NN*.vX^2+.XR:->.XR%%'%%'' | ''%%'%%2.5*X+5*X*Y+(A+B)*Y^2%%'%%'' | Finds ''√3*X^2'+...'' where ''.XR'' represents the rest of the expression, and removes the term | | ''%%'%%.NN*.vX^2+.XR:->.XR%%'%%'' | ''%%'%%2.5*X+5*X*Y+(A+B)*Y^2%%'%%'' | Finds ''√3*X^2'+...'' where ''.XR'' represents the rest of the expression, and removes the term |
 | ''%%'%%.xN*.vX^2+.XR:->.XR%%'%%'' | ''%%'%%2.5*X+5*X*Y%%'%%'' | Finds ''√3*X^2''' and removes the term, then also finds ''(A+B)*Y^2'' and removes it as well | | ''%%'%%.xN*.vX^2+.XR:->.XR%%'%%'' | ''%%'%%2.5*X+5*X*Y%%'%%'' | Finds ''√3*X^2''' and removes the term, then also finds ''(A+B)*Y^2'' and removes it as well |
 +
 +==== Attributes ====
 +Attributes are hints that the user can include in an expression to increase the knowledge that the system has about certain variables. For example, if variables ''A'' and ''B'' in the expression ''%%'%%A*B*INV(A)%%'%%'' represent a matrix, the system should not simplify that expression to ''%%'%%B%%'%%''. Furthermore, if ''A'' and ''B'' are real numbers, the simplification is only valid when ''A'' is known not to be zero.
 +
 +Attributes allow the user to the system know that ''A'' is a real number and it cannot be zero. To add attributes to a variable, simply add a combination of subscript numbers after the variable name. For example, if ''A'' is a real number known not to be zero, simply write ''A₂₁'' in the expression (the exact meaning of the numbers will be explained in the next section). Notice that these attributes are only visible when editing the expression. Once the expression is in the stack, only the name of the variable will be visible, as the subscript numbers don't become part of the name of the variable. Ideally, the user should provide the same attributes to the same variables all throughout the expression (otherwise the system will think the variable represents different things in different parts of the same expression).
 +
 +Attributes are also useful within rules. If a variable (or wildcard special variable) has any attributes given within a rule definition, it will only match variables (or expressions) that have compatible attributes. For example a rule to cancel out factors in an expression could be: ''%%'%%.xX/.xX:->1%%'%%''. But this is not correct if the expression being canceled may be zero. Using attributes, we can write ''%%'%%.xX₂₁/.xX₂₁:->1%%'%%'' and now it will only match expressions that are known to be real and are known not to be zero.
 +
  
  
 ---- ----
  • manual/chapter3/symbolic.txt
  • Last modified: 2021/03/22 13:52
  • by claudio