# Mathematica help needed, please (very simple?)

1. Mar 3, 2007

### *best&sweetest*

I need to construct a direction field plot for a differential equation and I have this code

Needs["GraphicsPlotField"];
PlotDirectionField[ff_, {x_, a_, b_}, {y_, c_, d_}] := Module[{f}, f = \
Compile[{x, y}, ff]; PlotVectorField[{190, f[x, y]}, {x, a, b}, {y, c,
d}, ScaleFunction -> (1 &), Axes -> True, Ticks -> None, Frame -> True,
AspectRatio -> 1] ];

and after that I plot the field entering the following code
PlotDirectionField[f[x,y], {x,a,b}, {y,c,d}]
where f[x,y] is the right hand side of my equation.

My problem is that I need to show field for x in quite big interval (from 0 to 30 - a=0,b=30) and I know that the solution curve behaves differently between 0 and 1 than what the field shows. How can I make the plot so that on the x axis I have intervals of, let's say, 0.1 instead of 1 all the way between 0 and 30?

Thanks for help!

2. Mar 3, 2007

### Crosson

First of all, I don't understand why you use a module to compile the function. All plot functions in mathematica automatically compile their arguments.

It sounds like you are not getting enough detail in the arrows, that you want there to be more arrows in the region 0 to 1. First try decreasing the HeadWidth option. If this is not sufficient, I see the following choices:

1) Picture within a picture, i.e. you Show a plot from 0 to 1 superimposed on the plot from 0 to 30, so that there is a higher density of arrows from 0 to 1.

2) Using the Arrow package, create your own customized PlotVectorField function that allows the user to input a density function which gives the densities of the arrows.

Sorry I do not know a simpler way! In my experience, the built in PlotVectorField is not very robust.