# Manipulate Iterated Logarithm

Could I create a third slider that controls two other sliders?

I would like to master slider to move slider k from min to max, at which point, the master slider should be half way across.

Slider j should then "engage", and run from min to max, by which time, the master slider should be at max.

I should also like to hide sliders k and j, so that only the master slider is visible.

Is this possible?

r = 100; Manipulate[Plot[{If[k < E, Log[Log[x]/Log[k]], 0],
If[k == E,Log[Log[Log[x]/Log[j]]], 0], Log[x], Log[Log[x]], Log[Log[Log[x]]]},
{x, 1, r}, PlotRange -> {{0, r}, {0, Log[r]}}, PlotStyle -> {{Blue}, {Blue},
{Red, Dashing[0.005], Opacity[0.3]}, {Red, Dashing[0.005], Opacity[0.3]}, {Red,
Dashing[0.005], Opacity[0.3]}}], {k, x^(1/x), E}, {j, x^(1/x), E}]


# Update

This is the closest I can get. Not perfect, but better ...

r = 100; j = x^(1/x); Manipulate[Plot[{If[k < E, Log[Log[k, x]],
Log[Log[Log[k - E + x^(1/x),x]]]], Log[x], Log[Log[x]], Log[Log[Log[x]]]}, {x, 1, r},
PlotRange -> {{0, r}, {0, Log[r]}}, PlotStyle -> {{Blue}, {Red, Dashing[0.005],
Opacity[0.3]}, {Red, Dashing[0.005], Opacity[0.3]},{Red,Dashing[0.005],
Opacity[0.3]}}], {k, x^(1/x), 2 E - 1}]


# Update 2

From Belisarius' great code below:

r1 = 1; r2 = 100; j = 3;
Manipulate[Plot[{NestList[Log, Log[x]/Log[(1 - Mod[s, 1]) x^(1/x) + Mod[s, 1] E],
Floor[s + 1]][[Floor[s + 1]]], NestList[Log, x, j]}, {x, r1, r2},
PlotRange -> {{r1, r2}, {0, Log[r2]}}, Axes -> False, Frame -> True], {s, 0, j}]


Title changed to make it more fitting to question. Apologies to Martin John Hadley and bill s for misleading original title: Create master slider in manipulate & hide others this was my first thought on how to approach this problem. Thank you for your excellent responses, though.

-

kk[s_] := (1 - Mod[s, 1]) #^(1/#) + Mod[s, 1] E &
r = 100;
Manipulate[
Plot[{If[s < 1, Log[Log@x/Log@kk[s][x]],
Log[Log[Log@x/Log@kk[s][x]]]],
Log@x, Log@Log@x, Log@Log@Log@x},
{x, 1, r},
PlotRange -> {{0, r}, {0, Log[r]}}],
{s, 0, 2}]


Edit

Perhaps simpler:

kk[s_, x_] := Log[Log@x/Log[(1 - Mod[s, 1]) x^(1/x) + Mod[s, 1] E]]
r = 100;
Manipulate[
Plot[{If[s < 1, kk[s, x], Log@kk[s, x]], Log@x, Log@Log@x, Log@Log@Log@x},
{x, 1, r}, PlotRange -> {{0, r}, {0, Log[r]}}],
{s, 0, 2}]

-
Wonderful though ... couldn't have done this in a month of Sundays :) –  martin Jun 17 at 17:43
Much clearer to add further functions to this - wish I could more than +1 :) –  martin Jun 17 at 18:04
Thant looks deceptively simple! :) –  martin Jun 17 at 18:24
... Though much clearer to interpret mathematically since one function fits all :) –  martin Jun 17 at 18:26

It sounds like you don't really want to have a slider for k and j at all, since you want to hide them. Accordingly, you can get the desired effect by creating variables j and k that take their values from the master slider:

mink = -10; maxk = 10; minj = 2; maxj = 12;
Manipulate[
If[x < maxk, k = x; j = 0;, j = x - maxk; k = 0;]; {k, j}, {x, mink, maxk + maxj}]


I've arbitrarily chosen max and min values for the sliders and also arbitrarily set j to 0 when k is active and vice versa. Clearly you could change these to whatever you wish.

-
Min of both j & k are dynamic - they change with x - see code above. –  martin Jun 17 at 15:11
@martin - one problem with your code is that x is localized within Plot, i.e. it would never reach the sliders. –  eldo Jun 17 at 15:20
It works for me ... –  martin Jun 17 at 15:22
@martin - yes, but the the markers on the sliders don't move, so I never know where I am. –  eldo Jun 17 at 15:46
No - obviously working outside Mathematica's comfort zone ;) –  martin Jun 17 at 15:48

I'm late to this game, but I want to suggest that you investigate DynamicModule for cases where you're interested in more control over the updating of dynamic content.

I built the following GUI that looks similar to what you described, notice that the k and j controller are greyed out as the master slider is less than 1/2 of it's maximum value:

The code is as follows:

DynamicModule[{master, k = 50, j = 50, range = {1, 100}},
Grid[{
{"Master", Slider[Dynamic[master], range],Dynamic[master]},
Grid[{
{"K Slider",Dynamic[If[master > range[[2]]/2, Slider[Dynamic[k],{1, 100}],Slider[k,{1,100}, Enabled -> False]]]},
{"J Slider",Dynamic[If[master > range[[2]]/2, Slider[Dynamic[j],{1, 100}],Slider[j, {1, 100}, Enabled -> False]]]}}]}],
Alignment -> Left], SpanFromLeft}
}]]


Update

Here's the update where the master slider is updated by j and k. Note that dragging the master slider is meaningless.

DynamicModule[{k, j},
Column[{
{"Master", Dynamic@Slider[k + j, {0, 100}]},
{"K", Slider[Dynamic[k], {0, 50}]},
{"J", Dynamic@If[k < 25, Slider[0, {0, 50}], Slider[Dynamic@j, {0, 50}]]}}]


It would be possible to modify this so that the master slider could be updated directly, I think Halirutan has done some excellent work here that might be useful: http://mathematica.stackexchange.com/a/10976/1952.

-
Hmm. I think I may have misunderstood your question. I've added an update, but it may simply be irrelevant to your problem. –  Martin John Hadley Jun 17 at 21:25
This is great - could the master slider be attached so there is 2-way control? –  martin Jun 17 at 21:28
r = 100;
Manipulate[

Column[{

Row[{"k", Spacer@5, Dynamic@Slider[Dynamic@k, {1.0001, E}]}],

Row[{"j", Spacer@5, Dynamic@Slider[Dynamic@j, {1.0001, E}]}],

Dynamic@
Plot[{If[k < E, Log[Log[x]/Log[k]], 0],
If[k == E, Log[Log[Log[x]/Log[j]]], 0], Log[x], Log[Log[x]],
Log[Log[Log[x]]]}, {x, 1, r},
PlotRange -> {{0, r}, {0, Log[r]}},
PlotStyle -> {{Blue}, {Blue}, {Red, Dashing[0.005],
Opacity[0.3]}, {Red, Dashing[0.005], Opacity[0.3]}, {Red,
Dashing[0.005], Opacity[0.3]}}, ImageSize -> 600]

}],

Deployed -> True,
TrackedSymbols :> {k, j}
]

-
Can't get this to work for me I'm afraid –  martin Jun 17 at 15:18
@martin - it works quite nicely with me (MM 9.01). The blue line goes through the dashed red lines. The last red line is touched when the k- and j-sliders are both in their rightmost position. –  eldo Jun 17 at 15:26
Min k & j should be x^(1/x), not 1+ε. –  martin Jun 17 at 15:47