Re: How to plot y=f(x) or given y interval?
- To: mathgroup at smc.vnet.net
- Subject: [mg119207] Re: How to plot y=f(x) or given y interval?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 25 May 2011 05:55:28 -0400 (EDT)
If you can take the inverse of the function do so.
f[x_] = (x + 2) (x - 3);
soln = x /. Solve[y == f[x], x]
{(1/2)*(1 - Sqrt[25 + 4*y]), (1/2)*(1 + Sqrt[25 + 4*y])}
ParametricPlot[Evaluate[Thread[{soln, y}]], {y, -4, 4},
AspectRatio -> 1/GoldenRatio]
Or solve numerically,
f[x_] = x*Exp[-3 x] + 7;
ParametricPlot[
{{x /. FindRoot[y == f[x], {x, 0.2}][[1]], y},
{x /. FindRoot[y == f[x], {x, 1}][[1]], y}},
{y, 7.02, 7.1},
AspectRatio -> 1/GoldenRatio]
Bob Hanlon
---- Alexandre Cavalcante <araripealexandre at gmail.com> wrote:
=============
Dear Bob
Thank you for your answer. However, it is not exactly what I am needing.
Let me explain the problem a little bit. Sure you can help me.
Suppose I have a function y=f(x). I want to plot the function from say y=4
to y=10. I do not want (because I don't know) the x range.
Some thing like if would be possible Plot[f[x],{f[x],4,10}]
How can I get this done?
Thank in advance
Alexandre Araripe
2011/5/24 Bob Hanlon <hanlonr at cox.net>
>
> f[x_] = Cos[x];
>
> ymin = -Sqrt[2]/2; ymax = 1/2;
>
> Plot[f[x], {x, -2 Pi, 2 Pi},
> RegionFunction ->
> Function[{x, y}, ymin < y < ymax],
> PlotRange -> {ymin - 0.2, ymax + 0.2}]
>
>
> Bob Hanlon
>
> ---- Alexandre Araripe <araripe at ufba.br> wrote:
>
> =============
> HI,
>
> How can I plot a function y=f(x) for a given y interval?
> Thank in advance
> Araripe