Date: Mon, 15 Oct 2001 20:57:17 -0500 (CDT) To: organism Subject: Plea for help! We're a group in 427K. After attempting to solve the equations for the group assignment using Maple, Mathematica, and Matlab, we've ran into problems. All of the programs are spitting out huge, page-length, equations, and foreign matter. (What's with the funky ae in Mathematica?!?) We've spent a lot of time trying to figure these problems out. We were wondering if we were doing something wrong. Here's what we have entered, any help would be appreciated: Mathematica: p. 178 15) DSolve [y''[x] - 2y'[x] + y[x] == x*e^x + 4, y[x], x] DSolve [{y''[x] - 2y'[x] + y[x] == x*e^x + 4, y[0] == 1, y'[0] == 1}, y[x], x] 18) DSolve [y''[x] + 2y'[x] + 5y[x] == 4e^(-x) * Cos(2x), y[x], x] DSolve [{y''[x] + 2y'[x] + 5y[x] == 4e^(-x) * Cos(2x), y[0] == 1, y'[0] == 0}, y[x], x] Maple: p. 178 15) diff_eq1 := D(D(y))(x) - 2*D(y)(x) + y(x) = x * e^x + 4; init_con := y(0)=1, D(y)(0)=1; dsolve ({diff_eq1, init_con} , {y(x)}); simplify (dsolve ({diff_eq1, init_con} , {y(x)})); dsolve ({diff_eq1} , {y(x)}); ALSO, for p. 184, #5, 6, & 7, how do we enter the inequalities as initial conditions? Thanks again! From organism Tue Oct 16 12:23:35 2001 Date: Tue, 16 Oct 2001 12:22:53 -0500 (CDT) From: jr Subject: Re: Plea for help! > All of > the programs are spitting out huge, page-length, equations, and foreign matter. Ah, the joys of using computer programs to solve your problems! ;) Remember that the problem set asks you to enumerate some of the disadvantages of using these programs. > (What's with the funky ae in Mathematica?!?) What's "ae"? > We've spent a lot of time trying > to figure these problems out. We were wondering if we were doing something > wrong. Here's what we have entered, any help would be appreciated: > > Mathematica: > p. 178 > 15) DSolve [y''[x] - 2y'[x] + y[x] == x*e^x + 4, y[x], x] > DSolve [{y''[x] - 2y'[x] + y[x] == x*e^x + 4, y[0] == 1, y'[0] == 1}, y[x], x] > 18) DSolve [y''[x] + 2y'[x] + 5y[x] == 4e^(-x) * Cos(2x), y[x], x] > DSolve [{y''[x] + 2y'[x] + 5y[x] == 4e^(-x) * Cos(2x), y[0] == 1, > y'[0] == 0}, y[x], x] In Mathematica, the base of the natural logarithm is denoted by "E" and not "e". Likewise, the imaginary unit is "I" and not "i" (not that you'd use it anyway). You can also substitute "Exp[x]" for "E^x". You're correct in capitalizing "Cos" but remember that all function calls in Mathematica use brackets - "[" and "]" - and not parentheses to set off arguments. Thus you want "Cos[2x]" and not "Cos(2x)". Also, remember that you can use Mathematica (and Maple) to just help you in a particular step of a problem solution, and not just in solving the whole problem for you. For instance, it could help you solve the linear system of equations that result from the method of undetermined coefficients. It could solve for the homogeneous solution for you. It could solve the system of equations that result from incorporating the initial conditions. > Maple: > p. 178 15) > diff_eq1 := D(D(y))(x) - 2*D(y)(x) + y(x) = x * e^x + 4; > init_con := y(0)=1, D(y)(0)=1; > dsolve ({diff_eq1, init_con} , {y(x)}); > simplify (dsolve ({diff_eq1, init_con} , {y(x)})); > dsolve ({diff_eq1} , {y(x)}); I'm not as familiar with Maple, but I'd guess that there are syntax problems here. For instance, try "exp(x)" instead of "e^x". I'd guess that "D(y)(0)=1" isn't legal syntax either (as well as "D(y)(x)" - but then again, maybe you're right). Check the documentation that comes built-in to Maple; it should have examples. Failing that, ask the lab proctor for help. > ALSO, for p. 184, #5, 6, & 7, how do we enter the inequalities as initial > conditions? Thanks again! These are things which can be difficult for Mathematica and Maple to represent. One way around this is to consider just why those intervals are specified: the right-hand sides of those ODEs have discontinuities at the endpoints of the given intervals. We know from the existence and uniqueness theorem that we can't expect a solution to exist (or to be unique if it does) past the times where the RHS (or the coefficients of y, y', etc.) become discontinuous. Stated another way, if we're given initial conditions at a particular time, we can only integrate the DE to get a solution up to where the RHS (or the coefficients) are discontinuous. Thus, tell Mathematica (or Maple) that your initial condition is somewhere in the interval the book specifies. For instance, in problem #5 you could try: DSolve[ {y''[t]+y[t]==Tan[t], y[Pi/4]==a, y'[Pi/4]==b}, y[t], t ] in Mathematica. Note that I haven't specified "a" or "b". Mathematica and Maple can give symbolic solutions in this instance. (You'll need to play with this, though, to get it to work correctly.) Again, another thing to consider is that you don't have to try to get these programs to solve the whole problem for you. Use the programs to solve the homogeneous equation, and then calculate the integrals which result in the variation of parameters method. Hope this helps! j