Thread: Mathematica program non-coordination between solve function and variable definition?

  1. #1
    Registered User
    Join Date
    Mar 2010
    Location
    bbsr,odisha,india
    Posts
    27

    Mathematica program non-coordination between solve function and variable definition?

    i wrote a program in which we need to find the values of two variables a and b and then give their sum.But, when i do a+b, it tells
    In[60]:= a + b

    Out[60]= a + b

    what is the problem?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Without more code, we canīt say - because we canīt see your screen.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2010
    Location
    bbsr,odisha,india
    Posts
    27
    Code:
    In[55]:= Solve[{2 a + 3 b == 9, a - 23 b == 16}, {a, b}]
    
    Out[55]= {{a -> 255/49, b -> -(23/49)}}
    
    In[56]:= a + b
    
    Out[56]= a + b
    Last edited by suryap.kv1bbsr; 10-09-2010 at 03:17 AM. Reason: this was the code

  4. #4
    Registered User carrotcake1029's Avatar
    Join Date
    Apr 2008
    Posts
    404
    Looks OK to me. I even plugged it into wolframalpha.com, which is there kind of free to the public calculator that supports mathematica syntax.
    Code:
    http://www.wolframalpha.com/input/?i=Solve[{2+a+%2B+3+b+%3D%3D+9%2C+a+-+23+b+%3D%3D+16}%2C+{a%2C+b}]
    *had to use code tags because bbcode engine thought this was code...

  5. #5
    Registered User
    Join Date
    Mar 2010
    Location
    bbsr,odisha,india
    Posts
    27
    Quote Originally Posted by carrotcake1029 View Post
    Looks OK to me. I even plugged it into wolframalpha.com, which is there kind of free to the public calculator that supports mathematica syntax.
    Code:
    http://www.wolframalpha.com/input/?i=Solve[{2+a+%2B+3+b+%3D%3D+9%2C+a+-+23+b+%3D%3D+16}%2C+{a%2C+b}]
    *had to use code tags because bbcode engine thought this was code...
    this is only value of a nd b
    now i want to automatically deduce a+b, which is not working becoz it does not consider the values derived from the equations as values of a and b

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 08:28 AM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM