Precise Setting of a Delicate Parameter with “pibar”

(A slight revision of the post I made a few hours ago.)

We are still working on the Kuramoto model of self-synchronizing oscillators that I made blog posts about last fall, My colleagues and I expect to eventually write a serious paper. In the meantime, let me tell you about an unusual user interface control that I am using in our Kuramoto experiments.

Contents

pibar

For reasons that I need not get into right now, I want to make very small changes in the usually constant value of pi. This special slider does the job. It varies pi between 3.1 and 3.2 in discrete steps, each step deleting or inserting one digit in the decimal expansion of pi.

The slider starts in the center and pi returns its traditional value. With the default settings, if you move the slider to the left from the center, you get

  |pi| = 3.1415926535
  |pi| = 3.141592653
  |pi| = 3.14159265
    . . . .
  |pi| = 3.141
  |pi| = 3.14
  |pi| = 3.1

It's easy to see what's happening in this direction because each step just chops off one digit.

Starting in the center and moving right is a little trickier because step rounds up. The first three and last three steps are

  |pi| = 3.1415926536
  |pi| = 3.141592654
  |pi| = 3.14159266
    . . . .
  |pi| = 3.142
  |pi| = 3.15
  |pi| = 3.2

pi and truepi

The pibar suite consists of three functions.

  • pibar sets up the tool. You can center on any value you choose; it doesn't have to be pi. Another parameter sets the number of digits.
  • pi returns the current value provided by the slider.
  • truepi always returns 4*atan(1), which is the double precision floating point number nearest to π. This is the value we get for pi when pibar is not messing with it.

Code

The pibar suite is available here. It is also included in version 5.3 of Cleve_Lab, replacing last month's April 1 contribution.

Please let me know if you find anything useful to do with this.




Published with MATLAB® R2019b

|
  • print

댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.

Loading...
Go to top of page