Re: Defining a function using common notation for absolutevalue (not Abs[x])
- To: mathgroup at smc.vnet.net
- Subject: [mg112757] Re: Defining a function using common notation for absolutevalue (not Abs[x])
- From: Barrie Stokes <Barrie.Stokes at newcastle.edu.au>
- Date: Wed, 29 Sep 2010 04:15:23 -0400 (EDT)
Hi Gianni
This works for me:
(***********************)
Needs[ "Notation`" ]
Notation[NotationTemplateTag[
RowBox[{|, x_, |}]] \[DoubleLongLeftRightArrow] NotationTemplateTag[
RowBox[{Abs, [, x_, ]}]]]
| -3 |
ffffffffff[x_] := 3^-| x |
ffffffffff[3]
ffffffffff[-3]
(***********************)
Cheers
Barrie
>>> On 28/09/2010 at 8:06 pm, in message <201009281006.GAA26377 at smc.vnet.net>,
Gianni <accardi at accardi.com> wrote:
> Please refer to:
>
> http://www.accardi.com/tutor/AbsoluteValueNotationSnapShot.bmp
>
> Thanks in advance for any help here.
>
>
> In ASCII:
>
> The given function to work with: f(x) = (3^-|x|)
>
> Define it in Mathematica:
>
> f[x_]:=3^-Abs[x]
>
> f[x_]:=3^-|x|
>
> Syntax::tsntxi: "|x|" is incomplete; more input is needed.
>
> Syntax::sntxi: Incomplete expression; more input is needed.
>
> I am trying to display the absolute value exponent in the second
> function definition above in the way students will see it in a
> standard math text (with the vertical bars, not Abs, like in the first
> text line). The first definition above is without error (exponent
> shown as -Abs[x]). The second is what I am trying to define without
> error. I am trying to find the button (hopefully on the classroom
> assistant palette) that will produce the desired results. The button
> in the Typesetting section of the Classroom Assistant won't be
> implemented as an error free function definition as you see in the
> error messages.
>
> --------------------------------------------