Menu ▾ ▴

#3623 Problem with ic2 and bc2 from ode2

None
open
nobody
5
2020-04-06
2020-04-01
No

Trying to solve a second order differential equation with ode2 I get the following errors with ic2 and bc2.

(%i1)   assume(c>0)$
(%i2)   eq:'diff(y,x,2)+c^2*y=f(x)$
(%i4)   sol:ode2(eq,y,x);
(sol)   y=-(cos(c*x)*integrate(f(x)*sin(c*x),x)-sin(c*x)*integrate(f(x)*cos(c*x),x))/c+
%k1*sin(c*x)+%k2*cos(c*x)
(%i5)   ic2(sol,x=0,y=a,'diff(y,x)=b);
integrate: variable must not be a number; found: 0

#0: ic2(soln=y = (-(cos(c*x)*'integrate(f(x)*sin(c*x),x)-sin(c*x)*'integrate(f(x)*cos(c*x),x))/c)+%k1*sin(c*x)+%k...,xa=x = 0,ya=y = a,dya='diff(y,x,1) = b)

 -- an error. To debug this try: debugmode(true);
(%i6)   bc2(sol,x=0,y=a,x=L,y=b);
integrate: variable must not be a number; found: 0

#0: bc2(soln=y = (-(cos(c*x)*'integrate(f(x)*sin(c*x),x)-sin(c*x)*'integrate(f(x)*cos(c*x),x))/c)+%k1*sin(c*x)+%k...,xa=x = 0,ya=y = a,xb=x = L,yb=y = b)

 -- an error. To debug this try: debugmode(true);

It looks like the problem is that ic2 and bc2 are substituting x=0 inside integrate(...,x).

Discussion

  • Robert Dodier

    Robert Dodier - 2020-04-06
    • labels: --> ode2, diff eqs, ic2, bc2, share packages
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,5 +1,5 @@
     Trying to solve a second order differential equation with ode2 I get the following errors with ic2 and bc2.
    -
    +~~~~
     (%i1)  assume(c>0)$
     (%i2)  eq:'diff(y,x,2)+c^2*y=f(x)$
     (%i4)  sol:ode2(eq,y,x);
    @@ -17,6 +17,6 @@
     #0: bc2(soln=y = (-(cos(c*x)*'integrate(f(x)*sin(c*x),x)-sin(c*x)*'integrate(f(x)*cos(c*x),x))/c)+%k1*sin(c*x)+%k...,xa=x = 0,ya=y = a,xb=x = L,yb=y = b)
    
      -- an error. To debug this try: debugmode(true);
    
    - 
    + ~~~~
      It looks like the problem is that ic2 and bc2 are substituting x=0 inside integrate(...,x). 
    
     
  • Robert Dodier

    Robert Dodier - 2020-04-06
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,5 +1,6 @@
     Trying to solve a second order differential equation with ode2 I get the following errors with ic2 and bc2.
    -~~~~
    +
    +```
     (%i1)  assume(c>0)$
     (%i2)  eq:'diff(y,x,2)+c^2*y=f(x)$
     (%i4)  sol:ode2(eq,y,x);
    @@ -17,6 +18,7 @@
     #0: bc2(soln=y = (-(cos(c*x)*'integrate(f(x)*sin(c*x),x)-sin(c*x)*'integrate(f(x)*cos(c*x),x))/c)+%k1*sin(c*x)+%k...,xa=x = 0,ya=y = a,xb=x = L,yb=y = b)
    
      -- an error. To debug this try: debugmode(true);
    
    - ~~~~
    +```
    +
      It looks like the problem is that ic2 and bc2 are substituting x=0 inside integrate(...,x). 
    
     
  • Robert Dodier

    Robert Dodier - 2020-04-06

    Trying again to fix formatting.

     

Log in to post a comment.