How to simplify ?



On Saturday 10 of July 2010 20:27:25 you wrote:
> On Sat, 10 Jul 2010, Zbigniew Komarnicki wrote:
>
> < > Is there any possibility to tell maxima to simplify above eq1 to this
> form < > e(r+1, k+1) - e(r, k+1) = C . ( x(r, k+1) - x(r+1, k+1) )
> <
> < I'm very sorry, the above should simplify to:
> < e(r+1, k) - e(r, k) = C . ( x(r, k) - x(r+1, k) )
> <
> eq : e(r+1, k+1) - e(r, k+1) = C . ( x(r, k+1) - x(r+1, k+1) );
> subst(k=k-1, eq);

I'm sorry I wrote wrong question and and got wrong answer :-)

> will do what you want. Perhaps you have a more sophisticated example
> in mind?

Yes you are right. Below I try show you what I do and what I want to obtain.
Please have look:


/*-----------------------------------------------
 Here is the version for operator '*'
-----------------------------------------------*/
kill(all);

/* 
  Declare our system equations as functions. 
  Note taht I use here '*' instead   of '.'  when 
  I do  multiplication.
*/
sys_x(r,k):=  x(r,k) = A * x(r,k-1) + B * u(r,k-1)$
sys_y(r,k):=  y(r,k) = C * x(r,k)$

/* 
  Define the error equation between yREF and y, where yREF is 
  reference signal in ILC (Iterative Learning Control) 
*/
sys_error(r,k):= e(r,k)= yREF(k)-y(r,k)$

/* 
  Calculate the error between (r+1,k+1) and (r,k+1) 
*/
diff_error: sys_error(r+1,k+1) - sys_error(r,k+1);
/* got output as:
   e(r + 1, k + 1) - e(r, k + 1) = y(r, k + 1) - y(r + 1, k + 1)
*/
       
/* 
  Calculate output for (r, k+1) and (r+1, k+1) and assign it to y1 and y2 
*/
y1: sys_y(r, k+1);
y2: sys_y(r+1, k+1);
/* got output as:
   y(r, k + 1) = x(r, k + 1) C
   y(r + 1, k + 1) = x(r + 1, k + 1) C
*/

/* 
  and now insert 'y1' and 'y2' into 'diff_error' to obtain: 
*/
eq1: subst([y1, y2], diff_error);
eq1: ratsimp(eq1);
/* got output as:
   e(r + 1, k + 1) - e(r, k + 1) = x(r, k + 1) C - x(r + 1, k + 1) C
   e(r + 1, k + 1) - e(r, k + 1) = ( x(r, k + 1) - x(r + 1, k + 1) ) C
*/

This last output equation 'eq1' is what I want, but note here that I obtain 
some thing what is wrong from mathematical point of view, because the 
operator '*' do not save the order when we do multiplication between vectors 
and matrices. Below the same example but with the operator '.' and the order
then is saved as should be.


/*-----------------------------------------------
 Here is the version for operator '.'
-----------------------------------------------*/
kill(all);

/* 
  Declare our system equations as functions. 
  Note taht I use here '.' when I do  multiplication.
*/
sys_x(r,k):=  x(r,k) = A . x(r,k-1) + B . u(r,k-1)$
sys_y(r,k):=  y(r,k) = C . x(r,k)$

/* 
  Define the error equation between yREF and y, where yREF is 
  reference signal in ILC (Iterative Learning Control) 
*/
sys_error(r,k):= e(r,k)= yREF(k)-y(r,k)$

/* 
  Calculate the error between (r+1,k+1) and (r,k+1) 
*/
diff_error: sys_error(r+1,k+1) - sys_error(r,k+1);
/* got output as:
   e(r + 1, k + 1) - e(r, k + 1) = y(r, k + 1) - y(r + 1, k + 1)
*/
       
/* 
  Calculate output for (r, k+1) and (r+1, k+1) and assign it to y1 and y2 
*/
y1: sys_y(r, k+1);
y2: sys_y(r+1, k+1);
/* got output as:
   y(r, k + 1) = C . x(r, k + 1)
   y(r + 1, k + 1) = C . x(r + 1, k + 1)
*/

/* 
  and now insert 'y1' and 'y2' into 'diff_error' to obtain: 
*/
eq1: subst([y1, y2], diff_error);
eq1: ratsimp(eq1);
eq1: radcan(eq1);
/* got output evry time the same:
   e(r + 1, k + 1) - e(r, k + 1) = C . x(r, k + 1) - C . x(r + 1, k + 1)
   e(r + 1, k + 1) - e(r, k + 1) = C . x(r, k + 1) - C . x(r + 1, k + 1)
   e(r + 1, k + 1) - e(r, k + 1) = C . x(r, k + 1) - C . x(r + 1, k + 1)
*/

How I can simplify the 'eq1' to this form:
e(r+1, k+1)-e(r,k+1) = C . ( x(r, k+1)-x(r+1, k+1) )

Is this possible in maxima ?

I also have loo on these:
  dot, dot0nscsimp, dot0simp, dot1simp, dotassoc, dotconstrules, 
  dotdistrib, dotexptsimp, dotident, dotscrules
but without any succes to the last equation. 

Of course, I  have much more complicated system. Here I only show very
simple exammple of such systems. 

Thank you in advance.

> Leo

Zbigniew