*To*: mathgroup@smc.vnet.net*Subject*: [mg10945] Re: [mg10866] Debug program*From*: seanross@worldnet.att.net*Date*: Sat, 14 Feb 1998 00:53:19 -0500*References*: <199802112332.SAA19012@smc.vnet.net.>

Chik Tai Wai David wrote: > > Dear, > > I am using mathematica to write a program that solves a differential > equation by finite difference method ( one of numerical methods ). I > use Table[] to generate a set of linear equations and try to use > Table[Solve[]] to solve for the unknowns. But an error message of > something like "general::ivar:X[1],X[2],X[3] is not an valid variable" > appears. I don't know what is wrong so would any one can do me a favor > ? My program file is attached as "trial.nb". Just read the last cell > first to see my problem. Thank you very much ! > > Regards, > David Chik. (email:h9505865@hkusua.hku.hk) > soln=Solve[eqns,Table[Temp[i,j],{i,0,6},{j,0,4}]] General::"ivar": "({(Temp[(6, 0)]), (Temp[(6, 1)]), (Temp[(6, 2)]), (Temp[(6, 3)]), (Temp[(6, 4)])}) is not a valid variable." "Solve[eqns, vars] attempts to solve an equation or set of equations for the variables vars. Solve[eqns, vars, elims] attempts to solve the equations for vars, eliminating the variables elims." name[0,0] is not a variable, it is a symbol evaluated at a certain point 0,0. Since it seems like you are dealing with a matrix problem, why not use lists? Instead of having a function k and temp etc that are defined at a myriad of specific points, why not have a list k and a list temp that have many elements. -- Remove the _nospam_ in the return address to respond.

**References**:**Debug program***From:*Chik Tai Wai David <h9505865@hkusua.hku.hk>