Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8105

Re: Slow plotting of reflected parametric "butterflies"

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Slow plotting of reflected parametric "butterflies"
Date 2012-01-22 12:26 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jfgva3$ph4$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 1/21/12 at 5:20 AM, cy56@comcast.net (Chris Young) wrote:

>I'm thinking that it's much safer programming style to always
>isolate any functions using Set (rather than SetDelayed) inside a
>module; otherwise aren't there "exposed" global variables? If these
>get assigned some value, wouldn't the function be broken?

I don't agree using Set is any safer/riskier than SetDelayed.
But I do agree it is important to understand the difference
between them and when each is appropriate.

Localizing variables inside Module clearly isolates them from
the external environment. But Module localizes variables by
creating new variables which can cause unexpected difficulties.

That is:

In[1]:= a = 2;
{Module[{a = 4}, {Names["a*"], 4}], a}

Out[2]= {{{a,a$2093},4},2}

Contrast that with

In[1]:= a = 2;
{Block[{a = 4}, {Names["a*"], 4}], a}

Out[2]= {{{a},4},2}

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: Slow plotting of reflected parametric "butterflies" Bill Rowe <readnews@sbcglobal.net> - 2012-01-22 12:26 +0000
  Re: Slow plotting of reflected parametric "butterflies" Chris Young <cy56@comcast.net> - 2012-01-23 07:59 +0000

csiph-web