f

#### Re: Numerical solution of differential equation with boundary

```susy wrote:
> Hallo,
>
> I need to solve the following differential equation:
>
> (1/4 r^2 + 2 Sin[F[r]]^2) F''[r] + 1/2 r F'[r] +
>   Sin[2 F[r]] (F'[r])^2 - 1/4 Sin[2 F[r]] - (Sin[F[r]]^2 Sin[2 F[r]])/r^2 == 0
>
> with boundary values:
> F==Pi, F[Infinity]==0.
>
> I tried NDSolve, but failed to get a solution.
> How can I solve that equation?
>
> Best regards,
> susy
>

I had some luck by changing to a finite interval via r->1/(1+r). But I
still needed to scoot in a bit from the origin (corresponding to
infinity in the original coordinate).

new = (1/4 r^2 + 2 Sin[ff[r]]^2) D[ff[r], {r, 2}] +
1/2 r D[ff[r], {r, 1}] + Sin[2 ff[r]] (D[ff[r], {r, 1}])^2 -
1/4 Sin[2 ff[r]] - (Sin[ff[r]]^2 Sin[2 ff[r]])/r^2 /.
Derivative[j_][ff][r] :> Derivative[j][ff][r]*D[1/(1 + r), {r, j}];

In:= eps = .0001;

In:= gg =
ff[r] /. First[
NDSolve[{new == 0, ff[1 - eps] == Pi, ff[eps] == 0},
ff[r], {r, 1 - eps, eps}]];

During evaluation of In:= FindRoot::sszero: The step size in the
search has become less than the tolerance prescribed by the
PrecisionGoal option, but the function value is still greater than the
tolerance prescribed by the AccuracyGoal option. >>

During evaluation of In:= NDSolve::berr: There are significant
errors {-7.77603*10^-8,0.000328812} in the boundary value residuals.
Returning the best solution found. >>

(*Ignoring the warning messages, the plot seems reasonable. *)

hh[s_?NumberQ] := gg /. r -> 1/(s + 1)

Plot[hh[s], {s, 1/(1 - eps) - 1, 1/eps - 1}]

Daniel Lichtblau
Wolfram Research

``` 0  Daniel
5/21/2010 10:44:27 AM comp.soft-sys.math.mathematica  28821 articles. 0 followers. 0 Replies 633 Views Similar Articles

[PageSpeed] 39 Similar Artilces:

Re: Numerical solution of differential equation with boundary
It does not work for bc F[10^-5] == Pi Having searched using google for some time, I found a solution as follows: \[Epsilon] = 10^-10; fSky[sl_?NumericQ] := NDSolve[{(1/4 r^2 + 2 Sin[F[r]]^2) F''[r] + 1/2 r F'[r] + Sin[2 F[r]] ( F'[r])^2 - 1/4 Sin[2 F[r]] - 1/(r)^2 Sin[F[r]]^2 Sin[2 F[r]] == 0, F[\[Epsilon]] == \[Pi], F'[\[Epsilon]] == sl}, F, {r, \[Epsilon], 1000}] fSky2[sl_?NumericQ] := With[{f = fSky[sl][[1, 1, 2]]}, f[f[[1, 1, 2]]]] Plot[fSky2[sl], {sl, -5.468, -5.469}] Plot[Evaluate[F[r] /. fSky[sl /. sl -> -5.46877516]], {r, 0., 10}, PlotRange ...

Numerical solution of a differential equation
Halloechen! I have the following DE: (r(t)-diff(r(t),t,t))^2 + (diff(r(t),t))^2 = 0. I want to solve this numerically. But every time I call dsolve I get the following error message: dsolve((r(t)-diff(r(t),t,t))^2+(diff(r(t),t))^2,r(t),numeric); Error, (in DEtools/convertsys) unable to convert to an explicit first-order system How can I solve the equation? Tschoe, Torsten. -- Torsten Bronger, aquisgrana, europa vetus On Sat, 7 Feb 2004, Torsten Bronger wrote: > (r(t)-diff(r(t),t,t))^2 + (diff(r(t),t))^2 = 0. > I want to solve this numerically. But every ti...

Re: Ordinary Differential Equation: Mathematica
Hi Everyone, :) s = NDSolve[{x'[t] == \[Mu]*(y[t] - (1/3*x[t]^3 - x[t])), y'[t] == -1/\[Mu]*x[t], x == 8, y == 2}, {x, y}, {t, 150}]; This above code will show limit cycles when you parametric plot the Van de Pol Equation. However, I want to find the period T numerically. I need to add in a piece for mu ranging from 0 to 0.5 by steps of 0.05 and 5 to 50 by steps of 5. After that, I need the code to find the period of the limit cycle. How can I accomplish this? Kind Regards, Sudharaka. Hi, Sudharaka, I guess the main problem is the idea to find the period. The rest you may do using, say, the Table function. Let us look for the period in the case mu=0.5. This is your equation and its solution: \[Mu] = 0.5; s = NDSolve[{x'[t] == \[Mu]*(y[t] - (1/3*x[t]^3 - x[t])), y'[t] == -1/\[Mu]*x[t], x == 8, y == 2}, {x, y}, {t, 0, 150}] {{x -> \!\(\* TagBox[ RowBox[{"InterpolatingFunction", "[", RowBox[{ RowBox[{"{", RowBox[{"{", RowBox[{"0.`", ",", "150.`"}], "}"}], "}"}], ",", "\<\"<>\"\>"}], "]"}], False, Editable->False]\), y -> \!\(\* TagBox[ RowBox[{"InterpolatingFunction", "[", RowBox[{ RowBox[{"{", RowBox[{"{", RowBox[{"0.`", ",", "150.`"}], "}"}], "}"}],...

Re: How to plot solutions of equations with Mathematica?
On 10/7/05 at 3:37 AM, michelasso@despammed.com (Michelasso) wrote: >It is a very stupid question, but browsing the help I couldn't find >a quick solution to this problem: I want to plot on the plane the >solutions of the equation in two variables x^2+y^2 == 1 with >Mathematica. How should I do? When browsing the help, don't forget to check out the functions in Add-ons & Links->Standard Packages. These function can all be accessed after first loading the correct package. For you particular case you want to do: <<Graphics`ImplicitPlot` ImplicitPl...

Re: system of differential equations mathematica help
Hi, Your equations admit 2 first integrals: a[x]*u[x]=C1 u[x]^2/2+C2=-p[x] With the help of the boundary conditions one gets C1=0.1 and C2=-0.995. You may eliminate u and p and end up with a single equation: 50a''-0.005a^(-2)+2a^(-3/2)=2.005 (Please check its correctness yourself. I did it fast and may have introduced minor errors). This one is more easy to solve. Even with this equation, however, NDSolve reports problems: s = NDSolve[{a''[x] - 0.005*a[x]^-2 + 2*a[x]^(-3/2) == 2.005, a == 1, a == 1}, a[x], {x, 0, 10}] Power::infy: Infinite expression 1/0.^2 encountered. >> Power::infy: Infinite expression 1/0.^(3/2) encountered. >> Infinity::indet: Indeterminate expression 2.005 +ComplexInfinity+ComplexInfinity encountered. >> Here one way is to try to regularize it so that one has no infinity at a->0: s = NDSolve[{a''[x] - 0.005*(a[x]^2 + 0.001)^-1 + 2*(a[x]^2 + 0.001)^(-3/4) == 2.005, a == 1, a == 1}, a[x], {x, 0, 10}] This is already better, as you may see by evaluating this: Plot[a[x] /. s, {x, 0, 10}] But there are still warnings: FindRoot::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations. >> NDSolve::berr: There are significant errors {-0.95868,-0.852012} in the boundary value residuals. Returning the best solution found. >> But in this point you may already look for some appropriate method to get a bette...

Re: Numerical solution of the heat equation on a disk
Thank you for that explanation. I was missing a few points here. Regards, Francois On Nov 4, 2010, at 7:43 AM, Mark McClure wrote: > On Thu, Nov 4, 2010 at 4:58 AM, Francois Fayard <FFayard@slb.com> wrote: > >> I would like to get a numerical simulation of the heat equation with >> Dirichlet boundary conditions on a disk. With the problem I have, >> the function does not depend on theta, so we get : >> u_t == u_rr + (1/r) u_r >> >> It introduces a singularity as goes to 0 and Mathematica can not >> solve the problem with N...

export differential equation solution obtained through Mathematica to
Hi everyone, I would like to know if there is a way to export differential equation solution obtained through Mathematica to microsoft excel. There are several data processing things that I want to know, that simply plotting the solution in Mathematica won't suffice. I have a system of differential equations like so: sol3=NDSolve[{p'[t]=-0.0491*p[t]-0.0089*p[t],n'[t]=0.0491*p[t]+(0.0491-0.0089)*n[t],p=25000,n=0},{p,n},{t,0,100}] When I plotted it in Mathematica using this code: Plot[Evaluate[{n[t]+p[t]}/.First[sol3]],{t,0,100}] I get a exponential ...

Re: Seeing a solution of a differential equation as it run, using EvaluationMonitor
On 5/13/2011 7:30 PM, Nasser M. Abbasi wrote: > Here is a small example of looking at solution of some basic made > up ode as it runs: > > -------------------- > x1 = 0; x2 = 0; > pt = {{x1, x2}}; > > Dynamic[ListPlot[pt, Joined -> False, PlotRange -> {{0, 2*Pi}, {0, 7}}]] > > (*when pt is updated below, this causes ListPlot to revaluate automatically*) > process[t_, y_] := Module[{}, > {pt = Append[pt, {t, y}]}; > Pause[0.05] ] > > (*solve the ode, use EvaluationMonitor*) > eq = y''[t] == Cos[t]...

Re: Seeing a solution of a differential equation as it run, using EvaluationMonitor #2
This eliminates the "empty" Module: Initialization :> (process[t_, y_] := (AppendTo[pt, {t, y}]; Pause[0.01])) Bobby On Sat, 14 May 2011 02:09:39 -0500, Nasser M. Abbasi <nma@12000.org> wrote: > On 5/13/2011 7:30 PM, Nasser M. Abbasi wrote: >> Here is a small example of looking at solution of some basic made >> up ode as it runs: >> >> -------------------- >> x1 = 0; x2 = 0; >> pt = {{x1, x2}}; >> >> Dynamic[ListPlot[pt, Joined -> False, PlotRange -> {{0, 2*Pi}, {0, >> 7}}]] >&...

Re: Mathematica hangs when solving sys. of equations w/certain parameters
Mr Lichtblau: Thank you very much for the detailed response. I really appreciate your help. I'm on a tight deadline and am really swamped with other work at the moment, but I'll read what you wrote and get back to you. Regards, Sean On Wed, 30 Mar 2005, Daniel Lichtblau wrote: > Sean wrote: > > I am trying to find local maxima of an objective function by solving the FOCs of a function of 4 control variables (pL,pH,phiL,phiH) and 3 parameters (c, pDBS,phiDBS). > > > > The objective function is > > > > f[pL_,phiL_,pH_,phiH_,pDBS_,phiDBS_,c_] = \ > > (pL-0.5c*phiL^2)*((pH-pL)/(phiH-phiL) - pL/phiL) + \ > > (pH-0.5c*phiH^2)*((pDBS-pH)/(phiDBS-phiH) - (pH-pL)/(phiH-phiL)) > > > > I find the FOCs by differentiating with respect to each of the 4 control variables, and then I solve the system using Solve[] (see details below) > > > > For certain values of the parameters (c, pDBS, phiDBS), the Solve[] routine works fine. But I can't figure out why Solve[] just seems to hang for other parameter values. I have verified that it's not because I'm dividing by zero or anything, and the points that are causing problems seem to be totally generic. > > > > For example, everything works fine when (c=0.1, pDBS=5, phiDBS=8) and when (c=0.1, pDBS=7, phiDBS=8), but not when (c=0.1, pDBS=6, phiDBS=8). I happen to know that at these latter parameter values, one of the s...

Initial Value Problem, Plotting numerical solutions of a second order homogeneous differential equation
Given: Initial Value Problem: y''+.15y'-y+y^3=0, y(0)=c, y'(0)=0 Need to plot a numerical solution of this equation from t=0 to t=40 for each of the initial values c=0.5,1,1.5,2,2.5. Plot all five solutions on one graph. I'm just getting used to MATLAB; confused on how to solve this problem. Thanks for the help "Shane " <shaneh@terpmail.umd.edu> wrote in message news:l3omcu\$bci\$1@newscl01ah.mathworks.com... > Given: Initial Value Problem: y''+.15y'-y+y^3=0, y(0)=c, y'(0)=0 > > Need to plot a numerical solution of this equation from t=0 to t=40 for > each of the initial values c=0.5,1,1.5,2,2.5. > Plot all five solutions on one graph. > I'm just getting used to MATLAB; confused on how to solve this problem. > Thanks for the help Since this sounds like homework I'm not going to give you the answer outright, but I will suggest that you look at the examples in the documentation for the ODE45 function. You can open the documentation by typing this command: doc ode45 For the second part, the PLOT and HOLD functions will be of interest to you. If after trying these out you're still stuck, if this is in fact homework, I recommend you go to your professor's office (or your TA's office/cube/etc.) during his or her office hours and ask for help. -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on h...

Re: Re: Numerical evaluation is Mathematica bottleneck?!
Hello, The problem consists of three coupled nonlinear equations: the Poisson equation and the countiniuty equations for electrons and holes. The countiniuty equations consist of convection-diffusion type equations for electrons and hole current and the generation-recombination terms. The Poisson equation for non-uniform mesh at node 2: FV=(2*(-((-V[] + V[])/h[]) + (-V[] + V[])/h[]))/(h[] + h[])-(q*(nt + n[] + NA[] - ND[] - p[]-pt))/eps[] The electron and hole currents between nodes 1-2 and 2-3 and the countinuity equation...

RE: Re: Help to solve numerical equation
Jean-Claude, If you can narrow down the domain to a reasonable value then Ted Ersek's RootSearch package from MathSource will get both roots. Needs["Enhancements`RootSearch`"] ?RootSearch RootSearch[lhs==rhs,{x,xmin,xmax}] tries to find all numerical solutions to \ the equation (lhs==rhs) with values of x between xmin and xmax. eq = 0.5*Exp[x*200] + 0.21*Exp[x*500] + 0.1*Exp[x*110] + 0.07*Exp[x*(15)] + 0.018*Exp[x*(-16)] + 0.002*Exp[x*(-263)] - 1; RootSearch[eq == 0, {x, -1, 1}] {{x -> -0.0232796}, {x -> 0.00042907}} Plot[eq, {x, -0.03...

Could someone else verify that an example from the Numerical Solutions to Differential Equations isn't working.
I am looking at the example on page 348 of the tutorial for a numerical solution to the Sine-Gordon equation. (http://www.wolfram.com/learningcenter/tutorialcollection/AdvancedNumericalDifferentialEquationSolvingInMathematica/). It doesn't work for me for M8.0.4, MacBook, MacOs 10.7.4. Can someone else verify that this doesn't work? Here is the example: L = 10; (*the tutorial has L=-10, but I think that is a typo. In any case, the example doesn't work with + or - *) state = First[NDSolve`ProcessEquations[{D[u[t, x, y], t, t] == D[u[t, x, y], x, x] + D[u[t, x, y], y, y] - Sin[u[t, x, y]], u[0, x, y] == Exp[-(x^2 + y^2)], Derivative[1, 0, 0][u][0, x, y] == 0, u[t, -L, y] == u[t, L, y], u[t, x, -L] == u[t, x, L]}, u, t, {x, -L, L}, {y, -L, L}, Method -> {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", "DifferenceOrder" -> "Pseudospectral"}}]] GraphicsGrid[Partition[Table[ NDSolve`Iterate[state, tau]; Plot3D[ Evaluate[ u[tau, x, y] /. NDSolve`ProcessSolutions[state, "Forward"]], {x, -L, L}, {y, -L, L}, PlotRange -> {-1/4, 1/4}], {tau, 0, 20, 5}], 2]] Thanks, Craig W Craig Carter Professor of Materials Science, MIT Am 15.07.2012 10:30, schrieb W Craig Carter: > I am looking at the example on page 348 of the tutorial for a numerical solution to the Sine-Gordon equati...

Elementary Differential Equations Boundary Value (2ndEd) Kohler Instructors Solution Manual is available for purchase! Contact me at instructors.team[at]gmail.com
Elementary Differential Equations Boundary Value (2ndEd) Kohler Instructors Solution Manual is available for purchase! Contact me at instructors.team[at]gmail.com ...

Elementary Differential Equations Boundary Value (2ndEd) Kohler Instructors Solution Manual is available for purchase! Contact me at instructors.team[at]gmail.com
Elementary Differential Equations Boundary Value (2ndEd) Kohler Instructors Solution Manual is available for purchase! Contact me at instructors.team[at]gmail.com ...

handling exact solution from solve vs numerical solution from fsolve for same equation
hello; I am asking for the difference between > Digits:=200; > > eq:=-x^3+6*x^2-6*x-1: > fsolve(eq=0,x); > > solve(eq=0,x); > evalf(%); The result of evalf(%) above contains a complex part. No matter how large I make Digits to be. the result of fsolve contains only real part. The question is, would you consider this equation to have complex or real roots? thanks, Nasser In article <rXV3f.2604\$tV6.1659@newssvr27.news.prodigy.net>, Nasser Abbasi <nma@12000.org> wrote: |>I am asking for the difference between ...

Re: Differential Equation
On 4/29/14 at 1:33 AM, zmmohamadi@gmail.com (Zohreh) wrote: >I am going to solve the following differential equation: >dY(x)/dx=A*f(x)-B*Y(x) >In which A and B are some parameters, f(x) is a function of x, and >Y(C)=0 (C is a parameter). >I tried to solve it in Mathematica by DSolve[Y'[x] == A*f[x] - >B*Y[x], Y[C] == 0, x] >But I get the following error DSolve::dsfun: "Y[C]==0 cannot be used >as a function >I would highly appreciate it if somebody can help me. =46irst, it is unwise to use a single capital letter as a variable name as m...

Re: Solving differential equations
Yesterday I sent the two differential equations to you by e-mail. But there was an error in the initial conditions. The initial conditions are taken at r=5.67. I didn't plug this value into the equation. After plugging in this value, the correct initial conditions are: x(5.67) = - {a[5.67*b + (32*b^2 + a^2 + 0.0019)^(1/2)]}/(a^2 + 0.0019) y(5.67) = -{0.043*[5.67*b + (32*b^2 + a^2 + 0.0019)^(1/2)]}/(a^2 + 0.0019) while the two differential equations are the same. I am sorry about this. Shen ...

Re: how to solve an equation numerically?
On Tue, 3 Jan 2006 16:55:44 +0300, Mikon <ipmikon@MAIL.RU> wrote: >Specifically, i need to find 2 roots of an equation ln(x) = a*x, where >0<a<1/e. >In Matlab, i write smth like this: >root1 = fzero(@(x)log(x)-a*x, [1, 1/a]); >root2 = fzero(@(x)log(x)-a*x, [1/a, 2/a/a]); > >How can i do this in SAS? The following is working for me. (I checked the answers against those obtained with Mathematica 4.1 for Windows.) (As usual initial values are critical for convergence. In this case the smaller the coefficient 'a', the more separated the roots; the smallest root being closer to 1(remember, ln (1)=0).) data initial; do x=1,17;output;end; run; proc model; endogenous x; log(x)-0.13*x=0; solve x/out=roots; run; quit; proc print data=roots; run; ******* Part of the output ******* The SAS System 11:29 Tuesday, January 3, 2006 39 Obs _TYPE_ _MODE_ _ERRORS_ x 1 PREDICT SIMULATE 0 1.1633 2 PREDICT SIMULATE 0 24.6531 ************************************* Regards, RVV ...

Re: Learning maths with mathematica
Berthold, I would suggest spending an hour per day following threads that seem interesting to you on this MathGroup's postings. Each example of problem or issue related to the use of Mathematica will expose you to practical solutions and very often deep insight that is hard to replicate with books or documentation read in isolation. Yours truly ... Syd Geraghty Syd Geraghty B.Sc., M.Sc. sydgeraghty@me.com San Jose, CA (408) 532 6852 Mathematica 8.0 for Mac OS X x86 (64-bit) (November 6, 2010) Licenses: L2983-5890, L3028-2592 MacOS X V 10.6.5 Snow Leopard MacBook Pro ...

Re: solution of equation #3
On 2/12/11 at 5:21 AM, pi.munik@gmail.com (Piotr Munik) wrote: >I want to solve equation like this: >L := 100; h := 1; While the above is valid Mathematica syntax, it isn't the best choice. First, there are a variety of built-in symbols in Mathematica that are named with a single uppercase letter. So, even though there currently is no built-in symbol L, it is a good idea to not use single upper case letters as variables. Second, SetDelayed (:=) delays assignment until the symbol is used. What this means in algorithms such as FindRoot that supply numeric values to th...

solution of nonlinear differential equation
Hi, I simplified and equation and solved it unless this part integral of X^2*(dx/dt)^2*dt from x1 to x2 and x1 and x2 is not equal to zero. Is analytical solution is available to this equation. thank you Ali ...

error in the solution of differential equation
Hello! I have a question, I received a numerical solution of differential equations in the form of a graph (interpolation function) and image of the exact solution. I need to know at what point interpolating function gives me the numerical solution in the form of graphics and how can I find out? is it possible to just do a numerical solution in explicit form? and also to know at which point in the exact solution function gives a solution? or it has something to ask? Here is a link to the task, must to find the error (alpha). http://www.fayloobmennik.net/1067191 Thank you in advance... Web resources about - Re: Numerical solution of differential equation with boundary - comp.soft-sys.math.mathematica

Resources last updated: 3/29/2016 12:09:27 PM