MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Stupid newbie question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33156] Re: Stupid newbie question
  • From: "Oliver Friedrich" <oliver.friedrich at tz-mikroelektronik.de>
  • Date: Wed, 6 Mar 2002 01:55:31 -0500 (EST)
  • References: <a61ump$goj$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Mike,

I know what you want to do with the line {a,b}={-1,1.5} but this assignment
doesn't work. Write your borders directly into your Plot command.
Also, if you define a function like
f[x_]=1-x
for example, this expression is a replacement rule. The blank _ acts like a
placeholder for something (a pattern). With x_ you can assign this
"something" the name x. So you can use that something again on the right
hand side of that definition. Two examples

1. You define an assignment like
g[x_,t_]=x+t

2. Now Mathematica will evaluate like this
g[2,6] will evaluate to 2+6 will evaluate to 8

or
g[a,t^2+4] will evaluate to a+4+t^2

You see the way it is done?
So if you define a function with f[x_]=bla bla
and you try to call it in your Plot with Plot[f,{x,a,b}] it won't work,
because an expression f doesn't match the pattern f[x_] so Mathematica won't
apply that replacement rule on f. You must plot with

Plot[f[x],{x,1,2}] that will do. You don't even have to use the x you can
also write Plot[f[mike],{mike,1,2}].

OK?

Oli

"Mike O'Leary" <Gremmie at cinci.rr.com> schrieb im Newsbeitrag
news:a61ump$goj$1 at smc.vnet.net...
> I can't seem to get a Plot working.  I have all this typed in the
notebook:
>
> Clear[a, b, f]
> f[x_] := 1 - (Cos(\[ExponentialE]^(3x/4)))
> {a, b} = {-1, 1.5}
> Plot [f, {x, a, b}]
>
> I keep getting an error saying f is not a machine-size real number at x
> = -1.  Any help is appreciated.  Thanks.
>
>



  • Prev by Date: Re: How to transform x axis on ListPlot?
  • Next by Date: Re: Quadratic non-linear ODE.
  • Previous by thread: Re: Stupid newbie question
  • Next by thread: Re: Stupid newbie question