Search code examples
maple

how to obtain non-trivial solution to this second order boundary value eigenvalue ODE?


The ODE is y'' + lam * y(x)=0 with BC y'(0)-y(0)=0 and y'(1)=0.

Maple dsolve only gives the trivial solution y(x)=0. How can one ask Maple to give the non-trivial solution as Mathematica does by default?

This is what I tried

ode:= diff(y(x),x$2)+ lambda*y(x)=0;
bc:=D(y)(0) - y(0)=0, D(y)(1)=0;
dsolve({ode,bc},y(x));

gives y(x)=0 on Maple 2017.3 on windows 7.

While the same commands on Mathematica give

ClearAll[y,x,lam];
DSolve[{y''[x]+lam y[x]==0,y'[0]-y[0]==0,y'[1]==0},y[x],x]

Mathematica graphics

Which is correct by hand solving this.

Does Maple have separate eigenvalue boundary value dsolver? Does one need separate package? I tried to help Maple by typing assuming(lambda>0) but it did not make a difference.

I am sure Maple can do this, since I know Maple is very strong in differential equations, and I just need the right option or command to do it.


Solution

  • This isn't an automatically generated piecewise result.

    And the second call to solve involves solving for cos(lambda^(1/2)) rather than a simple name. (Solving for lambda would produce a RootOf and dealing with any substitution of that seems awkward at best.)

    But here's something. (I expect there's a better way...)

    restart;
    
    ans:=dsolve({diff(diff(y(x),x),x)+lambda*y(x) = 0,
                 D(y)(0)=K, D(y)(1) = 0},y(x)):
    
    ans:=collect(ans,K);  # for beauty's sake
    
                     /          1/2                1/2            1/2   \
                    |sin(lambda    x)   cos(lambda   ) cos(lambda    x)|
      ans := y(x) = |---------------- + -------------------------------| K
                    |         1/2                1/2           1/2     |
                    \   lambda             lambda    sin(lambda   )    /
    
    solve(eval(subs(x=0,y(0)=K,ans)),{K});
    
                    {K = 0}
    
    eval(ans, %);
    
                   y(x) = 0
    
    eqn:=solve(eval(subs(x=0,y(0)=K,ans)),{cos(lambda^(1/2))});
    
                            1/2          1/2           1/2
          eqn := {cos(lambda   ) = lambda    sin(lambda   )}
    
    eval(ans,eqn);
    
             /          1/2                      \
             |sin(lambda    x)             1/2   |
      y(x) = |---------------- + cos(lambda    x)| K
             |         1/2                       |
             \   lambda                          /
    

    [edit: If you're interested in real values for lambda, then here's something else.]

    restart;
    de := diff(diff(y(x),x),x) + lambda*y(x) = 0:
    bcs := D(y)(0) = K, D(y)(1) = 0:
    ans := dsolve({de,bcs}, y(x)):
    ans := collect(ans, K);
    
                        /   /      (1/2)  \
                        |sin\lambda      x/
          ans := y(x) = |------------------
                        |         (1/2)    
                        \   lambda         
    
                  /      (1/2)\    /      (1/2)  \\  
               cos\lambda     / cos\lambda      x/|  
             + -----------------------------------| K
                        (1/2)    /      (1/2)\    |  
                  lambda      sin\lambda     /    /  
    
    # The following equation must hold in order that your
    # original boundary condition  D(y)(0) = y(0) holds.
    
    eqn := eval(subs(x=0, y(0)=K,ans));
    
                                 /      (1/2)\     
                            K cos\lambda     /     
            eqn := K = ----------------------------
                             (1/2)    /      (1/2)\
                       lambda      sin\lambda     /
    
    spec := [solve(eqn)];
    
             [                          
             [                          
             [                          
     spec := [{K = 0, lambda = lambda}, 
             [                          
    
        /                                              2\ ]
        |                      /             (1/2)    \ | ]
       <                       |        /  2\         |  >]
        |K = K, lambda = RootOf\tan(_Z) \_Z /      - 1/ | ]
        \                                               / ]
    
    all_spec := map(allvalues, spec):
    
    # Select only those elements of `all_spec` which satisfy `eqn`.
    # (One of the float RootOfs returned by `allvalues` doesn't
    # satisfy `eqn` above.
    
    all_spec := select(u->is(simplify(fnormal(evalf[20](eval((rhs-lhs)(eqn),u))),
                                      zero)
                             = 0),
                       all_spec):
    
    map(print, all_spec):
    
                    {K = 0, lambda = lambda}
    
     /                                                            2\ 
     |                      /             (1/2)                  \ | 
    <                       |        /  2\                       |  >
     |K = K, lambda = RootOf\tan(_Z) \_Z /      - 1, 0.8603335890/ | 
     \                                                             / 
    
     /                                                           2\ 
     |                      /             (1/2)                 \ | 
    <                       |        /  2\                      |  >
     |K = K, lambda = RootOf\tan(_Z) \_Z /      - 1, 3.425618459/ | 
     \                                                            / 
    
    # These below are the mentioned solutions, using the above RootOf's
    # having so-called "float descriptors", which means they can
    # be further approximated to arbitrary precision using `evalf`.
    
    p_sols := {seq([eval(ans, K=eval(K,all_spec[i])),
                    [lambda=eval(lambda,all_spec[i])]],
                   i=1..nops(all_spec))}:
    
    #map(print, p_sols):
    
    # For fun, now approximate using default precision.
    
    fp_sols := evalf(p_sols):
    
    seq(print(eval(fp_sols[i][1], fp_sols[i][2])), i=1..nops(fp_sols)):
    
                           y(x) = 0.
    
            y(x) = (1.162339833 sin(0.8603335890 x)
               + 1.000000000 cos(0.8603335890 x)) K
    
            y(x) = (0.2919180907 sin(3.425618459 x)
               + 1.000000002 cos(3.425618459 x)) K