MathGroup Archive 2005

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

Search the Archive

Re: Superscript Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58682] Re: Superscript Problem
  • From: dh <dh at metrohm.ch>
  • Date: Thu, 14 Jul 2005 02:49:07 -0400 (EDT)
  • References: <db2gb0$djt$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Stan,
you are right most superscripts are treated as an exponent.
A way around is to use low level input, e.g.
"SubsuperscriptBox"
The drawback is, that you must use "DisplayForm" to view the glamour if it.

Example:
a1=SubsuperscriptBox[b, 0, 0];
a2=SubsuperscriptBox[b, 1, 0];
(*do not use the same variable name on the left side like inside 
SubsuperscriptBox*)
with a1 and a2 you can do whatever you want, but if you want to see the 
super and subscripts you need to use "DisplayForm"

a1 gives: SubsuperscriptBox[b, 0, 0] not what you want
but:
a1 //DisplayForm gives bd0u0 where I use d for subscript and u for 
superscript.
a1 a1 //DisplayForm gives (bd0u0)^2
a1 a2 //DisplayForm gives  bd0u0 bd1u0

sincerely, Daniel

Stan Gianzero wrote:
> Jean-Marc Gulliet,
> I appreciate your spending the time on my problem. I have two points to 
> make. First, I have just begun using Mathematica, so I would have 
> difficulty applying your algorithm. Second, it would be best to 
> describe my problem in its proper context. I am attaching a Mathematica 
> file that describes the problem and what I have done to circumvent the 
> problem. In short, I placed the superscripts along with the other 
> subscripts that I used in the problem. I simply want to use the 
> superscripts as  LABELS and do NOT want them  to be interpreted as an 
> exponents. If after reading my attachment you feel you can help, I 
> would greatly appreciate it. Please, however, do not spend too much of 
> your time tending to the problem.
> Stan
> 
> 
> (************** Content-type: application/mathematica **************
>                      CreatedBy='Mathematica 5.1'
> 
>                     Mathematica-Compatible Notebook
> 
> This notebook can be used with any Mathematica-compatible
> application, such as Mathematica, MathReader or Publicon. The data
> for the notebook starts with the line containing 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[      4669,        122]*)
> (*NotebookOutlinePosition[      5305,        144]*)
> (*  CellTagsIndexPosition[      5261,        140]*)
> (*WindowFrame->Normal*)
> 
> 
> 
> Notebook[{
> Cell[BoxData[
>     \(\("\<Basic Algorithm relating Local and Global Matrices\>";\)\)], \
> "Input"],
> 
> Cell[BoxData[
>     \(For[i = 1, i < 8, \(i++\), 
>       For[j = 1, 
>         j < 8, \(j++\), \ \ B[i, 
>             j] = \[Sum]\+\(n = 1\)\%3\(\[Sum]\+\(k = 0\)\%1\(\[Sum]\+\(l = \
> 0\)\%1\(\[Sum]\+\(p = 0\)\%1\(\[Sum]\+\(q = 0\)\%1\((KroneckerDelta[i, 
>                           2 \((n + l)\) - \((k + 1)\)]*
>                         KroneckerDelta[j, 2 \((n + q)\) - \((p + 1)\)]*
>                         b\_\(n - 1, 2 \((n + l)\) - \((k + 1)\), 2 \((n + \
> q)\) - \((p + 1)\)\))\)\)\)\)\)]]\)], "Input"],
> 
> Cell[BoxData[""], "Input"],
> 
> Cell[CellGroupData[{
> 
> Cell[BoxData[
>     \(MatrixForm[Array[B, {7, 7}]]\)], "Input"],
> 
> Cell[BoxData[
>     TagBox[
>       RowBox[{"(", "\[NoBreak]", GridBox[{
>             {\(b\_\(0, 1, 1\)\), \(b\_\(0, 1, 2\)\), \(b\_\(0, 1, 3\)\), "0", 
>               "0", "0", "0"},
>             {\(b\_\(0, 2, 1\)\), \(b\_\(0, 2, 2\) + 
>                 b\_\(1, 2, 2\)\), \(b\_\(0, 2, 3\) + 
>                 b\_\(1, 2, 3\)\), \(b\_\(1, 2, 4\)\), \(b\_\(1, 2, 5\)\), "0",
>                "0"},
>             {\(b\_\(0, 3, 1\)\), \(b\_\(0, 3, 2\) + 
>                 b\_\(1, 3, 2\)\), \(b\_\(0, 3, 3\) + 
>                 b\_\(1, 3, 3\)\), \(b\_\(1, 3, 4\)\), \(b\_\(1, 3, 5\)\), "0",
>                "0"},
>             {
>               "0", \(b\_\(1, 4, 2\)\), \(b\_\(1, 4, 3\)\), \(b\_\(1, 4, 4\) + 
>                 b\_\(2, 4, 4\)\), \(b\_\(1, 4, 5\) + 
>                 b\_\(2, 4, 5\)\), \(b\_\(2, 4, 6\)\), \(b\_\(2, 4, 7\)\)},
>             {
>               "0", \(b\_\(1, 5, 2\)\), \(b\_\(1, 5, 3\)\), \(b\_\(1, 5, 4\) + 
>                 b\_\(2, 5, 4\)\), \(b\_\(1, 5, 5\) + 
>                 b\_\(2, 5, 5\)\), \(b\_\(2, 5, 6\)\), \(b\_\(2, 5, 7\)\)},
>             {"0", "0", 
>               "0", \(b\_\(2, 6, 4\)\), \(b\_\(2, 6, 5\)\), \(b\_\(2, 6, 
>                   6\)\), \(b\_\(2, 6, 7\)\)},
>             {"0", "0", 
>               "0", \(b\_\(2, 7, 4\)\), \(b\_\(2, 7, 5\)\), \(b\_\(2, 7, 
>                   6\)\), \(b\_\(2, 7, 7\)\)}
>             },
>           RowSpacings->1,
>           ColumnSpacings->1,
>           ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
>       Function[ BoxForm`e$, 
>         MatrixForm[ BoxForm`e$]]]], "Output"]
> }, Open  ]],
> 
> Cell[BoxData[
>     \(\("\<The first subscript on the b's (local) I would like to have as  a \
> superscript, but Mathematica treats all superscripts as exponents thereby \
> producing unity whenever the superscript is zero. The problem was \
> circumvented by adopting triple subscripts with the first subscript playing \
> the role of the superscript\>";\)\)], "Input"],
> 
> Cell[BoxData[
>     \(\(\(\*"\"\<As an example, the first element in the matrix, \!\(b\_\(\(0\
> \)\(,\)\(1\)\(,\)\(1\)\(,\)\(\\\ \)\)\)I would like to be \!\(b\_\(\(1\)\(,\)\
> \(1\)\(\\\ \)\)\%0\) because it has a special physical \
> significance.\>\"";\)\(\[IndentingNewLine]\)
>     \)\)], "Input"]
> },
> FrontEndVersion->"5.1 for Macintosh",
> ScreenRectangle->{{4, 1280}, {0, 1002}},
> WindowSize->{945, 767},
> WindowMargins->{{4, Automatic}, {Automatic, 4}}
> ]
> 
> (*******************************************************************
> 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[1754, 51, 96, 2, 39, "Input"],
> Cell[1853, 55, 499, 9, 193, "Input"],
> Cell[2355, 66, 26, 0, 39, "Input"],
> 
> Cell[CellGroupData[{
> Cell[2406, 70, 61, 1, 39, "Input"],
> Cell[2470, 73, 1523, 32, 207, "Output"]
> }, Open  ]],
> Cell[4008, 108, 361, 5, 154, "Input"],
> Cell[4372, 115, 293, 5, 92, "Input"]
> }
> ]
> *)
> 
> 
> 
> (*******************************************************************
> End of Mathematica Notebook file.
> *******************************************************************)
> 


  • Prev by Date: Re: //N bug, but WHY?
  • Next by Date: Re: //N bug, but WHY?
  • Previous by thread: Re: Superscript Problem
  • Next by thread: positive square root