
Magnetica is a tool for the analysis and calculation of magnetostatics and applications. By taking advantage of a certain number of specific functions of Mathematica, it achieves a new approach for everything that is relevant to the phenomenology of magnetic fields. Besides, its range of application is wider that the "static" qualifier lets suppose. It extends, de facto, to all the electromagnetic phenomena for which the interaction of the magnetic field is dominating the interaction of the electric field. In a concrete way, this covers all the cases for which the characteristic dimension of the studied system is far smaller than the wavelength l. The methodology of Magnetica is based on two equations of Maxwell limited to the static conditions (DivB=0, RotB = µ J) and on their integration in the volume covered by J. This applies directly to all the fieldgenerating structures made of winding that draw macroscopic electric currents, such as straight current lines or solenoid. But this also applies to the material structures by using the amperian description of the matter (by opposition to the coulombian description). These two descriptions are interrelated. Thus, we consider that the magnetic properties depend on the surface currents for the volume of the matter. These properties, specific to every material, are represented by the law of magnetization that expresses the dependence between the magnetization and the magnetic excitation. We are now going to examine the various points where the functions of Mathematica lead to a new approach for the methodology of the calculations. Let us clarify that the term magnetic field in Magnetica means not only the vector magnetic field but also the data directly associated: vector potential, flux and gradient. Naturally, and generally speaking, there is the fact that Mathematica, being a tool of formal calculation, allows proceeding with the derivation of the numerous equations involved. Besides, its graphic capacities provide an easy and concrete way to test the quality and the relevance of the results. Thus, for simple structures, such as the cylindrical current loop, the use of the complete elliptic functions, EllipticK and E, enables the calculation of the field at every point of the space. For more complex structures, such as the solenoid, for which the integration is unquestionably numeric, a high degree of precision can be obtained by the application of GaussLegendre quadratures. And also, Mathematica directly provides the numerical coefficients of these functions with the desired precision using GaussianQuadrature. Another main contribution of Mathematica is to allow the practical use of the calculation of the magnetic field by the method of spherical harmonics. This method derives from the concept of scalar potential by opposition to the method that derives from the vector potential. That was known more than hundred years ago since James Clerk Maxwell explained it in 1860. But this has been left, for a very long period, a purely academic subject. Indeed, the application requires the use of the Legendre polynomials with an order depending of the desired precision for the results. The function LegendreP of Mathematica allows users to easily process these polynomials for any order. Moreover, the Mathematica formal processing capacities provide the way to quickly derive formulas applicable to more complex structures than the simple filament current loop. And finally, we must say that the uses of spherical harmonics are much more extended. Indeed, their characteristic coefficients provide a measure not only of the intensity of the magnetic field but also of its quality. For example, a pair of current loops in position of Helmholtz has its coefficient of order 2 being null. Also, a Magnetic Resonance Imaging (MRI) magnet must have its lowest order coefficients very small. In a MRI device, the production of the image, is compelled to a very high magnetic field homogeneity (10^7) in the region of interest (a sphere of 2 feet in diameter). The design of these magnets is thus very difficult. But again, the use of the Mathematica optimization function FindMinimum, associated with the spherical harmonics coefficients, had appeared fundamental. That was the key for a drastic improvement in the analysis and design of these magnets. The calculation of the magnetic field for the structures made of magnetic material raises specific problems. In the first place, there is the discretization of the volume of the material. Each of the elements (cell) of this volume is subjected to a double influence: 1) the magnetic field resulting from sources external to the structure, and 2) the magnetic field produced by all the cells surrounding the target cell. We end up with an interaction matrix between all the cells. The precise solution of this problem requires the use of a consequent number of cells that leads to big matrixes. Consequently, the solution implies to resolve large dimensions linear system. The Mathematica function LinearSolve effectively allowed us to process problems involving matrixes of several thousand cells. Besides, the magnetic properties of the material must be taken into account. For the common materials, the answer of the material to the magnetic excitement is very low and it is linear (their ratio is the magnetic susceptibility). As a consequence, the solution of the linear equation is straightforward. But for the ferromagnetic materials, which are the base for most of the electric machines, this answer is both very large and nonlinear. The relationship is usually known through graphics curve, such as µ (permeability) = F (Hm, magnetizing field). It is necessary to model this curve by adapted mathematical functions. It appeared that the interpolation functions of Mathematica (as Fit) are very useful to get an effective modeling. Conclusion: Magnetica is a powerful tool for magnetic computation (field, forces, inductance, and so forth) relying on Mathematica's comprehensive set of mathematical and scientific functions.

