Thread: mathematics

  1. #1
    Unregistered
    Guest

    mathematics

    suppose i have a variable b = t*4+s

    if i happen to know b, is it possible to get t and s, using div and mod? how?

    t=?
    s=?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    solution

    b = (t * 4) + s

    t = (b - s) / 4

    s = b - (t * 4)
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Unregistered
    Guest
    I got this:

    s = b/(t*4)
    t = (b-s)/4

    substitute t in the first equation:
    s = b/((b-s)/4)*4) = b/(b-s)

    manipulate equation and get:
    s^2 - sb + b = 0

    or do it for the t equation and get:
    4t^2 - bt + 4b = 0

    now solve for s or t, then substitute it back into the equation.

    I think I did it right???
    There's probably a better way though.

  4. #4
    Registered User jasrajva's Avatar
    Join Date
    Oct 2001
    Posts
    99
    obviously
    b = t*4+s
    cannot have unique soln for any given b

    so given b you can assume values for t
    say from 1 to 100 and then find the corresponding value of s or vice versa


    ie 10 = 1*4 +6
    also = 2*4 +2
    = 3*4 +(-2)

    and so on
    jv

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Insert node in a linked list.
    By antonis in forum C Programming
    Replies: 2
    Last Post: 10-22-2005, 02:30 PM
  2. mathematics <exponential>
    By xddxogm3 in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 11-18-2004, 12:48 AM
  3. Mathematics Odd/Even Functions
    By xddxogm3 in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 10-18-2004, 05:35 PM
  4. rotation mathematics....
    By EvBladeRunnervE in forum Game Programming
    Replies: 11
    Last Post: 12-10-2003, 03:13 PM
  5. Highschool mathematics
    By Panopticon in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 06-09-2003, 12:52 AM