MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Multiple Constants

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83252] Re: Multiple Constants
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Fri, 16 Nov 2007 05:26:50 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fhh80l$946$1@smc.vnet.net>

thehammerster at gmail.com wrote:
> Hi,
> I'm new to Mathematica and I feel like this is a stupid question but I
> can't seem to define more than one constant
> 
> If I type
> SetAttributes[a,b,c,Contstant]
> I get
> SetAttributes::argrx: SetAttributes called with 4 arguments; 2
> arguments are \expected.
> 
> I have three equations and three variables I want to solve for and I
> have 8 constants.
> 
> x+y+z=1
> b*x+c*y+d*z=A
> f*x+g*y+h*z=Q
> 
> b,c,d,A,f,g,h,Q are constants and I want a generic equations that I
> can use for many different variations of these constants.
> 
> I've done the calculation by hand but fear I have made a mistake and
> would like to double check my calculation, and then use the equation
> to propagate my errors, as each constant has an associated standard
> error of the mean. Propagation of my error will give me an error on my
> model calculation, which is really important.

Solving equations does not require that one declare constant values in 
any particular way. Just list the variables for which you want to solve 
your system in the second argument of *Solve* or *Reduce*. For instance,

In[1]:= eqns = {x + y + z == 1, b*x + c*y + d*z == A, f*x + g*y + h*z == Q};
Solve[eqns, {x, y, z}]

Out[2]=
          A g - d g - A h + c h - c Q + d Q
{{x -> -(---------------------------------),
          c f - d f - b g + d g + b h - c h

           A f - d f - A h + b h - b Q + d Q
    y -> -(----------------------------------),
           -c f + d f + b g - d g - b h + c h

           A f - c f - A g + b g - b Q + c Q
    z -> -(---------------------------------)}}
           c f - d f - b g + d g + b h - c h


The following links may be worth reading (or at least browsing)

http://reference.wolfram.com/mathematica/guide/EquationSolving.html

http://reference.wolfram.com/mathematica/tutorial/SimultaneousEquations.html

Regards,
-- 
Jean-Marc


  • Prev by Date: Re: Minimizing Mathematica file size for source code control?
  • Next by Date: Re: Re: Solving simple equations
  • Previous by thread: Re: Multiple Constants
  • Next by thread: Re: Multiple Constants