Re: Help me about plotting function using its tangets!!!
- To: mathgroup at smc.vnet.net
- Subject: [mg9831] Re: Help me about plotting function using its tangets!!!
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Fri, 28 Nov 1997 05:35:44 -0500
- Organization: University of Western Australia
- Sender: owner-wri-mathgroup at wolfram.com
Enzo Martinelli wrote:
> I have the following differenzial equation
>
> (f ')^2+2*g(x)*f '+1=0.
> How can I plot the f function without to integrale the equation above?
> (I'd want to plot the function for (wrapper of tangents).
I think you are after the slope-field then? One way to obtain this is
first to obtain f'[x] as a function of x (and generally f[x]):
In[1]:= solns = Solve[f'[x]^2 + 2 g[x] f'[x] + 1 == 0, f'[x]] Out[1]=
2
{{f'[x] -> -g[x] - Sqrt[-1 + g[x] ]},
2
{f'[x] -> -g[x] + Sqrt[-1 + g[x] ]}}
Here is some code for plotting the slope-field:
In[2]:= SlopeField[f_, {x_, x0_, x1_, dx_}, {y_, y0_, y1_, dy_}] :=
Show[Graphics[{Hue[1],
Table[a = 1/(2 Sqrt[f^2 + 1]);
Line[{{x - a dx, y - a dx f}, {a dx + x, a dx f + y}}],
{x, x0, x1, dx}, {y, y0, y1, dy}]}], Axes -> True];
For an explicit g[x], say g[x] -> Cosh[x], here is the first solution
branch:
In[3]:= SlopeField[Evaluate[First[f'[x] /. solns] /.
g[x] -> Cosh[x]], {x, 0.1, 2, 0.1}, {y, -0.05, 1.2, 0.1}];
Alternatively, you should find the package
<<"Graphics`PlotField`"
helpful.
Cheers,
Paul
____________________________________________________________________
Paul Abbott Phone: +61-8-9380-2734
Department of Physics Fax: +61-8-9380-1014
The University of Western Australia Nedlands WA 6907
mailto:paul at physics.uwa.edu.au AUSTRALIA
http://www.pd.uwa.edu.au/~paul
God IS a weakly left-handed dice player
____________________________________________________________________