Mathematica Asked on May 26, 2021
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.
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.
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
Answered by Gustavo Delfino on May 26, 2021
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]] &
Answered by Bob Hanlon on May 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP