# [Maxima] replacement of each matrix element (created with solve()) in a function

Jorge Barros de Abreu ficmatin01 at solar.com.br
Sun Dec 17 11:31:13 CST 2006

```Hi for all.
In the attached file the latest two lines are not good (in this context).
I will be to replace automatically each element of "A" matrix in i(x) function
and each element of matrix B in j(x) function.
The matrix elements are in the generic form "x = a".
I do not know make to extract "a" from "x = a".
The two lines make "i(x=a)" and the target is "i(a)".

what is the correct form?

TIA.
*****************************
algebraic : true;
g(x):=x^2-x+1;
f(x):=x^2+x-1;
h(x):=f(x)/g(x);
diff(h(x), x);
eq01:%=0;
diff(h(x), x);
eq02:1/%=0;
A:matrix ( solve ( eq01,[x] ) );
for i from 1 thru length(A) do (for j from 1 thru length(A[1]) do
print(A[i,j]));
B:matrix ( solve ( eq02,[x] ) );
for i from 1 thru length(B) do (for j from 1 thru length(B[1]) do
print(B[i,j]));
i(x):=''( diff (h(x), x) );
j(x):=''( 1/diff (h(x), x) );
for i from 1 thru length(A) do (for j from 1 thru length(A[1]) do
print(i(A[i,j])) );
for i from 1 thru length(B) do (for j from 1 thru length(B[1]) do
print(j(B[i,j])) );

--
Data Estelar 2454086.953206
http://usr.solar.com.br/~ficmatin
Desejo-lhe Paz, Vida Longa e Prosperidade.
São Bem Vindas Mensagens no Formato Texto Genérico com Acentos.

-------------- next part --------------
algebraic : true;
g(x):=x^2-x+1;
f(x):=x^2+x-1;
h(x):=f(x)/g(x);
diff(h(x), x);
eq01:%=0;
diff(h(x), x);
eq02:1/%=0;
A:matrix ( solve ( eq01,[x] ) );
for i from 1 thru length(A) do (for j from 1 thru length(A[1]) do print(A[i,j]));
B:matrix ( solve ( eq02,[x] ) );
for i from 1 thru length(B) do (for j from 1 thru length(B[1]) do print(B[i,j]));
i(x):=''( diff (h(x), x) );
j(x):=''( 1/diff (h(x), x) );
for i from 1 thru length(A) do (for j from 1 thru length(A[1]) do print(i(A[i,j])) );
for i from 1 thru length(B) do (for j from 1 thru length(B[1]) do print(j(B[i,j])) );
```