If have a function t[x_]
which is used extensively in a long notebook, but which has a variety of definitions, and which is used in a variety of ways. I'm looking for a way to assign my chosen definition across the entire notebook, from a drop-down menu in the first cell.
For example, say I wish to assign t[x_]
one of the following definitions:
t[x_]:=ArcTan[x]
t[x_]:=Tanh[x]^k
t[x_]:=Erf[x]/Pi
And say that somewhere further down the notebook, there is a cell that reads:
func[n]=Sum[t[n - c^b], {b, 1, c}]
I want it (indeed, all cells with the function t
in them) to change depending on my choice in the notebook's first cell, so that func[n]=Sum[t[n - c^b], {b, 1, c}]
then reads one of
func[n]=Sum[ArcTan[n - c^b], {b, 1, c}]
func[n]=Sum[Tanh[n - c^b]^k, {b, 1, c}]
func[n]=Sum[Erf[n - c^b]/Pi, {b, 1, c}]
Note that there are several pages of such cells. I don't want the cells to be evaluated, because a lot of them are just notes of algebraic workings. I just want the cells as written to change in response to the choice I made at the top - and I want it to include changes of variable such as x -> (n - c^b)
.
Is this possible? How would I do it?
UPDATE:
There are of course lots of cells that contain evaluatable instructions - Table
, Plot
, etc. I don't want these to evaluate immediately as it could take forever. Presumably, if the content of the cell to be evaluated changes, then the 'result' cell will become greyed out. That's fine because it will indicate to me that the cell awaits evaluation.