Re: 'Changing' parameters in an expression

*To*: mathgroup at smc.vnet.net*Subject*: [mg60570] Re: 'Changing' parameters in an expression*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Tue, 20 Sep 2005 05:20:10 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On 9/19/05 at 4:45 AM, anonmous69 at netscape.net (Matt) wrote: >What follows (at the end) worked for me, however, I'm wondering if >it's the 'right' approach or not. What I mean by 'right' is this: >my eventual approach worked, but there may be another approach that >is more efficient and demonstrates a more wide ranging principal in >using Mathematica, and hence would be applicable in many >situations. >I started off with this: eqn = x'[t] == x[t](x[t] - a); >(I am using eqn as the first argument to DSolve, which is why it >appears as it does.) >I wanted to plot the rhs of eqn with 'a' having a value of 1/2, so >first I tried this: Plot[eqn[[2]] /. a->1/2, {t, 0, 6}]; >That didn't work as I got these types of errors: It doesn't work because the function x is undefined. You are asking Plot to handle x[t](x[t]-1/2). You told plot to sample this from t=0 to t=6, But you haven't told Mathematica how to compute x[t]. >I tried a few other rules with essentially the same results and >then I tried this: Plot[eqn[[2]] /. {a->1/2, x[t]->x}, {x, 0, 6}]; Now you have changed the function to a polynomial in x and asked for the polynomial to be plotted from 0 to 6. Mathematica now has all the information needed to create the plot. >Which worked for me. I'm sure it has something to do with what I'm >asking Plot to work with. It just seems strange to me that DSolve >will work with eqn, but Plot does not. Why? DSolve is intended to find an unknown function that solves a differential equation. Plot is designed to plot a *known* function. These tasks are fundamentally different. -- To reply via email subtract one hundred and four