manghel

28 Reputation

4 Badges

17 years, 329 days

MaplePrimes Activity


These are Posts that have been published by manghel

I'm trying to do symbiolic manipulations to define new procedures but I have trouble figuring out how to achieve my goal. The context is as follows: We have a set of ODEs df/dt = R(f(t)) where f(0) = x. Here f and x are n-dimensional vectors with components f[i], x[i], and R is a vector valued function with components R[i]; t is time. Example: R[1] := proc (x::Vector) x[2] end proc; R[2] := proc (x::Vector) -x[1]*(1+x[3]^2) end proc; R[3] := proc (x::Vector) x[4] end proc; R[4] := proc (x::Vector) -x[3]*(1+x[1]^2) end proc; Now, the Liouville operator is defined as L := proc(F::algebraic,a::list(algebraic))
Is it true that we cannot embed a for loop within another for loop? I was trying this simple code - for a reason to be mentioned below- and I've got an error message. What am I doing wrong? Is there a way to embed for loops and to have them work correctly? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ L:=[0,1,2]: for i in L do print(i) for j in L do print(j) end do; end do; print(Typesetting:-ASM, "assembled object is invalid"); # input placeholder Error, unterminated loop ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ What I was trying to do was to generate a list of lists as follows. For a given list, let's say L:= [0,1,2], create the list of all possible pairs [i,j]
Page 1 of 1