+ Reply to Thread
Results 1 to 33 of 33

Solve mathematical problem

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Solve mathematical problem

    Hello everybody

    I have five values (x - y - z - t -u )

    z + u =14
    t = y + 1
    x = 2y-1
    y + z = 10
    x + y + z + t +u =30

    How to find these values using Excel?

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,827

    Re: Solve mathematical problem

    As with a lot of problems, I think it is easiest to first understand how to solve the problem mathematically, then it is much easier to solve in Excel (or whatever programming language you choose to use). With that goal in mind, I would first suggest you review this review of methods for solving systems of linear equations: http://www.purplemath.com/modules/systlin1.htm

    I tend to use either substitution or Gaussian elimination. I don't know how rusty your algebra is. If it is quite rust, I would probably suggest you refamiliarize yourself with how to use substitution to solve a system of equations. If you remember Gaussian elimination (in particular, how to express this kind of problem in terms of matrix algebra), then I would suggest using Excel's built in matrix manipulation functions (MMULT, MINVERSE, etc.) to find the solution to your system of equations.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Solve mathematical problem

    maybe just fill out the formula in cells in a spreadsheet and use solver/goal seek.

    this was pretty quick for me on this problem.
    I just typed out 5 cells put the formulae in whatever cells I could and ran the solver.
    Last edited by scottiex; 12-21-2014 at 03:28 PM.

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Thanks for reply sir.. can you explain in steps how to use solver to solve that problem?

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Solve mathematical problem

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    1
    0
    0
    1
    0
    1
    x
    14
    x
    7
    L1:L5:{=MMULT(MINVERSE(A1:E5), I1:I5)}
    2
    0
    -1
    0
    1
    0
    y
    1
    y
    4
    3
    1
    -2
    0
    0
    0
    *
    z
    =
    -1
    z
    =
    6
    4
    0
    1
    1
    0
    0
    t
    10
    t
    5
    5
    1
    1
    1
    1
    1
    u
    30
    u
    8
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Solve mathematical problem

    I converted all your formula into a set of cells linking to each other. to make it easy they are nominally formula for x y z and u and one cell for t (which could easily have been u or any other letter i guess) which I give the value of 1.
    and the last formula is my total formula I plan to use for the goal seek so i write that formula down as = sum of the cells with the other formula.

    now go to data in the ribbon
    select what if analysis and goalseek or select solver both are reasonably self explanatory but goalseek is faster to explain it has
    "set cell" "to" "by changing"

    set cell "the one with the total", to "30" by changing "the cell that you left with no formula".

    Sorry about my poor explanation but give it a go - it is easier than I make it sound
    Last edited by scottiex; 12-21-2014 at 04:32 PM.

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Mr. shg

    Can you simply explain what are zeros and ones??I really don't know what they are..

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Solve mathematical problem

    Coefficients:

    0*x + 0*y + 1*z + 0*t + 1*u = 14
    0*x + -1*y + 0*z + 1*t + 0*u = 1
    1*x + -2*y + 0*z + 0*t + 0*u = -1
    0*x + 1*y + 1*z + 0*t + 0*u = 10
    1*x + 1*y + 1*z + 1*t + 1*u = 30

  9. #9
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Thank you very much Mr.Shg
    You are very helful..I got it now
    Thanks a lot ..
    Is there a way to solve it by code using arrays (this is for Mr. karedog .. he's professional at that)?

  10. #10
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Solve mathematical problem

    Quote Originally Posted by YasserKhalil View Post
    I have five values [....]
    z + u =14
    t = y + 1
    x = 2y-1
    y + z = 10
    x + y + z + t +u =30
    How to find these values using Excel?
    Or you could do it the easy way. ;-)

    Most of the formulas translate directly into Excel, some requiring minor algebraic manipulation, to wit:

    U1: =14-Z1
    T1: =Y1+1
    X1: =2*Y1-1
    Z1: =10-Y1
    Y1: =(30-14)/4
    A1: =X1+Y1+Z1+T1+U1

    The formula in Y1 is derived by simple substitution and minor algebraic manipulation, namely:

    x + y + z + t + u = 30
    (2y-1) + y + (10-y) + (y+1) + (14-(10-y)) = 30
    4y + 14 = 30
    y = (30 - 14)/4
    Last edited by joeu2004; 12-21-2014 at 06:43 PM.

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Solve mathematical problem

    this is for Mr. karedog .. he's professional at that
    ??????????????????
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  12. #12
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Mr. martindwilson
    Is that wrong behavior to mention somebody in my posts? What ????

  13. #13
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Solve mathematical problem

    well is suppose mr karedog will just happen to stumble across this thread and come back with an good idea,
    but i suspect he /she does not search the board for a mention of his/her name

  14. #14
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Solve mathematical problem

    Not sure why you need any more solutions. I might be able to solve a couple of these in the time it takes to post this post

  15. #15
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Mr. scottiex
    I'm seeking to learn more and more .. and multi solutions help me improve my skills quickly ..!
    Regards

  16. #16
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Solve mathematical problem

    Hi Yasser,

    This is very easy to achieve using Excel, since Excel already has all the needed functions to do this (MINVERSE(), MMULT(), as pointed by MrShorty in #2).

    To learn the manual way to do this, please look at this website :
    http://www.mathsisfun.com/algebra/sy...-matrices.html

    First, we need to convert the formulas into a form that all variables are located left of the equal sign, and the constant is located right of the equal sign.

    So your equations :

    z + u =14
    t = y + 1
    x = 2y-1
    y + z = 10
    x + y + z + t + u =30

    need change to this form :

    z + u = 14
    t - y = 1
    x -2y = -1
    y + z = 10
    x + y + z + t + u = 30

    Then input this values to Excel like the screenshot below :
    EquationSolver.png

    This is the code :
    Please Login or Register  to view this content.
    Run this macro, enter A2:F6 as the range, and the result will be shown.

    Regards
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  17. #17
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Thank you very much for all your fantastic solutions Mr. karedog

  18. #18
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Solve mathematical problem

    You are welcome, glad I can help.

    Regards

  19. #19
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Solve mathematical problem

    After, shamelessly copying from Karedog, I've come up with this code for shg's setup:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  20. #20
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Thanks Mr. xladept

    I have a question ..Is it possible to get the results in range("A2:F6") by code based on input in post #1?

  21. #21
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Solve mathematical problem

    Hi Yasser,

    No, I don't believe that you could go from the original post to the final result without first doing the preparation described in karedog's first post. - Sorry

  22. #22
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Solve mathematical problem

    Hi Yasser,

    I wrote a routine for your problem - just paste the equations from A10

    Please Login or Register  to view this content.
    *How do you want to handle the situations with no solution??
    Last edited by xladept; 12-23-2014 at 08:30 PM.

  23. #23
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Thank you very much Mr. xladept.
    Can you knidly attach a file of your code?
    Thanks advanced

  24. #24
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Solve mathematical problem

    Hi Yasser,

    I've thought of a few improvements overnight - will attach when completed - but, as is, the constant term must be the last term on the right side of the equation.

    That's what I'm trying to fix now. Even if successful the equations must have just one term for each variable and one term for the constant. And, it's possible to write equations that have no solution - right now, if there is no solution, the program just stops.

  25. #25
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Solve mathematical problem

    Hi Yasser,

    Here's the code:

    Please Login or Register  to view this content.
    And, here's the file:
    Attached Files Attached Files

  26. #26
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Mr. xladept
    I can't believe myself it's possible
    You are a mazing .. that code is a masterpiece
    Thanks a lot for your help

  27. #27
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Solve mathematical problem

    You're welcome and thanks for the rep!

  28. #28
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Solve mathematical problem

    With this one you can just paste the equations from A1:

    Please Login or Register  to view this content.

  29. #29
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Mr. xladept
    I really can not believe my eyes
    You are genius ..
    Thanks a lot for this wonderful gift

  30. #30
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Solve mathematical problem

    You're welcome and thanks for the compliment

    *Change the third line to:

    Please Login or Register  to view this content.
    Last edited by xladept; 12-25-2014 at 03:35 PM.

  31. #31
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Solve mathematical problem

    A correction:

    Please Login or Register  to view this content.
    Last edited by xladept; 12-26-2014 at 03:03 PM.

  32. #32
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Solve mathematical problem

    Mr. xladept
    Thanks a lot for all your efforts to offer the best solutions

  33. #33
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Solve mathematical problem

    Hi Yasser,

    Still another correction - sorry

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Solution needed for mathematical problem
    By William50 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-31-2014, 02:07 PM
  2. Please Solve my Problem
    By sweetload in forum Excel General
    Replies: 1
    Last Post: 04-04-2013, 01:42 AM
  3. Excel formula to solve a mathematical issue
    By TRS in forum Excel General
    Replies: 2
    Last Post: 01-05-2011, 07:14 PM
  4. Mathematical Modelling Problem
    By cauchy-riemann in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 11-22-2008, 02:48 PM
  5. Integration (mathematical) problem
    By Jamie-nss in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-09-2005, 12:37 PM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1