Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to solve a boundary value problem with NDSolve. The code is:

sol = Block[{M = 0.0}, 
  NDSolve[{
    f'''[x] + f[x]*f''[x] - f'[x]*f'[x] - M*f'[x] == 0, 
    f[0] == 0, f'[0] == 1, f'[15] == 0}, 
    f, x, 
    MaxSteps -> 10^5, 
    AccuracyGoal -> 50, 
    PrecisionGoal -> 50, 
    WorkingPrecision -> 50, 
    Method -> 
     {"Shooting", "StartingInitialConditions" -> {f[0] == 0, f'[0] == 1, f''[0] == -0.5}}]]

The f''[0] == -0.5 that you see in the Method option is just trial and error on my part. When I execute the code, I get the following error messages.

NDSolve::precw: The precision of the differential equation ({0. (f^[Prime])[x]-(f^[Prime])[x]^2+f[x] (f^[Prime][Prime])[x]+(f^(3))[x]==0,f[0]==0,(f^[Prime])[0]==1,(f^[Prime])[10]==0}) is less than WorkingPrecision (50.`). >>

NDSolveReinitialize::precw: The precision of the argument function ({f[0]==0,(f^\[Prime])[0]==1,(f^\[Prime]\[Prime])[0]==-0.5}) is less than WorkingPrecision (50.). >>

NDSolve::ndtol: Tolerances requested by the AccuracyGoal and PrecisionGoal options could not be achieved at x == 0. >>

NDSolve::ndtol: Tolerances requested by the AccuracyGoal and PrecisionGoal options could not be achieved at x == 0. >>

NDSolve::ndtol: Tolerances requested by the AccuracyGoal and PrecisionGoal options could not be achieved at x == 0. >>

General::stop: Further output of NDSolve::ndtol will be suppressed during this calculation. >>

NDSolve::berr: There are significant errors {4.3180842775472223126931759314001997855580001822181*10^-78,-0.50000000000000000000000000000000000000000000000000,0.50000000000000000000000000000000000000000000000000} in the boundary value residuals. Returning the best solution found.>>

I am completely stuck on the prolem. Please help me with this.

share|improve this question
4  
You're mixing precision quite badly here, which leads to these error messages. How much precision do you really need in the result? Just remove MaxSteps -> 10^5, AccuracyGoal -> 50, PrecisionGoal -> 50, WorkingPrecision -> 50 and you'll get an answer straight away without any problems. If you really need high precision, note that WorkingPrecision has to be higher than AccuracyGoal/PrecisionGoal, and you should avoid introducing values (such as 0.0 and -0.5) with less than your working precision. –  Oleksandr R. Jan 4 at 22:54

1 Answer 1

sol = Block[{M = 0.0}, 
 NDSolve[{
f'''[x] + f[x]*f''[x] - f'[x]*f'[x] - M*f'[x] == 0, 
f[0] == 0, f'[0] == 1, f'[15] == 0}, 
f, x, 
MaxSteps -> 10^5, 
 AccuracyGoal -> Automatic, 
PrecisionGoal -> 50,  WorkingPrecision->MachinePrecision ,
Method -> 
 {"Shooting", "StartingInitialConditions" -> {f[0] == 0, f'[0] == 1, f''[0] == -0.5}}]]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.