Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Can anyone simplify this?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36461] Can anyone simplify this?
  • From: Moranresearch at aol.com
  • Date: Sat, 7 Sep 2002 02:54:53 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I have substituted the letters SS, CC, X, Y and Z1 and Z2 for some 
complicated expressions just to illustrate the form of the function. This 
function works and all the conditions are necessary but I am sure a more 
elegant programming solution perhaps using While could be found. Any 
suggestions to tighten this up? Thank you.

f[{Sa_, Ca_, Aa_, Sb_, Cb_, Ab_, a_, b_}] := {If[Aa == Ab, a Sa + b Sb, 
      If[Ca == 0 || Cb == 0, a Sa + b Sb, SS]], 
    If[Aa == Ab, a Ca + b Cb, If[Ca == 0 || Cb == 0, a Ca + b Cb, CC]], 
    If[Ca == 0 && Cb == 0, "Nil", If[Z1 == Z2, If[Ca < 0, Aa, If[Cb < 0, Ab,
            If[Ca > 0,
              If[Aa > 90, Aa - 90, Aa + 90],
              If[Cb > 0,
                If[Ab > 90, Ab - 90, Ab + 90]]]]],
        If[Aa == Ab, Aa,
          If[Ca == 0 && Cb == 0, "Nil",
            If[Ca == 0, Ab,
              If[Cb == 0, Aa,
                If[Y == 0, "Nil",
                  If[X > 180, X - 180, If[X < 0, X + 180, X]]]]]]]]]}



  • Prev by Date: RE: non zero result after multiplying with zero.
  • Next by Date: Re: Plotting The Slope field of a differential equation
  • Previous by thread: I need to do one graphic in Origin 5.0
  • Next by thread: RE: Can anyone simplify this?