Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica 5 - Loading a Package

  1. Feb 23, 2005 #1
    Yesterday, I loaded a package so that I could plot a direction field of a differential equation. It worked just fine. The problem is that now that I want to do it again, it won't work! Using the same Mathematica Notebook, I tried the following:




    PlotVectorField[{1, 9.8-v/5}, {t, 0, 10}, {v, 40, 60}, ScaleFunction->(1&), Axes->True, AspectRatio->1, AxesLabel->{"t", "v"}]

    As soon as I enter the command, the output is not a plot, it is the command itself!!! I also checked out the help section, but I couldn't find anything for this particular problem.

    Any help is highly appreciated.
  2. jcsd
  3. Feb 23, 2005 #2


    User Avatar
    Science Advisor
    Gold Member

    I've noticed something similar on a couple of occations and haven't really figured how to get over it ... the "solution" I've adopted is to write the line again after completely deleting it, which is a really :yuck: solution (or shutting down kernel etc.). Have been able to repeat the problem with some packages, don't know whether it has something to do with "row history" or something like that, as bizarre as it sounds ...
  4. Feb 23, 2005 #3


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Why would you want to load the same package more than once?

    - Warren
  5. Feb 23, 2005 #4
    Well, I tried to reload it since I closed Mathematica and its notebook yesterday. Now I see what you mean. Next time, I just shouldn't worry and redo things (the package remains loaded if I keep a copy of the notebook)! Thank you guys.
  6. Feb 24, 2005 #5
    Look up "needs" command in help. This will only load the package if it has not already been loaded.

    Alternatively if the problem has already happened you can use the "clear" and "remove" functions to remove the function. Then when you load the package again the function will be reloaded as well.

    On a side note...
    Same sort of problem can happen if you evaluate a user defined function multiple times.
    Using "clear" and/or "remove" works in this case too.
  7. Feb 25, 2005 #6


    User Avatar
    Science Advisor
    Gold Member

    Went through a script which was giving trouble and this was actually it, hadn't been careful with Clear etc. basic specs ... :smile:
    Last edited: Feb 25, 2005
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook