I need to build a function that can build other functions in Scilab. I will try to explain with an example.
//A1 and A2 g12 are functions from R^2->R^2
// Here is what I can do.
deff('[Xprime]=Sys2(t,X)','Xprime=[A1(t,X(1:2)),A2(t,X(3:4))+g2(t,X(1:2),X(3:4))]')
Now, I do not know how many functions A1, A2, .... An there will be. So I need to store them in a list.
l1 = list(); l2 = list();
l1.($+1) = A1; l1.($+1) = A2; l1.($+1) = A3; ...
l2.($+1) = g1; l2.($+1) = g2; l2.($+1) = g3; ...
I want to implement a function like this:
function Xprime=Sys(l1, l2)
//... I do not know what to type ...
endfunction
This function would output:
deff('[Xprime]=Sys2(t,X)','Xprime=[A1(t,X(1:2))+g1(t,X(1:2)),A2(t,X(3:4))+g2(t,X(3:4)), ...]')
I hope It is understandable.