How can I vary physical constants in Mathematica plots?

  • Context: Mathematica 
  • Thread starter Thread starter madness
  • Start date Start date
  • Tags Tags
    Constants Mathematica
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 5K views
madness
Messages
813
Reaction score
69
I have a function which depends on several physical constants, which I want to be able to vary each time I make a plot. What is the best way to do this?
 
Physics news on Phys.org
Well, simply define their numerical values, plot the function, and repeat again. If this is what you're trying to do.
 
Is this really the best way? I have at least 8 constants here. I've seen the command
Plot[f[x] /.{a->1,b->2},{x,0,1}], but this is still annoying for 8 constants. Or defining constants as lists const={a->1,b->2}; but I can't work out how to call them when I plot the function.
 
Can slider bars help?

Code:
DynamicModule[{x = Random[]}, 
 Column[Table[
   Slider[Dynamic[x], ImageSize -> RandomReal[200]], {10}]]]