MathGroup Archive 2002

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

Search the Archive

Re: how can I solve this with mathematica?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34883] Re: [mg34816] how can I solve this with mathematica?
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Tue, 11 Jun 2002 05:00:59 -0400 (EDT)
  • References: <200206080921.FAA26123@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Easy. But you must first learn to use the proper parentheses and brackets
following the conventions in Mathematica.

In[1]:=
c = Sum[s[n, m]*Cos[p*(m + 1/2)*(Pi/Y)]*Cos[q*(n + 1/2)*(Pi/X)], {n, 0, X -
1}, {m, 0, Y - 1}];

In[2]:=
c /. {X -> 4, Y -> 4, p -> 0, q -> 0}
Out[2]=
s[0, 0] + s[0, 1] + s[0, 2] + s[0, 3] + s[1, 0] + s[1, 1] + s[1, 2] + s[1,
3] + s[2, 0] +
  s[2, 1] + s[2, 2] + s[2, 3] + s[3, 0] + s[3, 1] + s[3, 2] + s[3, 3]

In[3]:=
c /. {X -> 4, Y -> 4, p -> 1, q -> 0}
Out[3]=
Cos[Pi/8]*s[0, 0] + Cos[(3*Pi)/8]*s[0, 1] + Cos[(5*Pi)/8]*s[0, 2] +
Cos[(7*Pi)/8]*s[0, 3] +
  Cos[Pi/8]*s[1, 0] + Cos[(3*Pi)/8]*s[1, 1] + Cos[(5*Pi)/8]*s[1, 2] +
Cos[(7*Pi)/8]*s[1, 3] +
  Cos[Pi/8]*s[2, 0] + Cos[(3*Pi)/8]*s[2, 1] + Cos[(5*Pi)/8]*s[2, 2] +
Cos[(7*Pi)/8]*s[2, 3] +
  Cos[Pi/8]*s[3, 0] + Cos[(3*Pi)/8]*s[3, 1] + Cos[(5*Pi)/8]*s[3, 2] +
Cos[(7*Pi)/8]*s[3, 3]

etc.

Tomas Garza
Mexico City
----- Original Message -----
From: "daldosch" <daldosch at aon.at>
To: mathgroup at smc.vnet.net
Subject: [mg34883] [mg34816] how can I solve this with mathematica?


