Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Debug program



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>
  • Prev by Date: MathLink portnumbers and internal types
  • Next by Date: Wish list for next version
  • Prev by thread: Debug program
  • Next by thread: MD5 implementation?