| Author |
Comment/Response |
John Leko
|
10/24/00 5:24pm
>Here is a function: f[x_] := 1\/8\ \((19 + 27\ x + 9\ x\^2 + x\^3) >Now I got that far to get the first and second diferentiation:Solve[f'[x]==0,x],Solve[f''[x]==0,x].
>I even managed to plot the graph.
>Now what syntax do I use to get the proper y values for the x values?
There are a couple of ways to do this, depending on your needs. You can:
1. Simply substitute the value into the brackets, as you would in algebra (e.g., f[3]);
2. If you have a list of specific values, use the Map command (e.g., Map[f, {3, 78, 20}]) where the second argument is your list of values; or
3. For a continuous list of values, use the Table command (e.g., Table[f[x], {x, 1, 20}]).
>How do I get Mathematica to put out decimal numbers?
Use N[expression]. For instance,
In[13]:= f[x_] := 1/8 (19 + 27x + 9x^2 + x^3)
N[Map[f, {3, 4, 5}]]
Out[14]= {26., 41.875, 63.}
>How can I plot specific Points such as an extreme value by markingit with a dot ?
If you know the coordinates of the point, use the Point primative, e.g., Show[Graphics[Point[{1, 2}]]];
>I did not quite understand what the underline is for that one is suposed to place behind the f[x_].
The underline means pattern (section 2.3.1 in The Mathematica Book). What you are effectively doing is similar to using algebraic notation. When you say f(x) = 2x, what you are saying algebraically is that when you see an x on the righ-hand side of the equation, replace it with a particular value. The same thing happens in Mathematica, except that this pattern can be a number of different things. Not just a single value! You can, for example, replace it with another symbol...
In[15]:= f[x_] := 1/8 (19 + 27x + 9x^2 + x^3)
f[z] <- here I use the argument ''z''
Out[16]= (1/8 ((19 + 27 z + 9 z^2 + z^3)))
Patterns are one of the features of Mathematica which give it its power, and utility.
>I woul appreciate some help
>best regads
>Johannes
URL: , |
|