Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8972

Re: Typing Formula Steps in a Grid

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Typing Formula Steps in a Grid
Date 2012-03-12 09:09 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jjkege$1b0$1@smc.vnet.net> (permalink)
References <201203110907.EAA19375@smc.vnet.net>

Show all headers | View raw


With[{sub = {
    Subscript[R, p] -> 0.03,
    Subscript[R, B] -> 0.02},
  expr1 = HoldForm[
    Subscript[R, p] - Subscript[R, B]],
  expr2 = HoldForm[Subscript[R, p]/
      Subscript[R, B] - 1]},
 Grid[
  {{"", Row[{Subscript[R, p],
      " = ", Subscript[R, p] /. sub}],
    Row[{Subscript[R, B], " = ",
      Subscript[R, B] /. sub}],
    SpanFromLeft},
   {"Excess Return:", expr1, "=",
    expr1 /. sub, "=",
    expr1 /. sub // ReleaseHold},
   {"Relative Return:", expr2, "=",
    expr2 /. sub, "=",
    expr2 /. sub // ReleaseHold}}]]


Bob Hanlon


On Sun, Mar 11, 2012 at 5:07 AM, Ride <edmund.r@gmail.com> wrote:
> Good day all,
>
> I am a new Mathematica Home user.  While typing out the workings for a formula in a Grid, Mathematica complains that the operators are protected and will not display the formulas.
>
> The first Grid works fine:
>
> Grid[{{Style["Excess Return", Bold],
>    Style["Relative Return", Bold]}, {Subscript[R, p] - Subscript[R,
>     B], Subscript[R, P]/Subscript[R, B] - 1}},
>  Dividers -> {{False, True}, {False, True}}
>  ] // TraditionalForm
>
> Then when I do an example grid I expect to see the assignments in the top row and the workings in the second row.
>
> Grid[{{Subscript[R, p] = 0.03,
>   Subscript[R, B] = 0.02}, {Subscript[R, p] - Subscript[R, B] =  0.03 - 0.02 = 0.01, SpanFromLeft}}]
>
> However, all I get back is the following two errors:
>
> Set::write: Tag Plus in -0.02+0.03 is Protected. >>
> Set::write: Tag Plus in -0.02+0.03 is Protected. >>
>
> And this grid:
>
> {
>  {0.03, 0.02},
>  {0.01, \[SpanFromLeft]}
> }
>
>
> May someone guide me to the correct section of the help to fix this?
>
> Thanks,
>
> Ride
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Typing Formula Steps in a Grid Bob Hanlon <hanlonr357@gmail.com> - 2012-03-12 09:09 +0000

csiph-web