MathGroup Archive 2004

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

Search the Archive

RE: Re: Subscript Variable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47695] RE: [mg47666] Re: [mg20188] Subscript Variable
  • From: "DrBob" <drbob at bigfoot.com>
  • Date: Thu, 22 Apr 2004 02:38:44 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I use the palette described at the following link. If you have trouble with
the length of that link, go to Google Groups and search for "Copy as
InputForm". The result will look a lot like the text you don't like, for
instance x subscripted by i is Subscript[x,i], but to see it the usual way
all you have to do is copy it from e-mail and paste it into Mathematica.

http://groups.google.com/groups?q=Copy+as+InputForm+group:comp.soft-sys.math
.mathematica&hl=en&lr=&ie=UTF-8&group=comp.soft-sys.math.mathematica&selm=br
uqgf%24sv6%241%40smc.vnet.net&rnum=1

DrBob

www.eclecticdreams.net

-----Original Message-----
From: Margaret [mailto:tastetations2002 at hotmail.com] 
To: mathgroup at smc.vnet.net
Subject: [mg47695] [mg47666] Re: [mg20188] Subscript Variable

Hi,  I would like to know in simple language how I insert subscript or
superscript into my e-mails.  75 degrees for eg.

the stuff below is for a programmer which I am not.  Any help will be
appreciated.

Tks, M.


On 15 Oct 1999 14:23:55 -0400, David Park wrote:
>Michel,
>
>A couple of months ago Carl Woll posted one solution to this problem.
Essentially he
>changed the Attributes of Subscript to HoldFirst, and added
SubscriptInformation and
>ClearSubscripts routines. I liked his routine so much I made a little
package of it
>and extended it slightly. Here are examples of it's use.
>
>< Algebra`WollSubscripts`
>
>?Algebra`WollSubscripts
>"WollSubscripts sets the attributes of Subscript to HoldFirst so that
it can \
>be used like a symbol. Subscript definitions can be defined. The
additional \
>routines ClearSubscripts and SubscriptInformation are also provided."
>
>?ClearSubscripts
>"ClearSubscripts[sym1, sym2,...] will clear all Subscript definitions
based \
>on the symbols."
>
>?SubscriptInformation
>"SubscriptInformation[sym1, sym2,...] will print the Subscript
definitions \
>based on the symbols."
>
>Here I use InputFormat so it will be readable in email.
>
>Subscript[f, 1][x_] = x^2 + 1;
>Subscript[f, 2][x_] = x^3 - 1;
>
>SubscriptInformation[f]
>Subscript[f, 1][x_] = 1 + x^2
>Subscript[f, 2][x_] = -1 + x^3
>
>?? Subscript
>"Subscript has been given the Attribute HoldFirst so that it can be \
>used like a symbol and be given definitions."
>Attributes["Subscript"] = {HoldFirst}
>Subscript[f, 1][x_] = 1 + x^2
>Subscript[f, 2][x_] = -1 + x^3
>
>Subscript[f, 2][y] - Subscript[f, 1][y]
>-2 - y^2 + y^3
>
>ClearSubscripts[f]
>SubscriptInformation[f]
>(none)
>
>?? Subscript
>"Subscript has been given the Attribute HoldFirst so that it can be \
>used like a symbol and be given definitions."
>Attributes["Subscript"] = {HoldFirst}
>
>I am pasting the notebook that creates the package at the end of the
email. The
>package should be placed in the AddOns/ExtraPackages/Algebra
directory.
>
>David Park
>djmp at earthlink.net
><a
href="http://home.earthlink.net/~djmp/";>http://home.earthlink.net/~djmp/</a>
>
>>Hello,
>>
>>I have a problem about subscript variables.
>>
>>First Question :
>>
>>If I use a variable named Subscript[x,1] ,
>>(typed in with Ctrl _)
>>
>>I can affect a value to this variable, get value of expressions
>>involving this variable, clear this variable with . but not with
Clear[]
>>!
>>
>>This variable is not given when I ask Names["x*"] and I cannot get
>>information on it with ?.
>>
>>
>>Second Question :
>>
>>If I use such a variable in order to define a function with
>>  f1[x_]=x^2+1
>>I cannot clear the variable with f1=.
>>(of course, just above f1 means Subscript[f,1])
>>
>>
>>Thanks a lot for any help
>>
>>
>>J.Michel CORNIL
>>
>
>
>(***********************************************************************
>
>                    Mathematica-Compatible Notebook
>
>This notebook can be used on any computer system with Mathematica
4.0,
>MathReader 4.0, or any compatible application. 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: <a href="http://www.wolfram.com";>http://www.wolfram.com</a>
>  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[      5011,        143]*)
>(*NotebookOutlinePosition[      5736,        168]*)
>(*  CellTagsIndexPosition[      5692,        164]*)
>(*WindowFrame->Normal*)
>
>
>
>Notebook[{
>
>Cell[CellGroupData[{
>Cell["Algebra`WollSubscripts` Package", "Title"],
>
>Cell[CellGroupData[{
>
>Cell["Implementation", "Section",
>  InitializationCell->True],
>
>Cell[BoxData[{
>    \(ClearAll[Subscript]\), "\[IndentingNewLine]",
>    \(\(Subscript::usage = "\<Subscript has been given the Attribute
\
>HoldFirst so that it can be used like a symbol and be given \
>definitions.\>";\)\), "\[IndentingNewLine]",
>    \(SetAttributes[Subscript, {HoldFirst}]\)}], "Input",
>  InitializationCell->True],
>
>Cell[BoxData[
>    \(BeginPackage["\<Algebra`WollSubscripts`\>"]\)], "Input",
>  InitializationCell->True],
>
>Cell[BoxData[
>    \(Algebra`WollSubscripts::usage = "\<WollSubscripts sets the
attributes \
>of Subscript to HoldFirst so that it can be used like a symbol.
Subscript \
>definitions can be defined. The additional routines ClearSubscripts
and \
>SubscriptInformation are also provided.\>"\)], "Input",
>  InitializationCell->True],
>
>Cell[BoxData[
>    \(\(ClearSubscripts::usage = "\<ClearSubscripts[sym1, sym2,...]
will \
>clear all Subscript definitions based on the symbols.\>";\)\)],
"Input",
>  InitializationCell->True],
>
>Cell[BoxData[
>    \(\(SubscriptInformation::usage = "\<SubscriptInformation[sym1,
sym2,...] \
>will print the Subscript definitions based on the symbols.\>";\)\)],
"Input",
>  InitializationCell->True],
>
>Cell[BoxData[
>    \(Begin["\<`Private`\>"]\)], "Input",
>  InitializationCell->True],
>
>Cell[BoxData[{
>    \(\(SetAttributes[
>        ClearSubscripts, {HoldAll}];\)\), "\[IndentingNewLine]",
>    \(ClearSubscripts[a__]\  := \[IndentingNewLine]\
>      Module[{b}, \[IndentingNewLine]DownValues[Subscript]\  =
>          Cases[DownValues[Subscript], \((b_\  :> \ _)\)\  /; \
>              FreeQ[b,
>                HoldPattern[
>                  Subscript[
>                    Alternatives[a], \ __]]]];
\[IndentingNewLine]SubValues[
>            Subscript]\  =
>          Cases[SubValues[Subscript], \((b_\  :> \ _)\)\  /; \
>              FreeQ[b,
>                HoldPattern[
>                  Subscript[
>                    Alternatives[
>                      a], \ __]]]];\[IndentingNewLine]]\)}], "Input",
>  InitializationCell->True],
>
>Cell[BoxData[{
>    StyleBox[\(SetAttributes[SubscriptInformation, \ {HoldAll}];\),
>      FormatType->StandardForm], "\n",
>    StyleBox[\(SubscriptInformation[syms__]\  := \[IndentingNewLine]\
>        Module[{PrintDownValue},
\[IndentingNewLine]PrintDownValue[\(Verbatim[
>                    HoldPattern]\)[a_]\  :> \ b_]\  := \
>            Print[HoldForm[
>                a\  = \
>                  b]]; \[IndentingNewLine]PrintDownValue\  /@
\((DeleteCases[
>                Join[DownValues[Subscript],
>                  SubValues[Subscript]], \ \((b_\  :> \ _)\)\  /; \
>                  FreeQ[b,
>                    HoldPattern[
>                      Subscript[
>                        Alternatives[
>                          syms], \ __]]]])\);\[IndentingNewLine]]\),
>      FormatType->StandardForm]}], "Input",
>  InitializationCell->True],
>
>Cell[BoxData[
>    \(End[]\)], "Input",
>  InitializationCell->True],
>
>Cell[BoxData[
>    \(Protect[ClearSubscripts, SubscriptInformation]\)], "Input",
>  InitializationCell->True],
>
>Cell[BoxData[
>    \(EndPackage[]\)], "Input",
>  InitializationCell->True]
>}, Open  ]]
>}, Open  ]]
>},
>FrontEndVersion->"4.0 for Microsoft Windows",
>ScreenRectangle->{{0, 1024}, {0, 683}},
>AutoGeneratedPackage->Automatic,
>InitializationCellEvaluation->False,
>WindowSize->{591, 571},
>WindowMargins->{{Automatic, 94}, {Automatic, 21}}
>]
>
>
>(***********************************************************************
>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[CellGroupData[{
>Cell[1739, 51, 48, 0, 150, "Title"],
>
>Cell[CellGroupData[{
>Cell[1812, 55, 61, 1, 53, "Section",
>  InitializationCell->True],
>Cell[1876, 58, 332, 6, 110, "Input",
>  InitializationCell->True],
>Cell[2211, 66, 104, 2, 30, "Input",
>  InitializationCell->True],
>Cell[2318, 70, 325, 5, 110, "Input",
>  InitializationCell->True],
>Cell[2646, 77, 189, 3, 70, "Input",
>  InitializationCell->True],
>Cell[2838, 82, 199, 3, 70, "Input",
>  InitializationCell->True],
>Cell[3040, 87, 83, 2, 30, "Input",
>  InitializationCell->True],
>Cell[3126, 91, 751, 17, 250, "Input",
>  InitializationCell->True],
>Cell[3880, 110, 848, 17, 210, "Input",
>  InitializationCell->True],
>Cell[4731, 129, 66, 2, 30, "Input",
>  InitializationCell->True],
>Cell[4800, 133, 107, 2, 30, "Input",
>  InitializationCell->True],
>Cell[4910, 137, 73, 2, 30, "Input",
>  InitializationCell->True]
>}, Open  ]]
>}, Open  ]]
>}
>]
>*)
>
>
>
>
>(***********************************************************************
>End of Mathematica Notebook file.



  • Prev by Date: RE: Undo and Plot3D
  • Next by Date: Re: NETLink + CodeDOM 01 HelloNetWorld Revisited
  • Previous by thread: Re: Subscript Variable
  • Next by thread: NETLink Example 02: Net-Object-Reflection