Re: Is it Possible to Create a Logarithmic Slider Control?
- To: mathgroup at smc.vnet.net
- Subject: [mg117367] Re: Is it Possible to Create a Logarithmic Slider Control?
- From: Morgan Sutherland <skiptracer at gmail.com>
- Date: Wed, 16 Mar 2011 06:28:10 -0500 (EST)
Thanks David, I ended up going with your suggestion. Echo'd @ Stack Overflow: http://stackoverflow.com/questions/5307244/logarithmic-slider-control-in-mathematica Manipulate[ > Evaluate[Round[10^Z2]/(Round[10^Z1] + Round[10^Z2])*Vin] "V", > {{Z1, 5}, 2, 6}, > Pane["Z1 = " Dynamic[Round[10^Z1] "[CapitalOmega]"], > ImageMargins -> {{2.5, 0}, {3, 0}}], > {{Z2, 5}, 2, 6}, > Pane["Z2 = " Dynamic[Round[10^Z2] "[CapitalOmega]"], > ImageMargins -> {{2.5, 0}, {0, -5}}], {{Vin, 2.5}, 0, VMax}, > Pane["Vin = " Dynamic[Vin "V"], ImageMargins -> {{0, 0}, {0, -5}}]] > > Morgan On Tue, Mar 15, 2011 at 7:38 AM, David Annetts <david.annetts at iinet.net.au>wrote: > Hi Morgan, > > What about using > > {{r, 2, "Log10(r)"}, 2, 5, .1} > > and replacing r by 10^r in your expression? > > D. > > > On 15/03/2011 19:06, Morgan Sutherland wrote: > >> Greetings List, >> >> *Question also posted here: * >> >> http://stackoverflow.com/questions/5307244/logarithmic-slider-control-in-mathematica >> >> I'm making a small interface for calculating voltage dividers in >> Mathematica. I have two sliders (z1& z2) that represent the resistor >> values >> and a couple of sliders to represent Vin as a sinusoid. >> >> The issue is that the range of available resistor values (in the real >> world) >> is roughly logarithmic on {r, 100, 1,000,000}. If I set my slider range to >> r, >> however, it's impractical to select common low resistor values in approx. >> {100, >> 10,000}. >> >> Is it possible to create a slider that sweeps through a logarithmic range? >> >> Thanks! >> >> Manipulate[ >> Grid[{{Plot[(VinR*Cos[t] + VinC), {t, -3, 9}, >> PlotRange -> {-1, VMax}, AxesLabel -> {t, Vin}]}, {Plot[ >> z2/(z1 + z2)*(VinR*Cos[t] + VinC), {t, -3, 9}, >> PlotRange -> {-1, VMax}, AxesLabel -> {t, Vout}]}}, >> ItemSize -> 20], >> {{z1, 10000}, 10, 1000000, 10}, {z1}, {{z2, 10000}, 10, >> 1000000}, {z2}, Delimiter, {{VinR, 2.5}, 0, >> 5}, {VinR}, {{VinC, 2}, -VMax, VMax}, {VinC}] >> >>