# How do I declare global constants and local constants? [duplicate]

Many times I have a Mathematica code like this

v[t_] = {Subscript[v, 1][t], Subscript[v, 2][t], Subscript[v, 3][t]}
B = {Subscript[b, 1], Subscript[b, 2], Subscript[b, 3]}
elc = {Subscript[e, 1], Subscript[e, 2], Subscript[e, 3]}
A = q/c {{0, Subscript[b, 3], -Subscript[b, 2]}, {-Subscript[b, 3], 0,
Subscript[b, 1]}, {Subscript[b, 2], -Subscript[b, 1], 0}}

system = v'[t] == 1/m ( A.v[t]+q elc)
sol = DSolve[system, {Subscript[v, 1], Subscript[v, 2], Subscript[v, 3]}, t]


Note $q,c,B,elc.m$ are all constants (or their components are). I would like to know how to declare symbolic constants globally and locally (such as when solving a ode). As I would like to both be able to declare all my constants at once and locally. (I believe that the above linear ode system gives a very complex answer without declaring constants, if I am wrong please correct me and also answer my question).

• All parameters you directly use in Mma are global and do not need any special declaration. To create local constants you may use scoping constructs, such as Block, Module and With. Have a look at the Help. – Alexei Boulbitch Nov 10 '16 at 8:12
• @AlexeiBoulbitch Could you give some examples of how to use with. Looking at the documentation is what made me first ask the question. – AzJ Nov 10 '16 at 16:27
• Agreed I will close this question – AzJ Nov 10 '16 at 17:04