> How can I solve the following problem?
>
>
> (***********************************************************************
>
>                     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 at 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[      6491,        135]*)
> (*NotebookOutlinePosition[      7142,        158]*)
> (*  CellTagsIndexPosition[      7098,        154]*)
> (*WindowFrame->Normal*)
>
>
>
> Notebook[{
> Cell[BoxData[
>     \(c =
>       \(\[Sum]\+\(n = 0\)\%\(X - 1
>               \)\(\[Sum]\+\(m = 0\)\%\(Y - 1\){
>                 s \((n, m)\)*cos \((p \((m + 1\/2)\) \[Pi]\/Y)\)*cos
>                   \((q \((n + 1\/2)\) \[Pi]\/X)\)}\n\t\nX\) = 4\), Y = 4\
,
>     0 \[LessEqual] n \[GreaterEqual] 3, 0 \[LessEqual] m \[GreaterEqual]
3,
>     0 \[LessEqual] p \[GreaterEqual] 3,
>     0 \[LessEqual] q \[GreaterEqual] 3\)], "Input"],
>
> Cell[BoxData[
>     \(how\ can\ I\ get\ a\ result\ like\ the\ \(following\ ?\)\)],
"Input"],
>
> Cell[BoxData[{
>     \(for\ p = 0, q = 0\),
>     \(c \((0, 0)\) = {\n
>         s \((0, 0)\)*cos \((0)\)*cos \((0)\) +
>           s \((0, 1)\)*cos \((0)\)*cos \((0)\) +
>           s \((0, 2)\)*cos \((0)\)*cos \((0)\) +
>           s \((0, 3)\)*cos \((0)\)*cos \((0)\) + \n
>           s \((1, 0)\)*cos \((0)\)*cos \((0)\) +
>           s \((1, 1)\)*cos \((0)\)*cos \((0)\) +
>           s \((1, 2)\)*cos \((0)\)*cos \((0)\) +
>           s \((1, 3)\)*cos \((0)\)*cos \((0)\) + \n
>           s \((2, 0)\)*cos \((0)\)*cos \((0)\) +
>           s \((2, 1)\)*cos \((0)\)*cos \((0)\) +
>           s \((2, 2)\)*cos \((0)\)*cos \((0)\) +
>           s \((2, 3)\)*cos \((0)\)*cos \((0)\) + \n
>           s \((3, 0)\)*cos \((0)\)*cos \((0)\) +
>           s \((3, 1)\)*cos \((0)\)*cos \((0)\) +
>           s \((3, 2)\)*cos \((0)\)*cos \((0)\) +
>           s \((3, 3)\)*cos \((0)\)*cos \((0)\)}\n\t\),
>     \(for\ p = 1, q = 0\),
>     \(c =
>       \(\((1, 0)\) = {\n\t
>           \(\(\(\(\(\(\({s \((0, 0)\)*cos
>                                 \((1 \((0 + 1\/2)\) \[Pi]\/4*cos \((0)\) +
>                                     s \((0, 1)\)*cos
>                                       \((1 \((1 + 1\/2)\) \[Pi]\/4*cos
>                                         \((0)\) + \n\t\t
>                                         s \((0, 2)\)*cos
>                                         \((1 \((2 + 1\/2)\) \[Pi]\/4*cos
>                                         \((0)\) +
>                                         s \((0, 3)\)*cos
>                                         \((1 \((3 + 1\/2)\) \[Pi]\/4*cos
>                                         \((0)\) + \n\ \t
>                                         s \((1, 0)\)*cos
>                                         \((1 \((0 + 1\/2)\) \[Pi]\/4*cos
>                                         \((0)\) + s \((1, 1)\)*cos
>                                         \((1 \((1 + 1\/2)\) \[Pi]\/4*cos
>                                         \((0)\) + \n\t\ts \((1, 2)\)*cos
>                                         \((1 \((2 + 1\/2)\) \[Pi]\/4*cos
\((0)
>                                         \) + s \((1, 3)\)*cos \((1 \((3 +
>                                         1\/2)\) \[Pi]\/4*cos \((0)\) +
\n\t\
>                                         s \((2, 0)\)*cos \((1 \((0 +
1\/2)\)
>                                         \[Pi]\/4*cos \((0)\) + s \((2,
>                                         1)\)*cos \((1 \((1 + 1\/2)\)
>                                         \[Pi]\/4*cos \((0)\) + \n\t\ts
\((2,
>                                         2)\)*cos \((1 \((2 + 1\/2)\)
>                                         \[Pi]\/4*cos \((0)\) + s \((2,
>                                         3)\)*cos \((1 \((3 + 1\/2)\)
>                                         \[Pi]\/4*cos \((0)\) + \t\n\t\ s
>                                         \((3, 0)\)*cos \((1 \((0 + 1\/2)\)
>                                         \[Pi]\/4*cos \((0)\) + s \((3,
>                                         1)\)*cos \((1 \((1 + 1\/2)\)
>                                         \[Pi]\/4*cos \((0)\) + \n\t\ts
\((3,
>                                         2)\)*cos \((1 \((2 + 1\/2)\)
>                                         \[Pi]\/4*cos \((0)\) + s \((3,
>                                         3)\)*cos \((1 \((3 + 1\/2)\)
>                                         \[Pi]\/4*cos
>                                         \((0)
>
\)\)\)\)\)\)\)\)\)\)\)\)\)\)\)\)\)}
>                               \t\t\t\t\n
>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\
> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t ... \) ... \) ...
>                         \) ... \) ... \) ... \) ... \)\n\t\t\tfor\ p = 1,
>           q = 1\t\t\t\n\t\t\ts \((0, 0)\)*cos
>               \((1 \((0 + 1\/2)\) \[Pi]\/4*cos
>                   \((1 \((0 + 1\/2)\) \[Pi]\/4 + \n\t\t\t
>                       s \((1, 0)\)*cos
>                         \((1 \((0 + 1\/2)\) \[Pi]\/4*cos
>                             \((\(\(\(1 \((1 + 1\/2)\) \[Pi]\/4 ... \) ...
>                                     \) ...  .
>
\)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\
> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\)\)\)\)\)\)}], "Input"]
> },
> FrontEndVersion->"Microsoft Windows 3.0",
> ScreenRectangle->{{0, 800}, {0, 544}},
> WindowSize->{772, 478},
> WindowMargins->{{-11, Automatic}, {-1, Automatic}}
> ]
>
>
> (***********************************************************************
> 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, 424, 8, 105, "Input"],
> Cell[2136, 59, 89, 1, 30, "Input"],
> Cell[2228, 62, 4259, 71, 590, "Input"]
> }
> ]
> *)
>
>
>
>
> (***********************************************************************
> End of Mathematica Notebook file.
> ***********************************************************************)
>



  • Prev by Date: Re: Re: Using Mathgroup Effectively -- cutting and pasting expressions
  • Next by Date: RE: Re: PlotVectorField
  • Previous by thread: how can I solve this with mathematica?
  • Next by thread: Re: limit crash