Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

mathematica newbie trouble

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99276] mathematica newbie trouble
  • From: Guapo <yangshuai at gmail.com>
  • Date: Fri, 1 May 2009 05:52:31 -0400 (EDT)

i wrote the following mathematica code:

s := (a + b + c)/2;
k[a_, b_, c_] := Sqrt[s (s - a) (s - b) (s - c)];
k[3, 4, 5]
k[5, 9, 12]

when run it, i can't get the write answer. but i change setDelayed(:=)
to set(=), everything works ok

s = (a + b + c)/2;
k[a_, b_, c_] = Sqrt[s (s - a) (s - b) (s - c)];
k[3, 4, 5]
k[5, 9, 12]

i did a google search for the difference of set and setDelayed,
however, i still can't understand it for the upper described problem,
could anyone explain it? great thanks.


  • Prev by Date: Re: Export Mathematica->Excel [specific sheet]
  • Next by Date: Re: New Wolfram Tutorial Collection documentation is ready
  • Previous by thread: Re: Question about Tally on a list of lists
  • Next by thread: Re: mathematica newbie trouble