MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Manipulate a Plot of Evaluate DSolve

Thanks John,

Yes, my input doesn't work even without the Manipulate and I will take note
to try to simplify things and debug in simpler expressions. Thanks for the

The extra list braces is what Mathematica gives me as an output of a
previous Dsolve which is quite complicated and I have tried to simplify it
in this example by copying the expression with the same sintax and
substituting the difficult part by a Cos[coef*x] to have the same kind of
expression but easier.

Again, in your proposed sintax the problem is easily solved because
Mathematica solves the Dsolve.
I was using the braces to have a Dsolve that arrives directly into the
function to be plotted as is in my real case (without being previously
simplified by Mathematica).
I don't know if I manage to explain myself... sorry if I don't.

Thanks for your help,


2012/7/30 John Fultz <jfultz at>

> Your input wasn't working even without the Manipulate.  Always best to
> test (and, if necessary) debug things outside of a Manipulate, if for no
> other reason than to simplify the problem you're trying to debug.
> In this case, your input is a mess of redundancies.  I'm not really sure
> how you arrived at the extra list braces and the redundant rule for y.  But
> here's what you wanted:
> func[coef_] = DSolve[y'[x] == Cos[coef*x], y, x]
> Manipulate[
>  Plot[Evaluate[y[x] /. func[coef] /. C[1] -> {Range[-5, 0]}], {x, -10,
>    10}], {{coef, 1}, 0.1, 5}]
> In summary, the Evaluate in your example didn't trigger because it wasn't
> the head of Plot's first argument.  But beyond that, nothing would have
> plotted anyway because of the many nested lists and the confusion over the
> extra unnecessary rule replacement in your function definition.
> Sincerely,
> John Fultz
> jfultz at
> User Interface Group
> Wolfram Research, Inc.
> On Jul 29, 2012, at 2:05 AM, barandiaran.juan at wrote:
> > Hi,
> >
> > I'm trying to Manipulate a Plot of a quite difficult function which
> involves solving a differential equation, but cannot be solved analytically.
> >
> > To try to simplify the example and simulate it, let's assume that we
> have the following function:
> >
> > func[coef_] = {{y -> Function[{x}, DSolve[y'[x] == Cos[coef *x], y, x]]}}
> >
> > Manipulate[Plot[{{Evaluate[y[x] /. func[coef] /. C[1] -> {Range[-5,
> 0]}]}}, {x, -10, 10}], {{coef , 1}, 0.1, 5}]
> >
> > I get an error: DSolve::dsvar: "-9.99959 cannot be used as a variable"
> >
> > I think that this is because Manipulate assigns a value to x (=
> -9.99959) BEFORE solving the DSolve, even though to avoid it I'm using the
> Evaluate function, which should process the function before assigning a
> value to x.
> >
> > But the thing is that the "coef" to be Manipulated is at the same
> "level" as the x in the Manipulate block, so probably if I need the coef to
> solve the DSolve, I also have the x that gives me an error.
> >
> > Is there any workaround? I guess I'm not understanding properly how
> Mathematica processes these simple expressions.
> >
> > Thanks, Juan
> >

  • Prev by Date: Re: Manipulate a Plot of Evaluate DSolve
  • Next by Date: Re: How do I create a circular lamina?
  • Previous by thread: Re: Manipulate a Plot of Evaluate DSolve
  • Next by thread: Re: Manipulate a Plot of Evaluate DSolve