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


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

Mystifying Scoping of Piecewise Variable?

From Frank Iannarilli <frankeye@cox.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Mystifying Scoping of Piecewise Variable?
Date 2011-02-02 11:08 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iibduv$npg$1@smc.vnet.net> (permalink)

Show all headers | View raw


Perhaps I'm tired, but this is weird:

Clear[myFunc]

myFunc[y_] = Piecewise[{{x^2, x < 0}, {x, x >= 0}}]
   (Same behavior below for either Set(=) or SetDelayed(:=) )

Plot[myFunc[y], {y, -10, 10}]
  (returns empty plot)

Plot[myFunc[x], {x, -10, 10}]
  (returns "expected" piecewise function plot)

What is the scoping of the Piecewise variable, in this case "x"?  

How can one write a Module that creates and returns a Piecewise function?   The scope of its argument is unclear to me. 

Thanks

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


Thread

Mystifying Scoping of Piecewise Variable? Frank Iannarilli <frankeye@cox.net> - 2011-02-02 11:08 +0000
  Re: Mystifying Scoping of Piecewise Variable? Albert Retey <awnl@gmx-topmail.de> - 2011-02-03 10:28 +0000

csiph-web