Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. Is it possible to get a formula [modified]

Is it possible to get a formula [modified]

Scheduled Pinned Locked Moved Algorithms
csharpasp-netcomdesignquestion
7 Posts 4 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rama Krishna Vavilala
    wrote on last edited by
    #1

    Here are the x and y values: y = 25, x = 0 y = 100, x = 50 y = 400, x = 100 What I want is a direct formula that gives continuous values x = f(y) that satisfies the condition. I tried everything including logarithms but could not get a formula yet. Here is what I am trying to achieve: If you look at the slider control in Microsoft Office 2007 the slider ranges from 25% to 400% with 100% being in the middle. You can smoothly zoom the UI by moving the slider.

    Co-Author ASP.NET AJAX in Action

    C L S 3 Replies Last reply
    0
    • R Rama Krishna Vavilala

      Here are the x and y values: y = 25, x = 0 y = 100, x = 50 y = 400, x = 100 What I want is a direct formula that gives continuous values x = f(y) that satisfies the condition. I tried everything including logarithms but could not get a formula yet. Here is what I am trying to achieve: If you look at the slider control in Microsoft Office 2007 the slider ranges from 25% to 400% with 100% being in the middle. You can smoothly zoom the UI by moving the slider.

      Co-Author ASP.NET AJAX in Action

      C Offline
      C Offline
      cp9876
      wrote on last edited by
      #2

      There are an infinite number of answers to your question, here is one: x=50(y-25)(y-400)/(-75*300)+100(y-25)(y-100)/(375*300)


      Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

      R 1 Reply Last reply
      0
      • C cp9876

        There are an infinite number of answers to your question, here is one: x=50(y-25)(y-400)/(-75*300)+100(y-25)(y-100)/(375*300)


        Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

        R Offline
        R Offline
        Rama Krishna Vavilala
        wrote on last edited by
        #3

        Yes, I realize that so I added more information to my original post. It has been a while soince I did maths so I have forgot all the terminology and I am not able to express my problem properly. :(

        Co-Author ASP.NET AJAX in Action

        C 1 Reply Last reply
        0
        • R Rama Krishna Vavilala

          Here are the x and y values: y = 25, x = 0 y = 100, x = 50 y = 400, x = 100 What I want is a direct formula that gives continuous values x = f(y) that satisfies the condition. I tried everything including logarithms but could not get a formula yet. Here is what I am trying to achieve: If you look at the slider control in Microsoft Office 2007 the slider ranges from 25% to 400% with 100% being in the middle. You can smoothly zoom the UI by moving the slider.

          Co-Author ASP.NET AJAX in Action

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Hi, one exponential relation that satisfies your numbers is: y = 25 * 2 ^ (x/25) so the inverse formula would be: x=25*log(y/25)/log(2) BTW: it does not matter what the base of the log function is (2, e, 10, whatever). :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google


          R 1 Reply Last reply
          0
          • R Rama Krishna Vavilala

            Yes, I realize that so I added more information to my original post. It has been a while soince I did maths so I have forgot all the terminology and I am not able to express my problem properly. :(

            Co-Author ASP.NET AJAX in Action

            C Offline
            C Offline
            cp9876
            wrote on last edited by
            #5

            From reading your modified posting, it appears that what you want to preserve is equal ratios for equal distance from the centre (the limits are 1/4 x and 4x relative to the centre), so probably 1/2 x and 2x (i.e. 50 and 200) should also be equal distances from the centre. In this case exponentials are your friend and you should use Luc's solution.


            Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

            1 Reply Last reply
            0
            • L Luc Pattyn

              Hi, one exponential relation that satisfies your numbers is: y = 25 * 2 ^ (x/25) so the inverse formula would be: x=25*log(y/25)/log(2) BTW: it does not matter what the base of the log function is (2, e, 10, whatever). :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google


              R Offline
              R Offline
              Rama Krishna Vavilala
              wrote on last edited by
              #6

              Awesome, that does the job. Thank you!:)

              Co-Author ASP.NET AJAX in Action

              1 Reply Last reply
              0
              • R Rama Krishna Vavilala

                Here are the x and y values: y = 25, x = 0 y = 100, x = 50 y = 400, x = 100 What I want is a direct formula that gives continuous values x = f(y) that satisfies the condition. I tried everything including logarithms but could not get a formula yet. Here is what I am trying to achieve: If you look at the slider control in Microsoft Office 2007 the slider ranges from 25% to 400% with 100% being in the middle. You can smoothly zoom the UI by moving the slider.

                Co-Author ASP.NET AJAX in Action

                S Offline
                S Offline
                schoetbi
                wrote on last edited by
                #7

                Hi, for this solultion you could check the very good book numerical recipies in c. You can use the fitting algorithm decribed inside. http://www.nr.com/ Also you can check Math.Net (for .Net)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups