Re: init



Jon Harrop wrote:
bob@xxxxxxxxxxxxxx wrote:
why won't this work?

float boxcenter[3];

if (nodectr == 0)
boxcenter = {centerpt[0] + halfwidth/2.0, centerpt[1] + halfwidth/2.0,
centerpt[2] + halfwidth/2.0};

Because you're using the wrong language. Try OCaml:
...snip...

or Mathematica:

boxcenter = {0,0,0}

If[nodectr==0, boxcenter={centerpt[[0]] + halfwidth/2.0,
centerpt[[1]] + halfwidth/2.0,
centerpt[[2]] + halfwidth/2.0}]

boxcenter = centerpt + halfwidth/2.0 (* would also work *)


or C++ with a suitable library:
...snip...

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/ocaml_for_scientists/chapter1.html

.



Relevant Pages

  • Re: Languages similar to Mathematica?
    ... Jon Harrop wrote: ... Without a type system, working with non-trivial data ... wrote much Mathematica, so bear with me. ... something so complex "in the open source world". ...
    (comp.lang.functional)
  • Re: Lisp and Scheme with fewer parentheses / Mathematica??
    ... Fateman (a well-known Mathematica hater) sullies Mathematica by ... Jon Harrop wrote: ... designed over the last 20 years, and before that there were languages ... Computer-assisted symbolic math is a special case for infix ...
    (comp.lang.lisp)
  • Re: references about the beauty of functional programming ?
    ... Jon Harrop writes: ... Most programs in science are disposable. ... Without tools like Mathematica and OCaml I would have wasted most of my time ... OCaml would be somewhere in between. ...
    (comp.lang.functional)
  • Re: Benefits of Dynamic Typing
    ... Jon Harrop wrote: ... > compiler, for example, but Mathematica is not designed to be a general ... > purpose programming language and is not currently as suitable for compiler ...
    (comp.lang.functional)
  • Re: Lisp syntax vs. Mathematica syntax
    ... Jon Harrop writes: ... > Bruce Stephens wrote: ... but those are well known idiosyncrasies of Mathematica; ... I guess it's no big deal, but the choices seem odd to me. ...
    (comp.lang.lisp)