Thread: Modulous problem (maths, not programming)

  1. #1
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986

    Modulous problem (maths, not programming)

    I have a little problem with a little maths question thats bugging me. We have a test on monday for this stuff so I don't have chance to ask my teacher before the test.

    Four computer terminals (A,B,C,D) are located along a wall. A server is located at some point x along the wall and seperate cables go to each computer.

    Heres a diagram:
    Code:
       A           B                         C           D
    -------------------------------------------------------- wall...
      -6          -2         0               3           5
    (a) Explain why the total length of cable needed is
    |x+6| + |x+2| + |x-3| + |x-5|.
    (b) Where should the server S be located to minimize the total length of the cable.

    I know for (b) I can just draw it on a calculator and find the minimum, but I don't get how in (a) its |x-3| and |x-5|, I would have expected it to be |x+3| because its the length...

    Any explanations would be really appreciated.
    Last edited by nickname_changed; 02-20-2004 at 06:25 PM.

  2. #2
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    Formula: distance = x1 - x2
    x1 = server location
    x2 = terminal location
    Thus,
    total length of cable is
    = |x-(-6)| + |x-(-2)| + |x-3| + |x-5|
    = |x+6| + |x+2| + |x-3| + |x-5|.
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  3. #3
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Ohhh of course Haha what a silly question.

  4. #4
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    I was expecting a question about modular arithmetic. I'm dissapointed.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  5. #5
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Is that like:
    Solve for X
    |X - 3X^2 -2X| = |5X+7|
    ?

  6. #6
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    No, modular math is more like
    3x = 2 (mod 4)

    The answer there is x=2.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  5. Maths problem
    By Zewu in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 11-13-2002, 02:34 PM