SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Algebra question

    It's been years since I've done any kind of algebra, and I have an equation that I need to do to calculate space useage on *nix boxes and can't for the life of me remember how to solve for "X".
    Code:
    ((X - Free space) / X) * 100 = Used %
    I have Free space, and I have the % used, but I can't remember how to solve an equation for X.
    Any links etc on this?

    Thanks.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    (X - Free Space) / X = Used% / 100
    X - Free Space = X (Used% / 100)
    100X - (100 * Free Space) = X * Used%
    100X - (X * Used%) = 100 * Free Space
    X( 100 - Used% ) = 100 * Free Space
    X = (100 * Free Space) / (100 - Used%)
    I think...but wow, it's been a long time.

    And I'm sure there's an easier way to do it, but I think that works

  3. #3
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After I looked at it for a while, I came up with
    Code:
    Free space / (Used % / 100) = X
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  4. #4
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Knew I was doing it the complicated way

  5. #5
    SitePoint Addict Miraculix's Avatar
    Join Date
    Sep 2004
    Location
    NYC
    Posts
    386
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Viflux is right:

    x = ( 100 - Free Space ) / ( 100 - used% )

  6. #6
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Miraculix
    Viflux is right:

    x = ( 100 - Free Space ) / ( 100 - used% )
    Viflux had: x = ( 100 * Free Space ) / ( 100 - used% )
    Quote Originally Posted by Viflux
    Code:
    (X - Free Space) / X = Used% / 100
    X - Free Space = X (Used% / 100)
    100X - (100 * Free Space) = X * Used%
    100X - (X * Used%) = 100 * Free Space
    X( 100 - Used% ) = 100 * Free Space
    X = (100 * Free Space) / (100 - Used%)
    I think...but wow, it's been a long time.

    And I'm sure there's an easier way to do it, but I think that works
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  7. #7
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I had it...

    Try putting in some dummy figures and see!

  8. #8
    SitePoint Addict Miraculix's Avatar
    Join Date
    Sep 2004
    Location
    NYC
    Posts
    386
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry, Type-O on my end, I meant 100 * freespace not minus ... his solution is right.

  9. #9
    SitePoint Wizard Chris82's Avatar
    Join Date
    Mar 2002
    Location
    Osnabrück
    Posts
    1,003
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    At least some people believe in posting code, eh?

    Defender1, Free space / (Used % / 100) = X is wrong. Viflux' solution is correct. It can be simplified a bit though to:

    Code:
    x = FreeSpace / (1 - Used)
    It's not used % anymore, since dividing a percentage by hundred cancels the %-sign. Given the two inputs, you can compute the simply with

    Code:
    x = FreeSpace / (1 - UsedSpace% / 100)
    which is equal to

    Code:
    x = FreeSpace / (1 - Used)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •