0
$\begingroup$

I am solving two problems simultaneously in which the variable x is defined. To the left of the image, i'm solving shape functions and matrix operations. But to the right i'm solving Green's function.

Notice the 'x' variable values are being used from left notebook to the right notebook which yields wrong solution.

But even when I open a new notebook the variable is carried over and being used.To the left I'm doing shape function calculations, To the right I'm evaluating the Green's function

To this i've tried doing this

Format -> Option Inspector -> Cell Options -> Evaluation Options

There I changed "CellContext" from "Global" to "Notebook". But It is still using it as global variable.

How do I restrict the usage such that when I define a variable it is used within that notebook only?

$\endgroup$
5
  • $\begingroup$ Have you choosen "Selected notebook" drop-down item in the Options Inspector? $\endgroup$ Commented Nov 10, 2019 at 1:45
  • $\begingroup$ Under the Evaluation menu, Kernel Configuration Options you can add kernels and then use a different one for each notebook under Notebook's kernel $\endgroup$
    – Bill Watts
    Commented Nov 10, 2019 at 2:33
  • $\begingroup$ mathematica.stackexchange.com/q/22032/363 $\endgroup$ Commented Nov 10, 2019 at 9:50
  • $\begingroup$ You probably forgot to change the dropdown menu on top, titled 'Show option values', from 'Selection' to 'Selected Notebook' (as Alexey Popkov said) or 'Global Preferences'. Bill Watts' method is easier if you want to apply it to a specific notebook. Choose 'Global Preferences' if you want it to be the default setting. $\endgroup$
    – user55405
    Commented Nov 10, 2019 at 11:39
  • 1
    $\begingroup$ The standard approach is from the menu: Evaluation/Notebook Default Context/Unique to this Notebook $\endgroup$
    – Dominic
    Commented Nov 10, 2019 at 11:49

0

Browse other questions tagged or ask your own question.