ArtRage 5 Product PageArtRage Lite Product PageArtRage for iPad Product PageArtRage for Android Product PageArtRage  Android Oil Painter Free Product PageArtRage  Free Demos Page

Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Math problem

  1. #1
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,839

    Question Math problem

    I'm writing a bit of ArtRage code, and I have a math problem which should be easy but I cant seem to get my head around it.

    Here is the problem:

    (A * C) + (((B * D) - (A * C)) * M) - A
    ---------------------------------------- = T
    (C + ((D - C) * M) * (B - A)


    I have the feeling I can reduce the above - the situation this problem arises implies to me that A and B cancel out of the equation, leaving T as a function of M, D and C

    Any help greatly appreciated.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  2. #2
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,839
    Hold it - that equation is wrong.
    Give me a moment... I reduced it incorrectly.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  3. #3
    Join Date
    Feb 2011
    Location
    This Island Earth
    Posts
    36
    Firstly you're asking a bunch of art-heads about math... Secondly, do you have your formula right?

    In the denominator I see "(C + ((D - C) * M) * (B - A)" the number of opening and closing parenthesis doesn't add up.

    Thanks.

    *edited because I didn't want to assume anything.
    Last edited by Sparkybrown; 06-10-2011 at 11:58 AM.

  4. #4
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,839
    Okay, checking my math time....
    (excuse the formatting - the forum was stealing my whitespace and ruining the layout)


    ((A * C) + (((B * D) - (A * C)) * M)) / ((C + ((D - C) * M) = A + (B - A) * T


    Code:
      
     
    (A * C) + (((B * D) - (A * C)) * M)         A
    -----------------------------------   -   ------    =    T
    (C + ((D - C) * M)) * (B - A)             (B - A)
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  5. #5
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,839
    I should stress, this is me *simplifying* the problem. You should see it 'in situ'.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  6. #6
    Join Date
    Feb 2011
    Location
    This Island Earth
    Posts
    36
    God I hope this makes some kind of sense... It's been so long. I'll have my wife look at it later. She's all mathly... oops... well, she just denied. I'm pretty sure this is horribly wrong, but here it is teach. I can paint you an apple with your wonderful program if you like.

    Code:
       AC + (MBD - MAC)             A
    ----------------------    -  -------   = T =>
    (C + (MD - MC)) x (B-A)      (B - A)
    
    
       AC + (MBD - MAC)                    A
    -----------------------------    -  -------   = T =>
    C(B-A) + (MD(B-A) - MC(B-A))        (B - A)
    
    
       AC + (MBD - MAC)                          A
    -----------------------------------    -  -------   = T =>
    (CB - CA) + ((MDB-MDA) - (MCB-MCA))       (B - A)
    
    
               1                     A
    -----------------------    -  -------   = T =>
    (CB) + ((-MDA) - (MCB))       (B - A)
    p.s. just have a good laugh, and maybe this horribly incorrect solution will kick start some other cogs a-turnin'.

    -Sparky.

  7. #7
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,839
    Just to inspire you some more...

    This code works and gives me the results I was expecting:


    real T = M;
    if (A != B) T = ((A * C) + (((B * D) - (A * C)) * M)) / ((C + ((D - C) * M)) * (B - A)) - (A / (B - A));

    The 'if (A != B)' is 'if A is not equal to B' is to avoid the division by zero at the end of the equation. If A does equal B then T will be M, which is correct.
    So if we can express T solely in terms of C, D and M it would make for a very tidy solution to a problem I've been working on for a while.

    T = ((A * C) + (((B * D) - (A * C)) * M)) / ((C + ((D - C) * M)) * (B - A)) - (A / (B - A));

    How hard can it be, right?
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  8. #8
    Join Date
    Apr 2007
    Location
    washington, usa
    Posts
    14,215
    in case you get stuck again

    http://www.solver.com/sdkplatform.htm

  9. #9
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,839
    I'm still stuck - I need the equation to resolve down to an expression containing only T, M, C and D
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  10. #10
    wowsers, you gave me a headache.


    Sorry I can't be of help. Math is not a subject I'm good at.

    Good luck

Posting Permissions

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