Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15742
| From | Tomas Garza <tgarza10@msn.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Mystifying Scoping of Piecewise Variable? |
| Date | 2011-02-03 10:27 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <iidvu9$bh7$1@smc.vnet.net> (permalink) |
Shouldn't the argument of myFunc in the definition be x_?
-Tomas
> Date: Wed, 2 Feb 2011 06:08:08 -0500
> From: frankeye@cox.net
> Subject: Mystifying Scoping of Piecewise Variable?
> To: mathgroup@smc.vnet.net
>
> 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 | Find similar | Unroll thread
Re: Mystifying Scoping of Piecewise Variable? Tomas Garza <tgarza10@msn.com> - 2011-02-03 10:27 +0000
csiph-web