I want to make a table of various values of the logistic curve given by l[x_] := 1/(1 + E^((-k)*(x - \[Alpha])))
.
In basic form, this is dead easy. However, I want to make some tweaks, and I can't persuade them to work.
(Apologies for images of table outputs - I don't know how to add the actual tables.)
1: Note that despite being wrapped in N[...,4]
, the table evaluates to more than 4 decimal places for several values:
N[With[{k = 1}, TableForm[Table[1/(1 + E^((-k)*(x - \[Alpha]))),
{x, 1, 20}, {\[Alpha], 5, 15, 5}], TableHeadings ->
{{"x=1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11",
"12", "13", "14", "15", "16", "17", "18", "19", "20"},
{"\[Alpha]=5", "10", "15"}}]], 4]
2: I want to use l[x]
instead of the full expression. But this leads Mathematica to mostly ignore the stipulated value for k
:
l[x_] := 1/(1 + E^((-k)*(x - \[Alpha])));
N[With[{k = 1}, TableForm[Table[l[x], {x, 1, 20},
{\[Alpha], 5, 15, 5}], TableHeadings ->
{{"x=1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11",
"12", "13", "14", "15", "16", "17", "18", "19", "20"},
{"\[Alpha]=5", "10", "15"}}]], 4]
3: I want the table to display \[Tilde]0
or \[Tilde]1
for values less than 0.0001
or greater than 0.9999
- but to retain the actual numerical value so I can perform further calulations on the table. I can change the values into text (though again this only works with the expression, not with l[x]
), but of course, that means I can't then perform further caluations on them:
N[With[{k = 1}, TableForm[Table[If[1/(1 + E^((-k)*(x - \[Alpha]))) <
0.0001, Text["\[Tilde]0"],
If[1/(1 + E^((-k)*(x - \[Alpha]))) >
0.9999, Text["\[Tilde]1"],
1/(1 + E^((-k)*(x - \[Alpha])))]],
{x, 1, 20}, {\[Alpha], 5, 15, 5}], TableHeadings ->
{{"x=1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11",
"12", "13", "14", "15", "16", "17", "18", "19", "20"},
{"\[Alpha]=5", "10", "15"}}]], 4]
4: I would like to put all output values of 0.5
in bold. But Mathematica seems to ignore the /.
command:
N[With[{k = 1}, TableForm[Table[If[1/(1 + E^((-k)*(x - \[Alpha]))) <
0.0001, Text["\[Tilde]0"],
If[1/(1 + E^((-k)*(x - \[Alpha]))) >
0.9999, Text["\[Tilde]1"],
1/(1 + E^((-k)*(x - \[Alpha])))]],
{x, 1, 20}, {\[Alpha], 5, 15, 5}], TableHeadings ->
{{"x=1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15", "16", "17", "18", "19",
"20"}, {"\[Alpha]=5", "10", "15"}}]], 4] /. 0.5 -> Style[0.5, Bold]
I'd very much appreciate suggestions to fix all four of these issues.