Re: Typing Formula Steps in a Grid
- To: mathgroup at smc.vnet.net
- Subject: [mg125401] Re: Typing Formula Steps in a Grid
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Mon, 12 Mar 2012 04:07:50 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201203110907.EAA19375@smc.vnet.net>
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 at 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
>
- References:
- Typing Formula Steps in a Grid
- From: Ride <edmund.r@gmail.com>
- Typing Formula Steps in a Grid