MathGroup Archive 1998

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

Search the Archive

Debug program



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)

(***********************************************************************

                    Mathematica-Compatible Notebook

This notebook can be used on any computer system with Mathematica 3.0,
MathReader 3.0, or any compatible application. The data for the
notebook  starts with the line of stars above.

To get the notebook into a Mathematica-compatible application, do one of
the following:

* Save the data starting with the line of stars above into a file
  with a name ending in .nb, then open the file inside the application;

* Copy the data starting with the line of stars above to the
  clipboard, then use the Paste menu command inside the application.

Data for notebooks contains only printable 7-bit ASCII and can be sent
directly in email or through ftp in text mode.  Newlines can be CR, LF
or CRLF (Unix, Macintosh or MS-DOS style).

NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing the 
word CacheID, otherwise Mathematica-compatible applications may try to 
use invalid cache data.

For more information on notebooks and Mathematica-compatible 
applications, contact Wolfram Research:
  web: http://www.wolfram.com
  email: info@wolfram.com
  phone: +1-217-398-0700 (U.S.)

Notebook reader applications are available free of charge from  Wolfram
Research.
***********************************************************************)

(*CacheID: 232*)


(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[     31155,        691]*)
(*NotebookOutlinePosition[     31803,        714]*) (* 
CellTagsIndexPosition[     31759,        710]*) (*WindowFrame->Normal*)


