MathGroup Archive 2009

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

Search the Archive

Re: procedures

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96948] Re: [mg96937] procedures
  • From: Davide Venturelli <ventutech at gmail.com>
  • Date: Sat, 28 Feb 2009 06:39:53 -0500 (EST)
  • References: <200902271116.GAA21679@smc.vnet.net>
  • Reply-to: ventutech at gmail.com

Thank you for the answer!

> What is the purpose of assigning its value to  
> itself?  

I am evaluating a recursive function.
I want to store every computed value in such a way that next time the
code calls it, it remembers if it has already evaluated it.
So while I need := for definition of the recursive functions, I use the
Do loop to assign actual values to the array.

Do you have a better idea?

> Third, s only has value within the Do loop, do you mean to  
> return D[x,n]?  

Yes.

> Fourth, why clear D?  In short the pseudocode raises  
> more questions than one could answer.

Anyway I solved the problem using the Module[] function.
I now have another problem, anyway!

When I do FindRoot[f[x],{x,0}] it looks for all instances of x in the
definition of the function, and THEN evaluate the function for the
symbol X.
What I want is to override this symbolic method and call f[x] with the
numerical value of x, since in the definition of f[x] I have recursive
functions that would imply to evaluate a huge polynomial of x, and
keeping track of all the terms is really lengthy.
While if I substitute x=x0 at each recursive step, the computation is
less costy.

So is there a way to tell mathematica in FindRoot to call the function
with numerical values, like it was a black box?

Thanks!
Davide

> Best Regards,
> 
> Sseziwa Mukasa



  • Prev by Date: Re: Can't quite figure out tensors
  • Next by Date: wrong solution for double integral of piecewise function?
  • Previous by thread: Re: procedures
  • Next by thread: Re: procedures