## q-lang-users — general discussion, questions, suggestions, etc.

You can subscribe to this list here.

 2003 2004 2005 2006 2007 2008 2009 2010 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec (1) Jan (3) Feb (27) Mar Apr (4) May (11) Jun (5) Jul (5) Aug (6) Sep (15) Oct (28) Nov (8) Dec Jan (9) Feb (5) Mar (10) Apr (43) May (8) Jun (31) Jul (45) Aug (17) Sep (8) Oct (30) Nov (2) Dec (6) Jan (4) Feb (20) Mar (1) Apr May (92) Jun (179) Jul (26) Aug (65) Sep (36) Oct (38) Nov (44) Dec (68) Jan (11) Feb (25) Mar (37) Apr (7) May (83) Jun (77) Jul (44) Aug (4) Sep (28) Oct (53) Nov (12) Dec (21) Jan (66) Feb (45) Mar (30) Apr (50) May (9) Jun (18) Jul (11) Aug (6) Sep (4) Oct Nov Dec Jan Feb Mar Apr (3) May (2) Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar Apr May Jun Jul Aug Sep (2) Oct Nov Dec
S M T W T F S

1

2
(2)
3
(4)
4
(1)
5
(3)
6

7
(3)
8
(1)
9
(3)
10
(4)
11

12

13
(2)
14

15

16

17

18

19

20

21

22

23

24
(2)
25

26
(2)
27

28

29
(3)
30

31

Showing 2 results of 2

 Re: [q-lang-users] newbie: algebraic simplification libraries? From: Albert Graef - 2005-10-24 09:39:37 ```Arnoldo Muller wrote: > X + Y = Y + X if isnum(Y) and not isnum(X); > > After running Q with this new equation, I get effectively what I want (I > want all the integer values added): > > ==> a + 4 + a + 5; > > 9+a+a > > so my questions are: > > > 1. > > Is this the best way of grouping integers? Is there a better way > of doing it in Q? Well, that depends on the application. If you're going to implement a full-blown symbolic algebra system then it's probably better to wrap up your simplification rules in a function, i.e., something like simplify (X + Y) = simplify (Y + X) if isnum(Y) and not isnum(X); ... simplify X = X otherwise; This way you can also have multiple simplification functions for different set of simplification rules, which gives you better control over which rulesets are invoked in which situations. > 2. > > Is there a library that has all these definitions (including more > complicated algebraic simplification rules)? Nothing yet, sorry. > 3. > > How a equation that returns 9 + 3a for (a + a + a + 5 + 4) would > look like? Distributivity? N*X+X = (N+1)*X if isnum N; N*X+M*X = (N+M)*X if isnum N and then isnum M; Y+N*X+X = Y+(N+1)*X if isnum N; Y+N*X+M*X = Y+(N+M)*X if isnum N and then isnum M; Note that when you're dealing with multivariate polynomials this soon gets rather nasty and you need additional rules to bring the right terms together. HTH, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr.Graef@..., ag@... WWW: http://www.musikwissenschaft.uni-mainz.de/~ag ```
 [q-lang-users] newbie: algebraic simplification libraries? From: Arnoldo Muller - 2005-10-24 08:10:10 Attachments: Message as HTML ```Hello! I just started to use Q a couple of days ago, and I think it rocks! I am planning to use Q for some expression normalization routines I need to implement. I've skimmed through all the manual and read the users list, but still I'm not sure I am following the right approach for some basic algebraic simplification routines I need. When I input this expression: =3D=3D> a + 4 + a + 5; a+4+a+5 Q naturally returns a+4+a+5 because there are no rules for grouping integers. So I created this rule: X + Y =3D Y + X if isnum(Y) and not isnum(X); After running Q with this new equation, I get effectively what I want (I want all the integer values added): =3D=3D> a + 4 + a + 5; 9+a+a so my questions are: 1. Is this the best way of grouping integers? Is there a better way of doing it in Q? 2. Is there a library that has all these definitions (including more complicated algebraic simplification rules)? 3. How a equation that returns 9 + 3a for (a + a + a + 5 + 4) would look like? Thank you so much for your help AM. ```

Showing 2 results of 2