MathGroup Archive 2014

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

Search the Archive

Re: Numerical solution from Module

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132734] Re: Numerical solution from Module
  • From: Themis Matsoukas <tmatsoukas at me.com>
  • Date: Mon, 19 May 2014 02:04:11 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

The module does not know that the a, b, c, in sol[a_,b_,c_] are the same as as those in f[x] because they do not appear in the definition of sol. You have to make the connection explicitly. If you don't want to say f[x,a,b,c], an alternative is:

f[x_] := a*x^2 + b*x + c
soln[aa_, bb_, cc_] := Module[
   {},
   xsoln = 
    x /. Solve[(f[x] /. a -> aa /. b -> bb /. c -> cc) == 0, x]
   ];
soln[1, -3, 2]

{1, 2}



  • Prev by Date: Building a matrix
  • Next by Date: Why can't I solve this ODE set?
  • Previous by thread: Re: Numerical solution from Module
  • Next by thread: DSolve test