Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: loglogplot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73097] Re: loglogplot
  • From: dh <dh at metrohm.ch>
  • Date: Fri, 2 Feb 2007 05:15:23 -0500 (EST)
  • References: <eps7ek$908$1@smc.vnet.net>

Hi Lynn,
there are several things wrong.
First, if you solve our diff equation for y'':
Out[128]//OutputForm=
                                            2
             x y[x] - 2 y[x] y'[x] + x y'[x]
{{y''[x] -> --------------------------------}}
                          x y[x]
you see that you will have troubles near x=0. Therefore, integrate the 
DG not from 0 but from 0.00001.
Second, Evaluate will only work if its on the top level of an argument. 
E.g.
a = 1;
f[x_] := Print[Hold[x]];
SetAttributes[f, HoldAll];
f[2 Evaluate[a]]
will print: Hold[2 Evaluate[a]] not 2 *1 as you may have expected. 
Therefore it is much better to do the substitution of the interpolating 
function as early as possible, e.g:
sol=y /. NDSolve[{2 y'[x] y[x] + x y''[x] y[x] - x (y'[x])^2 == x y[x], 
y[0.00001] == 1, y'[0.00001] == 0}, y, {x, 0.00001, 1}, MaxSteps -> 
1000][[1]]
Further use NItegrate instead of Integrate
f[w_?NumberQ] := 2 NIntegrate[(sol[x])^-1  x/Sqrt[x^2 - w^2], {x, w, 1}]
finally:
LogLogPlot[{f[w], w}, {w, 0.01, 0.99}]
Daniel

lynn wrote:
> Hello,
> 
> I have some problems during the processes.
> 
> \!\(sol =
>     NDSolve[{2\[Times]\(y'\)[x]\[Times]y[x] +
>             x\[Times]\(y''\)[x]\[Times]y[x] -
>             x\[Times]\((\(y'\)[x])\)\^2 \[Equal] x\[Times]y[x],
>         y[0.00001] \[Equal] 1, \(y'\)[0.00001] \[Equal] 0}, y, {x, 0,
> 1},
>       MaxSteps \[Rule] 1000]\[IndentingNewLine]
>   f[w_?NumberQ] :=
>     2\[Times]Integrate[\((Evaluate[y[x] /. sol])\)\^\(-1\)\[Times]
>           x\/\@\(x\^2 - w\^2\), {x, w, 1}]\[IndentingNewLine]
>   << Graphics`Graphics`\[IndentingNewLine]
>   curve = LogLogPlot[{f[w], w}, {w, 0.01, 0.99}]\)
> 
> However, the prcesses work well when I just "Plot" the curve, not
> "LogLogPlot" it.
> I don't know what's wrong....
> 
> Thanks a lot!!!
> 


  • Prev by Date: a problem about loglogplot
  • Next by Date: Re: rather complicated NonlinearFit
  • Previous by thread: loglogplot
  • Next by thread: Re: Problem with ExpIntegralEi vs. LogIntegral