0
$\begingroup$

Please take this code (for 2 sliders) as is and try to minimize alterations to the original structure. The goal is to have:

  • the first Slider reset the second Slider to 1 and also

  • to have the maximum value of the second Slider reset based on c (a physical requirement in the real world).

You'll note that I'm as novice as one can be. I use mathematica 8. The cdf doesn't work in the cloud because the minimum value of the slider is set to 0. The nb and the cdf work in my computer. It doesn't matter what I do, the cdf (in my computer) seems unable to assign an initial value to c which I thought would solve the problem to deploy it in the cloud. Assume that there are extremely good reasons to want to do this.

The last thing that I did is:

  • to add the exclusions which in an example in Slider in the documentation does exactly what I need but it doesn't do anything within this code in my computer.

I have stumbled around to get to the form that it has now because trying to get everything to work in 3 platforms (nb, cdf and cloud) seems to require you to debug 3 times. i.e. What works in nb does not necessarily work for the rest of them. I'm disappointed that Wolfram throws this burden on us users.

{ { 
    Slider[Dynamic[c, (asra = 1; c = #) &], {0, .000037, (0.5*10^(-7))}
    , Exclusions -> {0, 0.5*10^(-7)}
    ]
  , Dynamic[2*c]
  , Dynamic[If[asra > 1, "Thickness (m)", "Diameter (m)"]]
  }
, {
    Dynamic[
      asrama = If[ c < (.000037*1.003)/2, 50 , Round[(aspec = Solve[ 
            (4/3 Pi*a^2*c)/(2 Pi*a^2 (1 + (c/a)^(3/2)))*16181.5 == 200*.001003
          , a]; a /. aspec[[1]])/c
      , 0.05] 
      ]
    ; Dynamic[funcion[asrama], Initialization -> (
        funcion[ asrama_] := {Slider[Dynamic[asra], {1, asrama, 0.05}]}
      )]
    ]
  , Dynamic[asra], "Aspect Ratio", Dynamic[asra*c*2]
  , Dynamic[If[asra > 1, "Length (m)", "Diameter (m)"]]
  }
}
$\endgroup$
  • $\begingroup$ Can you elaborate what exactly does not work? I deployed it to .cdf and to cloud and both work. Cloud cdf is slower but that is expected. Otherwise it seems to match your expectations, everytime you use the first slider it resets arsa to 1 and the upper limit of the second slider is affected too. I am on 11.3, otoh I am not sure if that matters here. $\endgroup$ – Kuba Sep 4 '18 at 6:12
  • $\begingroup$ Thank you for this. I see that at times the 2 last sliders also display and "work". If it "works", it is still a problem because the initial value of the diameter is 0 which should never be in this case neither the slider needs to have its minimum value set to 0. As this occurs within another context, such failure makes the entire thing fail. If one can make the slider having an initial value of diameter that is not 0 and a minimum value of the slider set to what is shown in the code, that would solve my problem. $\endgroup$ – Mendieta Sep 5 '18 at 16:48

Your Answer

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

Browse other questions tagged or ask your own question.