Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6534813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:17:48+00:00 2026-05-25T10:17:48+00:00

I have two different Mathematica notebooks with similar, but different functions. Both work fine

  • 0

I have two different Mathematica notebooks with similar, but different functions. Both work fine when they’re the only notebook open. One of them consistently fails when the other notebook is open, despite my (liberal) use of Clear[] to clear out the relevant variables.

Call this one, say, GlobalManipulate

ClearAll["Global`*"]
Clear["Global`*"]
Definition[linear]
linear[x_] := a x;
quad[x_] := a x^2;
functionList := {linear, quad};
Manipulate[
  Plot[function[dummy], {dummy, -10, 10}], 
  {function, functionList}, {a, -10, 10},
  LocalizeVariables -> False, TrackedSymbols -> All
]

Call this one, say, LocalManipulate

Clear["Global`*"]; 
Manipulate[
   {
      linear := a x; quad := a x^2; 
      linear, quad, function, 
      Plot[ReleaseHold@function, {x, -10, 10}]
   }, 
   {function, {HoldForm@linear, HoldForm@quad}}, 
   {a, -10, 10}, TrackedSymbols -> All
]

When run by itself, GlobalManipulate works as expected and I see the plot that updates as a is changed. The definition of linear produces Null.

When LocalManipulate is open, running, GlobalManipulate no longer works. even when it’s rerun It’s plot appears for a second and then vanishes.

I’ve reproduced this using my local copy of Mathematica 8 and a remote copy of Mathematica 7.

The problem must involve the functions linear[x_] and quad[x_] since

GlobalManipulatePrime:

ClearAll["Global`*"]
Clear["Global`*"]
Definition[linear]
linear1[x_] := a x;
quad1[x_] := a x^2;
functionList := {linear1, quad1};
Manipulate[
  Plot[function[dummy], {dummy, -10, 10}], 
  {function, functionList}, {a, -10, 10}, 
  LocalizeVariables -> False, TrackedSymbols -> All
]

works fine.

Edited to add bold text to stress that I’m rerunning Global, and that I’m trying to figure out why functions persist despite my ClearAll[].

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:17:48+00:00Added an answer on May 25, 2026 at 10:17 am

    Apart from wrapping the functions in Module or DynamicModule and localizing the variables you could also place the notebooks in individual contexts using the Evaluation ► Notebook's Default Context menu.

    You could also set the context using the function Begin. This should all be done before your functions are defined.

    Update

    I didn’t read your question too well I think. As to the cause of ClearAll not working:

    1. Because of the definition of linear in LocalManipulate using the
      localized variable a, the symbol linear gets defined as something like linear:=FE`a$$51 x
    2. In GlobalManipulate you use both the name linear (in the function selection) and the function linear
    3. Because of defining the symbol linear in FE`a$$51 x the line functionList := {linear, quad}; in GlobalManipulate now actually means functionList := {FE`a$$51 x,FE`a$$53 x^2} which, out of the other Manipulate context, doesn’t mean anything, so your plot disappears
    4. Why then doesn’t ClearAll remove this definition? This has to do with the properties of the dynamic variables buried in the Manipulate box visible in the LocalManipulate notebook. They keep on getting redefined there. Remove the output of the Manipulate and re-execute GlobalManipulate and you’ll see it now works. Something similar is discussed here.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two different grid controls on the same form. They share the same
I have two different asp.net web applications both referencing the same dll e.g. SharedLibrary.dll
I have two different domains that both point to my homepage in the same
I have two different database in different machine.Both the have same tables and i
I have two different NSDictionary objects where there are keys that belong to both
I have two different WinForms applications, AppA & AppB. Both are running .NET 2.0.
I have two different buttons viz save and update. I want to open single
I have two different servers each running a Ubuntu installation. On both of them,
I have two different ways of displaying items in a WPF application. The first
I have two different-sized monitors, connected together using (I believe) TwinView. I tried System.out.println(Toolkit.getDefaultToolkit().getScreenSize());

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.