Notebook[{
Cell[BoxData[
    StyleBox[\(\ 
      Use\ Finite\ Difference\ Method\ to\ model\ the\ heat\ conduction\

        inside\ the\ \(Earth . \)\),
      FontSize->18,
      FontColor->RGBColor[0, 0, 1]]], "Input"],

Cell[CellGroupData[{

Cell[BoxData[
    RowBox[{
      StyleBox[
        \( (*\ \(' eq'\ is\ the\ differential\ equation\ I\ want\ to\
solve
            \), \n\tTemp\ is\ a\ function\ of\ space\ r\ and\ time\ 
            \(t . \)\ *) \),
        FontColor->RGBColor[0, 0, 1]], "\n", 
      RowBox[{"eq", "=", 
        RowBox[{
          RowBox[{
            FractionBox[
              RowBox[{
                SuperscriptBox["Temp", 
                  TagBox[\((0, 1)\),
                    Derivative],
                  MultilineFunction->None], "[", \(r, t\), "]"}], 
              \(d[r, t]\)], "-", 
            FractionBox[
              RowBox[{"2", " ", 
                RowBox[{
                  SuperscriptBox["Temp", 
                    TagBox[\((1, 0)\),
                      Derivative],
                    MultilineFunction->None], "[", \(r, t\), "]"}]}], 
              \(r + 1\)], "-", 
            RowBox[{
              SuperscriptBox["Temp", 
                TagBox[\((2, 0)\),
                  Derivative],
                MultilineFunction->None], "[", \(r, t\), "]"}]}], "==", 
          \(g[r, t]\/k[r, t]\)}]}]}]], "Input"],

Cell[BoxData[
    RowBox[{
      RowBox[{
        FractionBox[
          RowBox[{
            SuperscriptBox["Temp", 
              TagBox[\((0, 1)\),
                Derivative],
              MultilineFunction->None], "[", \(r, t\), "]"}], \(d[r,
t]\)], 
        "-", 
        FractionBox[
          RowBox[{"2", " ", 
            RowBox[{
              SuperscriptBox["Temp", 
                TagBox[\((1, 0)\),
                  Derivative],
                MultilineFunction->None], "[", \(r, t\), "]"}]}], \(1 +
r\)], 
        "-", 
        RowBox[{
          SuperscriptBox["Temp", 
            TagBox[\((2, 0)\),
              Derivative],
            MultilineFunction->None], "[", \(r, t\), "]"}]}], "==", 
      \(g[r, t]\/k[r, t]\)}]], "Output"] }, Open  ]],

Cell[BoxData[
    StyleBox[
      \( (*\ ' fdeq'\ transform\ ' eq'\ to\ finite\ difference\ form\ *)
\),
      FontColor->RGBColor[0, 0, 1]]], "Input"],

Cell[CellGroupData[{

Cell[BoxData[
    RowBox[{"fdeq", "=", 
      RowBox[{"Simplify", "[", "\n", "\t\t\t\t\t\t ", 
        RowBox[{"eq", "/.", " ", 
          RowBox[{"{", " ", 
            RowBox[{
            \(r -> r[i]\), ",", "\n", "\t\t\t\t\t\t\t\t\t\t\t\t\t", 
              \(t -> t[j]\), ",", "\n", "\t\t\t\t\t\t\t\t\t\t\t\t\t", 
              \(Temp[r, t] -> Temp[i, j]\), ",", "\n", 
              "\t\t\t\t\t\t\t\t\t\t\t\t\t", \(d[r, t] -> d[i, j]\), ",",

              "\n", "\t\t\t\t\t\t\t\t\t\t\t\t\t", \(g[r, t] -> g[i,
j]\), 
              ",", "\n", "\t\t\t\t\t\t\t\t\t\t\t\t\t", 
              \(k[r, t] -> k[i, j]\), ",", "\n", 
              "\t\t\t\t\t\t\t\t\t\t\t\t\t", 
              RowBox[{
                RowBox[{
                  SuperscriptBox["Temp", 
                    TagBox[\((2, 0)\),
                      Derivative],
                    MultilineFunction->None], "[", \(r, t\), "]"}],
"->", 
                \(\((Temp[i - 1, j + 1] - 2*Temp[i, j + 1] + 
                      Temp[i + 1, j + 1] + Temp[i - 1, j] - 2*Temp[i, j]
+ 
                      Temp[i + 1, j])\)/\((2*\[Alpha]*\[Alpha])\)\)}],
",", 
              "\n", "\t\t\t\t\t\t\t\t\t\t\t\t\t ", 
              RowBox[{
                RowBox[{
                  SuperscriptBox["Temp", 
                    TagBox[\((1, 0)\),
                      Derivative],
                    MultilineFunction->None], "[", \(r, t\), "]"}],
"->", 
                \(\((Temp[i + 1, j] + Temp[i + 1, j + 1] - Temp[i - 1,
j] - 
                      Temp[i - 1, j + 1])\)/\((4*\[Alpha])\)\)}], ",",
"\n", 
              "\t\t\t\t\t\t\t\t\t\t\t\t\t", 
              RowBox[{
                RowBox[{
                  SuperscriptBox["Temp", 
                    TagBox[\((0, 1)\),
                      Derivative],
                    MultilineFunction->None], "[", \(r, t\), "]"}],
"->", 
                \(\((Temp[i, j + 1] - Temp[i, j])\)/\[Beta]\)}]}],
"}"}]}], 
        "]"}]}]], "Input"],

Cell[BoxData[
    \(\(\(-Temp[i, j]\) + Temp[i, 1 + j]\)\/\(\[Beta]\ d[i, j]\) + 
        \(1\/\(2\ \[Alpha] + 2\ \[Alpha]\ r[i]\)\((
          Temp[\(-1\) + i, j] + Temp[\(-1\) + i, 1 + j] - Temp[1 + i, j]
- 
            Temp[1 + i, 1 + j])\)\) - 
        \(1\/\(2\ \[Alpha]\^2\)\((
          Temp[\(-1\) + i, j] + Temp[\(-1\) + i, 1 + j] - 2\ Temp[i, j]
- 
            2\ Temp[i, 1 + j] + Temp[1 + i, j] + Temp[1 + i, 1 + j])\)\)
== 
      g[i, j]\/k[i, j]\)], "Output"] }, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
    RowBox[{
      StyleBox[
        \( (*\ This\ shows\ the\ values\ of\ the\ parameters\ in\ the\ 
            equation\ *) \),
        FontColor->RGBColor[0, 0, 1]], "\n", 
      \(parameters = {\nTable[g[i, j] -> 3.88*^-8, {i, 0, 6}, {j, 0,
4}], \n
            Table[d[i, j] -> 
                Which[i > 5, 1.2*^-6, i > 3, 4.*^-6, True, 6.5*^-6], {i,
0, 
                6}, {j, 0, 4}], \n
            Table[k[i, j] -> Which[i > 5, 4. , i > 3, 45. , True, 67. ],
{i, 
                0, 6}, {j, 0, 4}]} // Flatten\)}]], "Input"],

Cell[BoxData[
    RowBox[{"{", 
      RowBox[{
      \(g[0, 0] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[0, 1] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[0, 2] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[0, 3] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[0, 4] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[1, 0] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[1, 1] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[1, 2] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[1, 3] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[1, 4] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[2, 0] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[2, 1] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[2, 2] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[2, 3] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[2, 4] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[3, 0] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[3, 1] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[3, 2] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[3, 3] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[3, 4] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[4, 0] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[4, 1] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[4, 2] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[4, 3] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[4, 4] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[5, 0] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[5, 1] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[5, 2] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[5, 3] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[5, 4] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[6, 0] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[6, 1] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[6, 2] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[6, 3] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(g[6, 4] \[Rule] 3.87999999999999989`*^-8\), ",", 
        \(d[0, 0] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[0, 1] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[0, 2] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[0, 3] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[0, 4] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[1, 0] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[1, 1] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[1, 2] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[1, 3] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[1, 4] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[2, 0] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[2, 1] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[2, 2] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[2, 3] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[2, 4] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[3, 0] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[3, 1] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[3, 2] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[3, 3] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[3, 4] \[Rule] 6.49999999999999911`*^-6\), ",", 
        \(d[4, 0] \[Rule] 3.99999999999999964`*^-6\), ",", 
        \(d[4, 1] \[Rule] 3.99999999999999964`*^-6\), ",", 
        \(d[4, 2] \[Rule] 3.99999999999999964`*^-6\), ",", 
        \(d[4, 3] \[Rule] 3.99999999999999964`*^-6\), ",", 
        \(d[4, 4] \[Rule] 3.99999999999999964`*^-6\), ",", 
        \(d[5, 0] \[Rule] 3.99999999999999964`*^-6\), ",", 
        \(d[5, 1] \[Rule] 3.99999999999999964`*^-6\), ",", 
        \(d[5, 2] \[Rule] 3.99999999999999964`*^-6\), ",", 
        \(d[5, 3] \[Rule] 3.99999999999999964`*^-6\), ",", 
        \(d[5, 4] \[Rule] 3.99999999999999964`*^-6\), ",", 
        \(d[6, 0] \[Rule] 1.19999999999999996`*^-6\), ",", 
        \(d[6, 1] \[Rule] 1.19999999999999996`*^-6\), ",", 
        \(d[6, 2] \[Rule] 1.19999999999999996`*^-6\), ",", 
        \(d[6, 3] \[Rule] 1.19999999999999996`*^-6\), ",", 
        \(d[6, 4] \[Rule] 1.19999999999999996`*^-6\), ",", 
        RowBox[{\(k[0, 0]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[0, 1]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[0, 2]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[0, 3]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[0, 4]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[1, 0]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[1, 1]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[1, 2]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[1, 3]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[1, 4]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[2, 0]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[2, 1]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[2, 2]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[2, 3]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[2, 4]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[3, 0]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[3, 1]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[3, 2]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[3, 3]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[3, 4]\), "\[Rule]", 
          StyleBox["67.0000000000000017`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[4, 0]\), "\[Rule]", 
          StyleBox["45.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[4, 1]\), "\[Rule]", 
          StyleBox["45.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[4, 2]\), "\[Rule]", 
          StyleBox["45.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[4, 3]\), "\[Rule]", 
          StyleBox["45.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[4, 4]\), "\[Rule]", 
          StyleBox["45.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[5, 0]\), "\[Rule]", 
          StyleBox["45.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[5, 1]\), "\[Rule]", 
          StyleBox["45.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[5, 2]\), "\[Rule]", 
          StyleBox["45.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[5, 3]\), "\[Rule]", 
          StyleBox["45.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[5, 4]\), "\[Rule]", 
          StyleBox["45.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->2]}], ",", 
        RowBox[{\(k[6, 0]\), "\[Rule]", 
          StyleBox["4.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->1]}], ",", 
        RowBox[{\(k[6, 1]\), "\[Rule]", 
          StyleBox["4.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->1]}], ",", 
        RowBox[{\(k[6, 2]\), "\[Rule]", 
          StyleBox["4.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->1]}], ",", 
        RowBox[{\(k[6, 3]\), "\[Rule]", 
          StyleBox["4.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->1]}], ",", 
        RowBox[{\(k[6, 4]\), "\[Rule]", 
          StyleBox["4.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->1]}]}], "}"}]], "Output"] }, Open  ]],

Cell[BoxData[
    StyleBox[\( (*\ This\ is\ the\ space - time\ grid\ *) \),
      FontColor->RGBColor[0, 0, 1]]], "Input"],

Cell[CellGroupData[{

Cell[BoxData[
    \(\[Alpha] = 1274200; \[Beta] = 2*^16\ ; \n
    grid = Table[{r[i], t[j]} -> {i*\[Alpha], j*\[Beta]}, {i, 0, 6}, {j,
0, 
            4}] // Flatten\)], "Input"],

Cell[BoxData[
    \({{r[0], t[0]} \[Rule] {0, 0}, {r[0], t[1]} 
        \[Rule] {0, 20000000000000000}, {r[0], t[2]} 
        \[Rule] {0, 40000000000000000}, {r[0], t[3]} 
        \[Rule] {0, 60000000000000000}, {r[0], t[4]} 
        \[Rule] {0, 80000000000000000}, {r[1], t[0]} 
        \[Rule] {1274200, 0}, {r[1], t[1]} 
        \[Rule] {1274200, 20000000000000000}, {r[1], t[2]} 
        \[Rule] {1274200, 40000000000000000}, {r[1], t[3]} 
        \[Rule] {1274200, 60000000000000000}, {r[1], t[4]} 
        \[Rule] {1274200, 80000000000000000}, {r[2], t[0]} 
        \[Rule] {2548400, 0}, {r[2], t[1]} 
        \[Rule] {2548400, 20000000000000000}, {r[2], t[2]} 
        \[Rule] {2548400, 40000000000000000}, {r[2], t[3]} 
        \[Rule] {2548400, 60000000000000000}, {r[2], t[4]} 
        \[Rule] {2548400, 80000000000000000}, {r[3], t[0]} 
        \[Rule] {3822600, 0}, {r[3], t[1]} 
        \[Rule] {3822600, 20000000000000000}, {r[3], t[2]} 
        \[Rule] {3822600, 40000000000000000}, {r[3], t[3]} 
        \[Rule] {3822600, 60000000000000000}, {r[3], t[4]} 
        \[Rule] {3822600, 80000000000000000}, {r[4], t[0]} 
        \[Rule] {5096800, 0}, {r[4], t[1]} 
        \[Rule] {5096800, 20000000000000000}, {r[4], t[2]} 
        \[Rule] {5096800, 40000000000000000}, {r[4], t[3]} 
        \[Rule] {5096800, 60000000000000000}, {r[4], t[4]} 
        \[Rule] {5096800, 80000000000000000}, {r[5], t[0]} 
        \[Rule] {6371000, 0}, {r[5], t[1]} 
        \[Rule] {6371000, 20000000000000000}, {r[5], t[2]} 
        \[Rule] {6371000, 40000000000000000}, {r[5], t[3]} 
        \[Rule] {6371000, 60000000000000000}, {r[5], t[4]} 
        \[Rule] {6371000, 80000000000000000}, {r[6], t[0]} 
        \[Rule] {7645200, 0}, {r[6], t[1]} 
        \[Rule] {7645200, 20000000000000000}, {r[6], t[2]} 
        \[Rule] {7645200, 40000000000000000}, {r[6], t[3]} 
        \[Rule] {7645200, 60000000000000000}, {r[6], t[4]} 
        \[Rule] {7645200, 80000000000000000}}\)], "Output"] }, Open  ]],

Cell[BoxData[
    StyleBox[
      \( (*\ Now\ I\ try\ to\ generate\ the\ set\ of\ algebraic\ 
          equations . \ I\ put\ the\ boundary\ conditions\ inside\ 
          \(also . \)\ *) \),
      FontColor->RGBColor[0, 0, 1]]], "Input"],

Cell[CellGroupData[{

Cell[BoxData[
    \(eqns = {
          \({Table[fdeq /. {i -> a, j -> b}, {a, 1, 5}, {b, 0, 3}], 
                Table[Temp[i, j] - Temp[i, j - 1] == \(-40\) /. {i -> a,

                      j -> b}, {a, 6, 6}, {b, 1, 4}], \n
                Table[Temp[i, j - 1] - 
                        \((\((\((1 + 6*0.0400348453439142204`)\)*Temp[i,
j] - 
                                6*0.0400348453439142204`*Temp[i + 1, j]
- 
                                6*0.0400348453439142204`*Temp[i + 1, j -
1] - 
                                d[i, j - 1]*g[i, j - 1]*\[Beta]/k[i, j -
1])
                              \)/\((1 - 6*0.0400348453439142204`)\))\)
== 
                      0 /. {i -> a, j -> b}, {a, 0, 0}, {b, 1, 4}], 
                Table[Temp[i, j] == 500.  /. {i -> a, j -> b}, {a, 0,
6}, {b, 
                    0, 0}]} /. grid\) /. parameters} // Flatten\)],
"Input"],

Cell[BoxData[
    RowBox[{"{", 
      RowBox[{
      \(7.69230769230769251`*^-12\ \((\(-Temp[1, 0]\) + Temp[1, 1])\) + 
            \(Temp[0, 0] + Temp[0, 1] - Temp[2, 0] - 
                Temp[2, 1]\)\/\(2548400 + 2548400\ r[1]\) + 
            \((\(-Temp[0, 0]\) - Temp[0, 1] + 2\ Temp[1, 0] + 2\ Temp[1,
1] - 
                  Temp[2, 0] - Temp[2, 1])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[1, 1]\) + Temp[1, 2])\)
+ 
            \(Temp[0, 1] + Temp[0, 2] - Temp[2, 1] - 
                Temp[2, 2]\)\/\(2548400 + 2548400\ r[1]\) + 
            \((\(-Temp[0, 1]\) - Temp[0, 2] + 2\ Temp[1, 1] + 2\ Temp[1,
2] - 
                  Temp[2, 1] - Temp[2, 2])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[1, 2]\) + Temp[1, 3])\)
+ 
            \(Temp[0, 2] + Temp[0, 3] - Temp[2, 2] - 
                Temp[2, 3]\)\/\(2548400 + 2548400\ r[1]\) + 
            \((\(-Temp[0, 2]\) - Temp[0, 3] + 2\ Temp[1, 2] + 2\ Temp[1,
3] - 
                  Temp[2, 2] - Temp[2, 3])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[1, 3]\) + Temp[1, 4])\)
+ 
            \(Temp[0, 3] + Temp[0, 4] - Temp[2, 3] - 
                Temp[2, 4]\)\/\(2548400 + 2548400\ r[1]\) + 
            \((\(-Temp[0, 3]\) - Temp[0, 4] + 2\ Temp[1, 3] + 2\ Temp[1,
4] - 
                  Temp[2, 3] - Temp[2, 4])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[2, 0]\) + Temp[2, 1])\)
+ 
            \(Temp[1, 0] + Temp[1, 1] - Temp[3, 0] - 
                Temp[3, 1]\)\/\(2548400 + 2548400\ r[2]\) + 
            \((\(-Temp[1, 0]\) - Temp[1, 1] + 2\ Temp[2, 0] + 2\ Temp[2,
1] - 
                  Temp[3, 0] - Temp[3, 1])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[2, 1]\) + Temp[2, 2])\)
+ 
            \(Temp[1, 1] + Temp[1, 2] - Temp[3, 1] - 
                Temp[3, 2]\)\/\(2548400 + 2548400\ r[2]\) + 
            \((\(-Temp[1, 1]\) - Temp[1, 2] + 2\ Temp[2, 1] + 2\ Temp[2,
2] - 
                  Temp[3, 1] - Temp[3, 2])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[2, 2]\) + Temp[2, 3])\)
+ 
            \(Temp[1, 2] + Temp[1, 3] - Temp[3, 2] - 
                Temp[3, 3]\)\/\(2548400 + 2548400\ r[2]\) + 
            \((\(-Temp[1, 2]\) - Temp[1, 3] + 2\ Temp[2, 2] + 2\ Temp[2,
3] - 
                  Temp[3, 2] - Temp[3, 3])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[2, 3]\) + Temp[2, 4])\)
+ 
            \(Temp[1, 3] + Temp[1, 4] - Temp[3, 3] - 
                Temp[3, 4]\)\/\(2548400 + 2548400\ r[2]\) + 
            \((\(-Temp[1, 3]\) - Temp[1, 4] + 2\ Temp[2, 3] + 2\ Temp[2,
4] - 
                  Temp[3, 3] - Temp[3, 4])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[3, 0]\) + Temp[3, 1])\)
+ 
            \(Temp[2, 0] + Temp[2, 1] - Temp[4, 0] - 
                Temp[4, 1]\)\/\(2548400 + 2548400\ r[3]\) + 
            \((\(-Temp[2, 0]\) - Temp[2, 1] + 2\ Temp[3, 0] + 2\ Temp[3,
1] - 
                  Temp[4, 0] - Temp[4, 1])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[3, 1]\) + Temp[3, 2])\)
+ 
            \(Temp[2, 1] + Temp[2, 2] - Temp[4, 1] - 
                Temp[4, 2]\)\/\(2548400 + 2548400\ r[3]\) + 
            \((\(-Temp[2, 1]\) - Temp[2, 2] + 2\ Temp[3, 1] + 2\ Temp[3,
2] - 
                  Temp[4, 1] - Temp[4, 2])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[3, 2]\) + Temp[3, 3])\)
+ 
            \(Temp[2, 2] + Temp[2, 3] - Temp[4, 2] - 
                Temp[4, 3]\)\/\(2548400 + 2548400\ r[3]\) + 
            \((\(-Temp[2, 2]\) - Temp[2, 3] + 2\ Temp[3, 2] + 2\ Temp[3,
3] - 
                  Temp[4, 2] - Temp[4, 3])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(7.69230769230769251`*^-12\ \((\(-Temp[3, 3]\) + Temp[3, 4])\)
+ 
            \(Temp[2, 3] + Temp[2, 4] - Temp[4, 3] - 
                Temp[4, 4]\)\/\(2548400 + 2548400\ r[3]\) + 
            \((\(-Temp[2, 3]\) - Temp[2, 4] + 2\ Temp[3, 3] + 2\ Temp[3,
4] - 
                  Temp[4, 3] - Temp[4, 4])\)/3247171280000 == 
          5.79104477611940193`*^-10\), ",", 
        \(1.25`*^-11\ \((\(-Temp[4, 0]\) + Temp[4, 1])\) + 
            \(Temp[3, 0] + Temp[3, 1] - Temp[5, 0] - 
                Temp[5, 1]\)\/\(2548400 + 2548400\ r[4]\) + 
            \((\(-Temp[3, 0]\) - Temp[3, 1] + 2\ Temp[4, 0] + 2\ Temp[4,
1] - 
                  Temp[5, 0] - Temp[5, 1])\)/3247171280000 == 
          8.62222222222222178`*^-10\), ",", 
        \(1.25`*^-11\ \((\(-Temp[4, 1]\) + Temp[4, 2])\) + 
            \(Temp[3, 1] + Temp[3, 2] - Temp[5, 1] - 
                Temp[5, 2]\)\/\(2548400 + 2548400\ r[4]\) + 
            \((\(-Temp[3, 1]\) - Temp[3, 2] + 2\ Temp[4, 1] + 2\ Temp[4,
2] - 
                  Temp[5, 1] - Temp[5, 2])\)/3247171280000 == 
          8.62222222222222178`*^-10\), ",", 
        \(1.25`*^-11\ \((\(-Temp[4, 2]\) + Temp[4, 3])\) + 
            \(Temp[3, 2] + Temp[3, 3] - Temp[5, 2] - 
                Temp[5, 3]\)\/\(2548400 + 2548400\ r[4]\) + 
            \((\(-Temp[3, 2]\) - Temp[3, 3] + 2\ Temp[4, 2] + 2\ Temp[4,
3] - 
                  Temp[5, 2] - Temp[5, 3])\)/3247171280000 == 
          8.62222222222222178`*^-10\), ",", 
        \(1.25`*^-11\ \((\(-Temp[4, 3]\) + Temp[4, 4])\) + 
            \(Temp[3, 3] + Temp[3, 4] - Temp[5, 3] - 
                Temp[5, 4]\)\/\(2548400 + 2548400\ r[4]\) + 
            \((\(-Temp[3, 3]\) - Temp[3, 4] + 2\ Temp[4, 3] + 2\ Temp[4,
4] - 
                  Temp[5, 3] - Temp[5, 4])\)/3247171280000 == 
          8.62222222222222178`*^-10\), ",", 
        \(1.25`*^-11\ \((\(-Temp[5, 0]\) + Temp[5, 1])\) + 
            \(Temp[4, 0] + Temp[4, 1] - Temp[6, 0] - 
                Temp[6, 1]\)\/\(2548400 + 2548400\ r[5]\) + 
            \((\(-Temp[4, 0]\) - Temp[4, 1] + 2\ Temp[5, 0] + 2\ Temp[5,
1] - 
                  Temp[6, 0] - Temp[6, 1])\)/3247171280000 == 
          8.62222222222222178`*^-10\), ",", 
        \(1.25`*^-11\ \((\(-Temp[5, 1]\) + Temp[5, 2])\) + 
            \(Temp[4, 1] + Temp[4, 2] - Temp[6, 1] - 
                Temp[6, 2]\)\/\(2548400 + 2548400\ r[5]\) + 
            \((\(-Temp[4, 1]\) - Temp[4, 2] + 2\ Temp[5, 1] + 2\ Temp[5,
2] - 
                  Temp[6, 1] - Temp[6, 2])\)/3247171280000 == 
          8.62222222222222178`*^-10\), ",", 
        \(1.25`*^-11\ \((\(-Temp[5, 2]\) + Temp[5, 3])\) + 
            \(Temp[4, 2] + Temp[4, 3] - Temp[6, 2] - 
                Temp[6, 3]\)\/\(2548400 + 2548400\ r[5]\) + 
            \((\(-Temp[4, 2]\) - Temp[4, 3] + 2\ Temp[5, 2] + 2\ Temp[5,
3] - 
                  Temp[6, 2] - Temp[6, 3])\)/3247171280000 == 
          8.62222222222222178`*^-10\), ",", 
        \(1.25`*^-11\ \((\(-Temp[5, 3]\) + Temp[5, 4])\) + 
            \(Temp[4, 3] + Temp[4, 4] - Temp[6, 3] - 
                Temp[6, 4]\)\/\(2548400 + 2548400\ r[5]\) + 
            \((\(-Temp[4, 3]\) - Temp[4, 4] + 2\ Temp[5, 3] + 2\ Temp[5,
4] - 
                  Temp[6, 3] - Temp[6, 4])\)/3247171280000 == 
          8.62222222222222178`*^-10\), ",", 
        \(\(-Temp[6, 0]\) + Temp[6, 1] == \(-40\)\), ",", 
        \(\(-Temp[6, 1]\) + Temp[6, 2] == \(-40\)\), ",", 
        \(\(-Temp[6, 2]\) + Temp[6, 3] == \(-40\)\), ",", 
        \(\(-Temp[6, 3]\) + Temp[6, 4] == \(-40\)\), ",", 
        \(Temp[0, 0] - 
            1.31615154015573643`\ 
              \((\(-75.2835820895522278`\) + 
                  1.24020907206348529`\ Temp[0, 1] - 
                  0.24020907206348534`\ Temp[1, 0] - 
                  0.24020907206348534`\ Temp[1, 1])\) == 0\), ",", 
        \(Temp[0, 1] - 
            1.31615154015573643`\ 
              \((\(-75.2835820895522278`\) + 
                  1.24020907206348529`\ Temp[0, 2] - 
                  0.24020907206348534`\ Temp[1, 1] - 
                  0.24020907206348534`\ Temp[1, 2])\) == 0\), ",", 
        \(Temp[0, 2] - 
            1.31615154015573643`\ 
              \((\(-75.2835820895522278`\) + 
                  1.24020907206348529`\ Temp[0, 3] - 
                  0.24020907206348534`\ Temp[1, 2] - 
                  0.24020907206348534`\ Temp[1, 3])\) == 0\), ",", 
        \(Temp[0, 3] - 
            1.31615154015573643`\ 
              \((\(-75.2835820895522278`\) + 
                  1.24020907206348529`\ Temp[0, 4] - 
                  0.24020907206348534`\ Temp[1, 3] - 
                  0.24020907206348534`\ Temp[1, 4])\) == 0\), ",", 
        RowBox[{\(Temp[0, 0]\), "==", 
          StyleBox["500.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->3]}], ",", 
        RowBox[{\(Temp[1, 0]\), "==", 
          StyleBox["500.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->3]}], ",", 
        RowBox[{\(Temp[2, 0]\), "==", 
          StyleBox["500.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->3]}], ",", 
        RowBox[{\(Temp[3, 0]\), "==", 
          StyleBox["500.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->3]}], ",", 
        RowBox[{\(Temp[4, 0]\), "==", 
          StyleBox["500.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->3]}], ",", 
        RowBox[{\(Temp[5, 0]\), "==", 
          StyleBox["500.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->3]}], ",", 
        RowBox[{\(Temp[6, 0]\), "==", 
          StyleBox["500.`",
            StyleBoxAutoDelete->True,
            PrintPrecision->3]}]}], "}"}]], "Output"] }, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
    \(soln = Solve[eqns, Table[Temp[i, j], {i, 0, 6}, {j, 0, 4}]]\)],
"Input"],

Cell[BoxData[
    StyleBox[
      \(General::"ivar" \( : \ \) 
        "\!\({\(Temp[\(6, 0\)]\), \(Temp[\(6, 1\)]\), \(Temp[\(6,
2\)]\), \ \(Temp[\(6, 3\)]\), \(Temp[\(6, 4\)]\)}\) is not a valid
variable."\),
      FontColor->RGBColor[1, 0, 0]]], "Message"] }, Open  ]],

Cell[BoxData[
    RowBox[{
      StyleBox["(*",
        FontColor->RGBColor[0, 0, 1]], 
      StyleBox[" ",
        FontColor->RGBColor[0, 0, 1]], 
      StyleBox[
        \(This\ is\ my\ problem . \ I\ bold\ it\ in\ red . \ What' s\
wrong\ 
          with\ the\ above?\ I\ want\ to\ find\ the\ solutions\ and\ 
          ListPlot3D\ them . \ I' ve\ spent\ almost\ a\ month\ and\ 
          unfortunately\ I\ still\ can' t\ fix\ it\ out . \ Would\ you\
do\ me
          \ a\ favour?\ Thank\ \(you . \)\),
        FontColor->RGBColor[0, 0, 1]], 
      StyleBox[" ",
        FontColor->RGBColor[0, 0, 1]], 
      StyleBox["*)",
        FontColor->RGBColor[0, 0, 1]]}]], "Input"] },
FrontEndVersion->"Microsoft Windows 3.0", ScreenRectangle->{{0, 640},
{0, 452}}, WindowSize->{462, 234},
WindowMargins->{{3, Automatic}, {Automatic, 5}} ]


(***********************************************************************
Cached data follows.  If you edit this Notebook file directly, not
using Mathematica, you must remove the line containing CacheID at the
top of  the file.  The cache data will then be recreated when you save
this file  from within Mathematica.
***********************************************************************)

(*CellTagsOutline
CellTagsIndex->{}
*)

(*CellTagsIndex
CellTagsIndex->{}
*)

(*NotebookFileOutline
Notebook[{
Cell[1709, 49, 209, 5, 50, "Input"],

Cell[CellGroupData[{
Cell[1943, 58, 1131, 30, 125, "Input"], Cell[3077, 90, 757, 23, 83,
"Output"] }, Open  ]],
Cell[3849, 116, 151, 3, 30, "Input"],

Cell[CellGroupData[{
Cell[4025, 123, 1962, 40, 333, "Input"], Cell[5990, 165, 472, 8, 188,
"Output"] }, Open  ]],

Cell[CellGroupData[{
Cell[6499, 178, 547, 11, 210, "Input"], Cell[7049, 191, 9683, 212, 808,
"Output"] }, Open  ]],
Cell[16747, 406, 122, 2, 30, "Input"],

Cell[CellGroupData[{
Cell[16894, 412, 178, 3, 90, "Input"], Cell[17075, 417, 1983, 35, 675,
"Output"] }, Open  ]],
Cell[19073, 455, 238, 5, 70, "Input"],

Cell[CellGroupData[{
Cell[19336, 464, 878, 13, 350, "Input"], Cell[20217, 479, 9853, 178,
2641, "Output"] }, Open  ]],

Cell[CellGroupData[{
Cell[30107, 662, 92, 1, 30, "Input"], Cell[30202, 665, 258, 5, 63,
"Message"] }, Open  ]],
Cell[30475, 673, 676, 16, 110, "Input"] }
]
*)



(***********************************************************************
End of Mathematica Notebook file.
***********************************************************************)



  • Prev by Date: Batch processing
  • Next by Date: Re: Re: Assignment to a block inside a matrix
  • Prev by thread: Batch processing
  • Next by thread: Re: Debug program