Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15742 > unrolled thread
| Started by | Tomas Garza <tgarza10@msn.com> |
|---|---|
| First post | 2011-02-03 10:27 +0000 |
| Last post | 2011-02-03 10:27 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: Mystifying Scoping of Piecewise Variable? Tomas Garza <tgarza10@msn.com> - 2011-02-03 10:27 +0000
| From | Tomas Garza <tgarza10@msn.com> |
|---|---|
| Date | 2011-02-03 10:27 +0000 |
| Subject | Re: Mystifying Scoping of Piecewise Variable? |
| Message-ID | <iidvu9$bh7$1@smc.vnet.net> |
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 top | Article view | comp.soft-sys.math.mathematica
csiph-web