4
$\begingroup$

Creating some extra notes for students in a trig class. A bare bones table can be created in Mathematica using the line below.

Grid[{
  {"",  "Quadrant", SpanFromLeft}, {"Ratio", "I", "II", "III", 
   "IV"}, {"sin \[Theta]", "+", "+", "-", "-"},
  {"cos \[Theta]", "+", "+", "-", "-"},
  {"tan \[Theta]", "+", "+", "-", "-"}}, Frame -> All, 
 ItemSize -> {3, 2}]

The textbook has the following table.

enter image description here

I absolutely don't need the table I am creating to look exactly like that, but trying to use Mathematica, wondering what kinds of things I can do to "improve" the look of the bare bones table creating using the Grid command.

Any comments or help is appreciated.

$\endgroup$
2
  • $\begingroup$ It looks a lot nicer with this change... a start... Grid[{ {"", "Quadrant", SpanFromLeft}, {"Ratio", "I", "II", "III", "IV"}, {Style["sin \[Theta]", "DisplayFormula"], "+", "+", "-", "-"}, {Style["cos \[Theta]", "DisplayFormula"], "+", "+", "-", "-"}, {Style["tan \[Theta]", "DisplayFormula"], "+", "+", "-", "-"}}, Frame -> All, ItemSize -> {3, 2}] $\endgroup$ Feb 9 at 14:26
  • 3
    $\begingroup$ I'll let someone else improve this: Text[Grid[{{"", Style["Quadrant", Bold], SpanFromLeft}, Style[#, Bold] & /@ {"Ratio", "I", "II", "III", "IV"}, {ToString[Sin[θ], TraditionalForm], "+", "+", "-", "-"}, {ToString[Cos[θ], TraditionalForm], "+", "+", "-", "-"}, {ToString[Tan[θ], TraditionalForm], "+", "+", "-", "-"}}, Background -> {None, {RGBColor["#C0D8F1"], RGBColor["#C0D8F1"]}}, Frame -> All, FrameStyle -> GrayLevel[0.5, 0.7], ItemSize -> {3, 2}]] $\endgroup$
    – J. M.'s torpor
    Feb 9 at 14:33
8
$\begingroup$

The items in the original table look a lot like buttons. Lets try that approach:

{{"", "Quadrant", SpanFromLeft},
 {"Ratio", "I", "II", "III", "IV"},
 {Sin[\[Theta]], "+", "+", "-", "-"},
 {Cos[\[Theta]], "+", "+", "-", "-"},
 {Tan[\[Theta]], "+", "+", "-", "-"}} //
    MapAt[OperatorApplied[Button][Background -> RGBColor["#C0D8F1"]], {1,1 ;; 2}] //
    MapAt[OperatorApplied[Button][Background -> RGBColor["#C0D8F1"]], {2, All}] //
    MapAt[OperatorApplied[Button][Background -> White], {3;;-1, All}] //
    OperatorApplied[Grid][
       {ItemStyle -> {Automatic, {Bold, Bold}},
        ItemSize -> {5, Automatic}, Spacings -> {0, 0}}] //
    TraditionalForm 

buttons-table

$\endgroup$
3
$\begingroup$

With Tooltips

Clear["Global`*"]

func = {Sin, Cos, Tan};

quad = Range[Pi/4, 2 Pi, Pi/2];

signs =
  Outer[
   Tooltip[
     Sign[#1[#2]] /. {1 -> "+", -1 -> "-"},
     Show[
      Plot[#1[theta], {theta, 0, 2 Pi},
       PlotStyle -> AbsoluteThickness[0.5]],
      Plot[#1[theta], {theta, #2 - Pi/4, #2 + Pi/4},
       PlotStyle -> {Thick, Red}]]] &,
   func, quad];

table = Map[Button, Flatten /@ Transpose[
     {Decapitalize[ToString[#]] <> " θ" & /@ func, 
      signs}], {2}];

header =
  {{Button["", Background -> LightBlue,
      Appearance -> "DialogBox"],
     Button["Quadrant", Background -> LightBlue,
      Appearance -> "DialogBox"], SpanFromLeft},
    Button[#, Background -> LightBlue,
       Appearance -> "DialogBox"] & /@
     ({"Ratio", 
        RomanNumeral /@ Range[4]} // Flatten)} /.
   str_String :> Style[str, Bold];

Flatten[{header, table}, 1] //
 Grid[#,
   Spacings -> {0.15, 0.15},
   Background -> Darker[LightBlue, 0.075]] &

enter image description here

$\endgroup$
1
  • $\begingroup$ Super helpful, will for sure use this in the next course where they actually study graphing of trig functions. $\endgroup$ Feb 9 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.