Hi(adsbygoogle = window.adsbygoogle || []).push({});

I have a long procedure, which calculates the potential of a physical system. The procedure returns something having the form

whereCode (Text):

potential = 1/(constant + z)

zis a variable. Now, I need to evaluatepotentialat differentz. I can of course do something like

and so on, but is there a better way to do this without having to rewrite the procedure? I'm thinking about having something like potential[z], but that is perhaps too late for me to use this, without having to rewrite the whole thing?Code (Text):

z = 1;

potential

z=2;

potential

Thanks for any help.

Best,

Niles.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica: Variables and Functions

**Physics Forums | Science Articles, Homework Help, Discussion**