I defined the following function:

q5e8[z_?NumericQ] := q5e8[z?NumericQ] = NIntegrate[Sin[(2 5 10^8 - v) z]/z^5, 
  {v, 0.1, 2 5 10^8}]

As you can see, it is a function that remembers values it has found, so that i dont need to compute things twice. I saved the function to a file using

Save["q5e8", q5e8]

But now, how can I retrieve the definition and the values the function has evaluated from this file?


1 Answer 1


You can use Get (<<) to retrive the contents of the file "q5e8":

reads in a file, evaluating each expression in it and returning the last one.

q5e8[z_?NumericQ] := q5e8[z] = NIntegrate[Sin[(2 5 10^8 - v) z]/z^5, {v, 0.1, 2 5 10^8}]


Save["q5e8", q5e8]

After using ClearAll[q5e8] or in a new front-end session, using


loads the content of the file "q5e8".

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.