Reliable Modeling of Ideal Generic Memristors via State-space Transformation

The paper refers to problems of modeling and computer simulation of generic memristors caused by the so-called window functions, namely the stick effect, non-convergence, and finding fundamentally incorrect solutions. A profoundly different modeling approach is proposed , which is mathematically equivalent to window-based modeling. However, due to its numerical stability, it definitely smoothes the above problems away.


Introduction
The announcement [1] of the fabrication of the socalled HP memristor, which imitates the behavior of the socalled fourth fundamental circuit element, introduced into the circuit theory by L. Chua in 1971 [2], initiated the development of a lot of its various models for computer simulation [1], .The very first one is a simple model from [1] describing the TiO 2 memristor as a resistor whose resistance is dependent on the position of the boundary between the doped and undoped TiO 2 layers.This position, dependent on the history of the current flowing through the device, is modeled there via a differential equation where the derivative of the position with respect to time is directly proportional to the electric current.In order to model the nonlinear dopant drift, the current is then multiplied by the so-called window function which takes zero values for the limiting values of the boundary positions, this way modeling the boundary slowdown near its terminal states.The frequently used Joglekar window [12] can be shaped by an integer parameter p.A serious drawback of the Joglekar and several other windows is called the stick effect or the terminal-state problem: if the system reaches one of its limiting states, then the derivative of the state is zero, with no possibility of leaving this state via external excitation.Some authors deal with this problem via considering nonzero values of the window at limiting states [13].However, this causes another problem: if the system reaches a state which represents some physical limit, it cannot continue in the motion, and thus the state derivative with respect to time must be zero.This status can be changed only if the direction of the driving quantity is changed too.This knowledge is reflected by the Biolek window [14], which depends not only on the state but also on the device current, or, more exactly, on its direction.Let us mention for the sake of completeness that also other window functions for modeling the nonlinear dopant drift can be found in the literature [15], [16], for example the Strukov [1], Prodromakis [17], TEAM or Kvatinsky [18] windows, the piecewise-linear window [19], the Tukey window [20], the trigonometric windows [21], the BCM [22] and generalized BCM model [23], etc.Some of the above techniques were developed in an effort to refine the models in order to make them conform to experimental data.The survey of selected models is given in [24], [25] under the names "Air Force Research Lab Model" [26] and "HP labs MIM Model" [27].Today frequently utilized "Hyperbolic Sine Model" [28] was generalized in [29], and another modification of this model was published in [30].An excellent analysis of the hyperbolic models is given in [31].
A common feature of the above hardware-correlated models as well as of models of other memristive systems such as PCM (Phase Change Memory) [32], (ITMT) Insulator-to-Metal Transition memristive system [33], TaO x devices [34], etc., is that they gradually move away from the original definition [2] of the memristor as the ideal circuit element, which is defined by the charge (integral of current) -flux (integral of voltage) constitutive relation, whose state variable is either the charge or the flux.All the models are based on state equations, with the state variables being generally derived from the geometry of the physical implementation of the system (the position of the boundary between the layers of the TiO 2 memristor [1], the tunneling gap width in the Pickett model [35], the metallic phase fraction of ITMT systems [33], the angular spin in the spintronic memristor [36] or from the variables which characterize accumulated quantities such as the temperature -the state variable of the thermistor [37], bulb [38], [39], discharge lamp [40], or PCM system [32].The window approach, a potential source of numerical problems in the course of subsequent simulations [41], is frequently used therein for modeling various boundary phenomena.Some of the above models of the memristive system fall into the class of the so-called generic memristors or ideal generic memristors [42], whose computer simulation frequently labors with substantial numerical errors.A lot of papers describe the already mentioned stick effect.It is stated in [17] that the Prodromakis window "is essentially free of the terminal-state problem".A contraexample will be given in Sec. 2. Convergence problems have also been reported, particularly when simulating hard-switching regimes or using the rectangular window via increasing the p parameter for the Joglekar window.
The stick effect and the convergence problem are in fact only the tip of the iceberg.The papers [41], [43] provide SPICE simulations of a simple model of the HP memristor whose results merely differ from its theoretical behavior.The analysis in [44] points out that memristor models employing window functions of the Joglekar type act as amplifiers of the numerical errors generated by the finiteprecision number representation in the SPICE environment.One can keep a check on these errors only to some degree: Such conditions can always be induced, particularly via exciting the simulated system into the hard switching regime, when the errors exceed the acceptable level, and this cannot be put right by tightening the error criteria or by other arrangements such as selecting the method of numerical integration.This regime of absolutely incorrect behavior of the model, which can be regarded as balancing between the correct behavior and the stick effect, is rather uncomfortable because it can be detected only via a rigorous analysis, for example, by comparing the simulation results with the analytic solution, provided it is exceptionally available or, for example, by establishing that the model behavior violates the general fingerprints of the memristor.
The above facts together with the other findings that window functions of the Joglekar, Prodromakis, and mostly rectangular type are in principle potential sources of the stick effect or nonconvergence, lead unavoidably to the idea of replacing the relevant models of the ideal generic memristors by other models that might not use the window functions at all, and that would not suffer from the above shortcomings.
The paper proposes a novel method of modeling ideal generic memristors which does away with the drawbacks of the window methods and provides correct results also in extremely hard switching regimes, eliminating the stick effect.The ideological starting point of this method was published by the two of us (DB and ZB) in [43]: Every ideal generic memristor can be characterized by an algebraic transitional function between the so-called native (charge or flux) and the physical (e.g.boundary position of the TiO 2 memristor) state variable whose form is unambiguously related to the corresponding window function.From a more complex point of view, this transitional func-tion was also introduced in the excellent work [45].We have shown in [43] that, for a simple case of the transitional function of the Joglekar window with p = 1, an analytical formula exists in the form of sigmoidal (logistic) function.Then the model will exhibit a correct behavior if this function is used instead of the classical approach with the Joglekar window.
The paper follows this idea with the aim of extending the technique of "sigmoidal" modeling to all possible types of ideal generic memristors, regardless of the type of their window functions or their transitional characteristics, and regardless of whether the analytic form of these characteristics exists or not.The final objective is to put this method into common practice of computer modeling of ideal generic memristors wherever the unreliable window-based models are currently utilized.These objectives are achieved in four steps: 1) The terms native and physical state variables are defined, and the boundaries between ideal memristor [2], ideal generic memristor [42], and memristive system [46] are recalled.2) The risk of the window techniques being a hidden source of fatal numerical errors, devaluing the simulation results, is illustrated.
3) A method of modeling ideal generic memristors, removing problem No 2), is suggested.4) The respective source codes for the users of SPICE-family programs are released.
Although the paper focuses on the modeling of ideal generic memristors, the analysis of the reasons of fatal malfunction of some currently used models can become a starting point for similar analyses of the behavior of models of general memristive systems in the environment of numerical simulation programs [44].

Fatal Malfunction of Classical Window-based Model of TiO 2 Memristor: A Demonstration
The example of a fatal malfunction of the model of HP memristor described in [41] was concerned with the simple Joglekar window for p = 1.We demonstrate below that the breakdown can also turn up for other window functions that are considered to be resistant to numerical errors.Prodromakis window is selected in this section for such a demonstration.
Figure 1 shows the well-known simple model of the HP memristor with the modeling of the nonlinear dopant drift via the window function f(x), where 0 ≤ x ≤ 1 is the normalized width of the doped TiO 2 layer [43].
Figure 2 illustrates the results of the PSpice analysis, using the Prodromakis window with p = 10 [17], for an amplitude 0.25 mA of sinusoidal 1 Hz excitation, and for the model parameters specified in Appendix 1.As is obvious from the figure, the model exhibits the well-known fingerprints of the ideal generic memristor, namely:  hysteresis loop is pinched at the v-i origin and it is oddsymmetric.2. The memristor passes immediately to the periodical steady state [47].
Figure 3 presents the simulation results for an increased amplitude of 1 mA.The violation of the fingerprint of immediate transition to periodical steady state is obvious at first glance.It follows from the waveform of the state variable the state variable does not return back to the initial state x 0 = 0.5 after the first repeating period of the driving signal but is instead attracted to the limiting state x = 0.As a consequence of this incorrect behavior of the model during the first repeating period, the waveforms at all consecutive time instants are evaluated erroneously.The periodical steady state, computed from such a model, then may have nothing to do with the correct result.In fact, the correct behavior of the model from Fig. 1 is quite different, as will be shown later in Sec.6 (see Fig. 9).
The analysis of such cases given in [41] reveals the cause of the malfunction of the numerical model: at a certain time instant, due to numerical errors which are generated via a co-action of the rounding errors and the method of modeling the integrator according to Fig. 1, the state variable of the memristor stops moving despite the fact that the native state variables [43], the charge and the flux, vary in time.The state variable x stops near a level that fundamentally limits its motion (x = 1 in our case).In this way, a shift arises between the actual and the simulated operating point of the memristor.If the signal driving the memristor reaches the values that unstick the state variable x from the fixed level, then the state continues moving from the incorrect operating point, which makes the simulated waveform of the state variable and all the signals derived from it inaccurate.This error can be affected to a certain extent via tweaking the parameters of the model and the analysis but it cannot be fully suppressed.
The prime cause of the given incorrect behavior of the model can be perceived as the split between the fundamental non-limitation of the motion of native state variables (charge and flux) of ideal memristor, and the fundamental limitation of the corresponding physical state variables [43] (x in the above case) of ideal generic memristor, which is given by actually existing limits (for example 0 ≤ x ≤ 1).By virtue of the numerical errors, the causal relation between the native and the physical state variable is cut off in the proximity of the boundary states of the variable x, which harms the numerical solution.Since the window functions are directly designed to model the bounded physical state variables, their use is the main cause of the incorrect behavior of the given models, particularly under hard-switching regimes.The key to the construction of reliably working models of ideal generic memristors is giving up the window technique and eliminating the physical, bounded-value state variables from the process of the numerical integration of the differential equations of memristors.
Let us note, for the sake of completeness, that if the experiment from Fig. 3 is repeated using the rectangular window (the corresponding source code is also given in Appendix 1), the well-known stick effect appears.In other words, the model fails as well.

Native and Physical State Variables of Memristor
It is obvious from the classical definition of the memristor [42] controlled by the charge q or by the flux that the memristor represents state-dependent Ohm's law between voltage v and current i whereas the state variable is either charge (time-domain integral of current) or flux (time-domain integral of terminal voltage).Let us recall two facts in this respect: 1) The memristance R mem or memductance G mem depends only on the state variables and not on instantaneous values of voltage and current.2) The flux  (flux linkage) has, in general, nothing to do with the magnetic flux [48].

Time 0s
1.0s 2.0s 3.0s 4.0s 5.0s 1.0s 2.0s 3.0s 4.0s 5.0s Simulation results of the model from Fig. 1 for I max = 0.25 mA: v-i odd-symmetric pinched hysteresis loop, periodical waveform of state variable, the corresponding voltage and current waveforms (immediate transition to periodical steady state).The model exhibits the well-known fingerprints of ideal memristor.A number of theoretical pieces of knowledge follow from definitions (1)-( 4), for example that the memristor is unambiguously determined by the dependence of its parameter on the state variable (PSM = Parameter vs. State map R mem (q) or G mem ()) or by the equivalent constitutive relation (CR)  = (q) or q = q(), whereas its memristance or memductance is given by the flux derivative with respect to charge or the charge derivative with respect to flux.Also the well-known memristor fingerprints [42], [43], [47], [49] result from these definitions.
The memristors defined above will be thereinafter denoted as ideal memristors.From the technical point of view, the term "ideal" is redundant because memristor defined in such a way is in itself an ideal hypothetical element.On the other hand, it may contribute to a more distinct interpretation, because today the term memristor also includes more general memristive systems that need not exhibit some attributes of ideal memristors.Such memristive systems are denoted in [42] as extended memristors.The current-or voltage-controlled memristive system is defined by equations of the type [42]  ) , ( v g dt where x is the vector of state variables while f and g are, in general, nonlinear functions.The memristive system cannot be generally characterized by the above constitutive relations or PSMs.Also, some fingerprints of ideal memristors do not apply there, for example the fingerprints on the symmetric pinched hysteresis loops [50] or on the immediate transition to periodical steady state [47]. The term "generic memristor", introduced by L. Chua in [42], supplements the pair "ideal memristor" and "memristive system" = "extended memristor".The port and state equations of the general memristive system controlled by current ( 5), (6) or voltage (7), (8) are specified for generic memristors as follows [42]: ) , ( i f dt Ideal generic memristors form an important subset of generic memristors.Their memristance or memductance depends on a scalar state variable x, whose derivative is directly proportional to current or voltage: or In contrast to (2) or (4), this model makes use of a different state variable than the charge or flux (for example the boundary position in the TiO 2 memristor), exhibiting, none the less, all the external manifestations and fingerprints of the ideal memristor.From the mathematical point of view, the ideal generic memristor is a memristor whose port and state equation can be converted via state variable transformation into a form that would correspond to (1), ( 2) or (3), (4).Among other things, it means that the ideal generic memristor and also the ideal memristor can be defined by the CR and PSM characteristics.
Distinguishing between the ideal generic memristor and the more general memristive system can be essential for the construction of the model of currently existing object, exhibiting memristive behavior, and for its effective implementation in the simulation program.In the first case, the model must exhibit all the fingerprints of ideal memristor, and every deviation from this paradigm behavior is an easily detectable failure of the model in the software environment.The connections between the ideal memristor and ideal generic memristor are summarized below.
To control its parameter (the memristance or memductance) the ideal memristor uses the state variable of the type of charge or flux, denoted in [43] as native state variable.Nevertheless, the axiomatic definitions ( 1)-( 4) do not solve the question of the physical implementation of memristor memory, i.e. the way of accumulating the native state variable according to state equations ( 2) and ( 4).These equations describe an ideal integration of current into charge or voltage into flux, without modeling the currently existing limits.From this point of view, the ideal memristor is thus an element with unbounded memory.
The existing systems with memristive properties use physical-chemical processes for the accumulation of the memory.The measure of the memory effect can be quantified via a concrete state variable which is naturally bounded in value.Let us call it the physical state variable.For the simple model [1] of the HP memristor, this variable can be the width of the doped layer, which must not exceed the total width of the TiO 2 layer or, for example, it can be the normalized width with the upper limit 1. Memristance can also be used as the physical state variable if a one-toone relation exists between the memristance and the width of the layer.The memristance bounded in values, as a state variable, is used, for example, to model the threshold-type bipolar memristive system [44], [51], [52].The crystalline fraction, bounded within the limits 0 and 1, is one of the physical state variables for modeling the phase change memory (PCM) cells [32].In the memristive system of the type of Insulator-to-Metal Transition [33], the measure of the memory effect is modeled by the state variable called metallic phase fraction, which is also naturally bounded in values.A similar bounded variable -volume fraction -is used in [34] for modeling the tantalum-dioxide memristors.The well-known memristive Hodgkin-Huxley model of the axon [53], [54] contains a couple of memristive systems, denoted Potassium memristor and Sodium Ion-Channel memristor.The state variable of the first one is the potassium gate-activation variable within a range from 0 to 1.The sodium channel is modeled by a two-dimensional memristive system, whose two dimensionless state variables are also bounded within the limits from 0 to 1.
For the model of a real memristive system whose internal state is modeled via a physical, not native state variable to be denoted as the model of ideal generic memristor, it must exhibit, the same as ideal memristor, an "infinite memory depth".This can be theoretically achieved if a one-to-one relationship exists between the native (unbounded in values) and physical (bounded in values) state variables.To put it simply, the value of the physical state variable follows unambiguously from the value of the natural state variable and vice versa.In reality, this theoretically unambiguous relationship will be violated by the effect of the "finite resolution" of the physical state variable in the proximity of its limiting values (noise in the case of real systems, numerical errors in computer simulations).
In the following, an alternative way of modeling the ideal generic memristor will also be analyzed: The generator of the native state variable (the integrator of the current generating the charge or the integrator of the voltage generating the flux) can be a part of the model.This variable is then transformed via a nonlinear noninertial block into the corresponding physical state variable.In such a case, the model behaves as an ideal memristor with infinite memory depth (= ideal integrator as a part of the model) regardless of the (non)existence of a one-to-one correspondence between the native and the physical state variables.

Ideal Generic Memristor
Consider the following special forms of ( 5)-( 8) of one-dimensional current-or voltage-controlled memristive systems: or The port equations ( 17) and ( 19) formally correspond to (1) and (3) of the ideal memristor (the parameter of the element only depends on the state variable, not on the voltage or current), while the state equations seemingly do not.
The state equation ( 18) can be modified to the form The condition f(x) ≠ 0 follows from the mathematical formalism though, but it also has its physical reasons.According to (18), the derivative of the state variable would be zero for f(x) = 0, which would mean that the system would have no possibility to extricate itself from this state.It is the well-known stick effect which accompanies the improper modeling of memristive systems.
The right-side nonlinear function f(x) in ( 18) thus determines the slopes of the transitional functions between the physical and the native state variables for a given x.
After integrating both sides of (21) we get Consider that x is a physical state variable limited within the interval x min -x max .Denote as F(x) the primitive function of the integrand 1/f(x) on the left side of (23) on the interval x min ≤ x ≤ x max .Then where C is a constant of integration.Equation ( 24) can be read with the help of Fig. 4 (a).
The curve of the graph of the primitive function can be moved vertically by changing the constant of integration C such that its point of intersection with the axis q = 0 determines the initial value of the physical state variable x 0 .Then, based on the curve, and knowing the deflection of x from x 0 , one can read the charge that passed through the memristor and thus caused this deflection.
Knowing the function f(x) in the state equation (18), one can derive the primitive function F(x) and perform the transformation of the physical state variable x into the native state variable q.In other words, this transformation converts the state equation ( 18) into the state equation (2) of ideal memristor, and the memristive system (17), (18) can be declared an ideal generic memristor.However, the necessary condition is the one-to-one transformation: different states of the native state variables q 1 ≠ q 2 must be assigned to two different states x 1 ≠ x 2 from the interval [x min , x max ]. .This condition also implies the existence of the one-to-one function FI(q), which is the inverse of the primitive function F(x).Note that FI(q) reflects the causal dependence of the physical state variable on the native state variable, see Fig. 4 (b).
The dot-and-dash curves in Fig. 4 correspond to the case when the physical state variable achieves its limit value for a finite value of the native state variable.Then the function FI(q) is not a one-to-one function, and the change of the native state variable does not cause any change of the physical state variable.Since in actually existing systems, in contrast to the state variable x, the native state variable is not stored in any manner, such systems lose the attribute of unlimited memory, and their models therefore do not behave as ideal generic memristors.As shown in [41], this is the reason for the fatal malfunction of some currently used memristor models x 0 q x=FI(q) x min Fig. 4. The function for transforming the physical (x) to the native (q) state variable of ideal generic memristor (a), and its inverse (b) [43].The dot-and-dash curves are not a one-to-one map and thus they do not correspond to ideal generic memristor 1 .
implemented in the simulation programs, where the physical state variable is subject to a finite precision of the number representation in the program environment.

are equations of current-or voltage-controlled ideal generic memristor if the primitive function to the function 1/f(x) or 1/g(x) is oneto-one on the interval [x min , x max ]. Then this function and its inverse can be used for a mutual transformation between physical and native state variables of the memristor.
One of the fingerprints of ideal generic memristor (17), (18), or (19), (20), can be simply formulated as follows: Proposition 2.

Every change of the native state variable causes a change of the physical state variable.
1 With the exception specified at the end of Sec. 3.
The above stick effect is a typical consequence of violating this rule.
Recall that the above Propositions hold for the models (17), (18), or (19), (20) of ideal generic memristor, i.e. on the assumption that the computation of the native state variable from the current or voltage is not part of the model (see also the note at the end of Sec. 3).

Examples of Systems That Are (Not) Ideal Generic Memristors (a) HP memristor with linear dopant drift
The well-known simple physical model of the TiO 2 memristor from [1], [14] is described as state-dependent Ohm's law (17), with the memristance R mem where x  [0,1] is the normalized width of the doped TiO 2 layer, and R off and R on are the limiting memristance values.
The speed of the boundary between the doped and undoped layers is described by a simplified state equation [14] where i is the element current, and k is a technological constant.
A comparison of ( 26) and (18) confirms that it is a model of ideal generic memristor.There is a linear relationship between the physical and the native state variables because f(x) = k and, according to (22), dx = k dq.Equation ( 24) can be written as According to (27), the physical state variable x is not bounded in values, which is in conflict with its fundamental limitation within the range [0,1].It is a price to be paid for the simplification of the model of dynamics (26).The model holds only for an admissible range of the state variable.
The state equation ( 26) is completed by the so-called window function f w (x), which models slow-down of the boundary motion in the proximity of the limit positions x = 0 and x = 1: It holds for the Joglekar window Increasing the integer p from 0, the shape of the window can be modified up to the rectangular type (for p  ).The window curve is symmetric with respect to the vertical line x = 0.5.For x = 0.5, the function (29) reaches its maximum value (one) for all p.
The Prodromakis window is defined as [17]     2 2 w ( ) 1 ( 0.5) 0.75 1 1 (30) The parameter j can adjust an arbitrary maximum value f wmax of (30).This window also provides symmetry with respect to the vertical line x = 0.5, with the maximum at this point.The condition f w (0.5) = f wmax yields max 1 0.75 Comparing ( 28) and ( 18), we get For clarity, let us denote where w ( ) ( ) is a function associated with the concrete window function f w (x), and C w = kC is the constant of integration (see (24)).The function F w (x) is thus used to transform the normalized physical state variable x into the normalized native state variable The model (28) will be the ideal generic memristor if the function f w (x) complies with Proposition 1, namely, if the function It holds for the Joglekar window [22] w w 2 For given arguments and for x  (0,1), the Gauss hypergeometric function 2 F 1 [a,b,c,d] can be expressed as an infinite series from (36).For p = 1, the result can be simplified to the form w w 1 ( ) ln 4 1 and for p = 2   , x  (0,1).
(38) For higher p, the notation of F w (x) in terms of the elemental functions becomes rather unclear.Then the numerical computation of hypergeometric function can be preferable.Examples of the curves for C w = 0 in Fig. 5 correspond to one-to-one functions.The model employing the Joglekar window is therefore an ideal generic memristor.
The inverse functions FI w ( ) for a direct transformation of normalized native state variable into physical state variable can also be found.For p = 1 (see (37)), FI w ( ) can be expressed as a simple analytical formula: The corresponding graph is the well-known logistic curve [55].The graphs of the inverse functions FI w ( ) originate from the graphs in Fig. 5 via swapping the axes, thus they are not given here.
For p > 1, the inverse function FI w ( ) cannot be explicitly derived via elemental functions, and numerical computation should be applied.
Note that if the physical state variable x was set exactly to one of its limit values x = 0 or x = 1, the model would lose its ability to behave as ideal generic memristor.An exact solution of the state equation ( 28) for the initial state x 0  (0,1) cannot lead to such conditions though.However, this does not apply to the numerical solution which proceeds in the software environment with finiteprecision arithmetic.
For the Prodromakis window, the analytic expression of the function F w (x) for a general parameter p is tedious.For p = 1 we get and for p = 2 The numerical computation is useful for a general parameter p.The corresponding curves for several parameters p are shown in Fig. 6.The parameter j from (31) was selected for each value of p such that f wmax = 1.Comparing (40) and (37) yields that the transforming functions F w (x) for p = 1 are the same for the Joglekar and the Prodromakis windows if j = 4, thus f wmax = 1.It is in conformity with the knowledge that both windows are identical under these conditions.The differences for p > 1 are already obvious.It follows from Fig. 6 that, compared to the Joglekar window, the parameter p for the Prodromakis window must be higher in order to achieve a similar behavior of F w (x).It is related to the fact that the slope of the Prodromakis window at boundary points x = 0 and x = 1 for a given p and for f wmax = 1 is only one quarter of the slope of the Joglekar window.
The given model of the memristive system employing the Prodromakis window with finite value of p is therefore a model of ideal generic memristor.
The corresponding window functions depend not only on the state variable x but also on the current or voltage, depending on whether the memristive system is controlled by the current or voltage.The state equation for currentcontrolled system is then in the general form w ( , ) Such memristive systems cannot be therefore ideal generic memristors.(d) Some models of memristive switching devices It follows from a comparison of the port and the state equations of several other known models of memristive systems with ( 17)- (20) and Propositions 1 and 2 that, for example, the Lehtonen and Laiho model [28], Pickett model [27], TEAM model [18], Ielmini [56], [57] and Miranda [58] filament model, and other hardware-correlated models [24] are not models of ideal generic memristors.Some of the above models can behave as ideal generic memristors under special conditions.For example, the memductance of the Lehtonen model [28] practically does not depend on the terminal voltage if this voltage is maintained near zero.As follows from the state equation of the model where a is a fitting constant, f w is the window function, q is a positive odd integer, the additional condition q = 1 must be also fulfilled in order to consider this model an ideal generic memristor.
(e) Spin-valve magnetic domain-wall memristor An example of a long spin-valve structure with domain wall motion in the free layer is published in [36].The resistance depends on the domain-wall position x: where D is the free-layer length, R L and R H are the minimum and the maximum limits of the resistance.The speed of the domain wall is directly proportional to the current: where  is a proportionality constant.
It is obvious that the model is analogous to the model of the HP memristor with linear dopant drift, and that it is a model of ideal generic memristor.This model is specified in [59] into the form of a second-order memristive system, which is no longer an ideal generic memristor.

(f) Hydraulic memristor
The hydraulic memristor according to Fig. 7 is described in [43].A part of the liquid flowing through a conic profile tube rotates a propeller.The propeller moves a plug in the direction of the flowing liquid.The active cross-area and thus also the hydraulic resistance change depending on the plug position.It is shown in [43] that the analogy of Ohm's law holds for such a system where p is the difference between the pressures at the ends of the tube, i is the liquid rate, and R M is the hydraulic resistance, which depends on the normalized position of the plug x = w/w max  [0,1] (see Fig. 7) according to the formula The a and b parameters depend on the system geometry and on the liquid viscosity as described in [43].
The state equation is in the form where the parameters A > 0, B > 0 depend on the geometry according to [43].This equation is in the form of (18).The corresponding function F(x) for transforming the physical state variable x into the native state variable q (integral of the liquid speed, thus the distance) is Fig. 7. Example of a hydraulic memristor [43].Propeller is led by a threaded rod.It is driven by liquid flow and moves between terminal positions w = 0 and w = w max .
Since F(x) is a one-to-one function for 0 ≤ x ≤ 1 and for all positive A, B, this system is a hydraulic ideal generic memristor.

Reliable Models of Ideal Generic Memristors Employing PNSM
Reliable modeling of ideal generic memristors proposed hereinafter is based on replacing the problematic window functions by another functions x = FI(x N ) for a direct transformation of the native state variable x N into the physical state variable x, or by the functions x = FI w ( N x ), where N x is the normalized native state variable.Note that the function FI w ( ) can be derived, where appropriate, from the corresponding window function f w ( ) of ideal generic memristor.
Since the function FI serves to the unambiguous transformation of the native-to-physical state variable, it can be designated, analogously to the term PSM (Parameter vs. State Map), as PNSM (Physical vs. Natural State Map).Accordingly, if an unambiguous physical-to-native state variable backward transformation existed in the form of the function x N = F(x) according to (24), then it could be denoted as NPSM (Natural vs. Physical State Map).
The block-oriented schematic of the model of currentcontrolled memristor employing PNSM is shown in Fig. 8.A dual version holds for the voltage-controlled memristor.The differential equation of the model is trivial: the chargecurrent relationship is computed numerically via a simple integration.Such a numerical computation is not burdened with the numerical problem resulting from the limitation of the physical state variable.The physical state variable is then computed from the native variable via nonlinear algebraic transformation in the PNSM block.
As follows from Fig. 8, the function FI( ) or FI w ( ) is used for native-to-physical variable transform.The function F( ) for backward physical-to-native transform (NPSM) is not necessary.It is of practical importance because the model from Fig. 8 will reliably exhibit all the fingerprints of ideal memristor even in the limiting cases from Figs. 5 and 6 and also for p  .Recall that the latter case corresponds to the classical rectangular window, where the function F( ) in terminal states is not defined, but the domain of the function FI( ) is the set of all real numbers (see the note at the end of Sec. 3).
The memristor from Fig. 1 with the Prodromakis window for p = 10 and with the simulation parameters from Fig. 3 was modeled via the procedure from Fig. 8.The corresponding transforming function FI w ( ) for the Prodromakis window was sampled and modeled in PSpice using a look-up table (see the function TABLE in Appen-dix 2).The source code in Appendix 2 also contains the corresponding conversion from the charge to the normalized charge which appears in the mathematical model of the function FI w ( ).
The results of the respective simulations in Fig. 9 show the signs of correct behavior of the ideal generic memristor.Comparing them with Fig. 3, which summarizes the preceding simulation of the same memristor, but with the application of the classical method of windowing, one can observe great differences.The window-based method provided correct results of the transient analysis only up to the time instant when, due to numerical problems, the state of the physical variable was erroneously fixed.The behavior of the classical model in Fig. 3 in the subsequent periodical steady state does not match the reality.

PNSM Approximation
It turned out that the function FI w ( ) for normalized native-to-physical state variable transform could serve as a useful replacement of the classical window function for more reliable memristor modeling.It was shown in Sec.6 that such a function can be modeled in SPICE as a look-up table.However, in some cases it can be more advantageous to model this function by an analytic formula, analogously to the classical window functions.While the window function can be considered an approximation of the ideal rectangular window, the transforming function FI w ( ) is an approximation of the dashed piece-wise-linear function in Fig. 10.An approximation function is sought that is strictly monotonic, passes through the point [q ̅ , x] = [0, 0.5] with the slope dx/dq ̅ = 1, converges to 1 or 0 for the native state variable tending to +∞ or -∞, and matches the approximated curve to a degree that can be controlled by an independent parameter.
Recall that the piece-wise-linear transforming function in Fig. 10 corresponds to the ideal rectangular window.It originates via integrating the difference of shifted step functions with respect to the independent variable q .The step function ) (q  can be approximated by the sigmoidal function for the parameter a > 0. The step function is acquired for a  ∞.For the sake of a good approximation of the above difference of shifted step functions, it is necessary to select a sufficiently high value of the parameter a, ca a > 10. The integration of the difference of shifted sigmoidal functions leads to the analytic formula of the normalized PNSM The corresponding graphs for various parameters a are in Fig. 10.In terms of the numerical aspects of the computations, it is not suitable to select the parameter a too high (max.ca 100) in view of the risk of overflowing the numeric format (Double-precision binary floating-point, ca 10 308 ) [44].The function for a  ∞, corresponding to the rectangular window, can easily be programmed in PSpice with the help of the function TABLE, as shown in Appendix 2.

Treatment of Initial Conditions
The initial value of the memristance or, more generally, the initial value of the physical state variable from which the memristance can be calculated, serves as one of the input parameters of the transient analysis of circuits that contain memristors.However, since the differential equation for the native, not physical state variable is solved numerically as part of the PNSM method, it is necessary to enter the initial value of the native variable.It would be possible to convert it from the physical initial state via the transforming function F w ( ).However, this function may not be available because the PNSM method is built on the utilization of its inverse FI w ( ).Knowing the initial value of the physical state variable x 0 and also the model of the function FI w ( ), then, in order to compute the corresponding initial state 0 q , one row must be added to the SPICE netlist which defines the controlled source Eq0 in Fig. 11.Its voltage is defined such that it is equal to the normalized native state variable 0 q .In this way, SPICE finds the sought value via one iteration run of the numerical solution [43].Then the initial value 0 q is used, along with the waveform of the native state variable generated by numerical integration, for computing the waveform of the physical state variable according to Fig. 11.x(t)= FI w ( q(t)+q 0 ) = FI w ( kq(t)+q 0 ) -0.5 q 0 x 0 q(t) q0

Eq0
FIw(V(q0)) -x0 + V(q0) = V(q0) 0 Fig. 11.Explanation as to the SPICE computation of the initial value of the native state variable from the physical state variable.The initial value of the native state variable 0 q is determined by numerical computation of the voltage of auxiliary source Eq0.

Conclusions
The results of the paper can be summarized in two conclusions: 1) The window functions for modeling ideal generic memristors are potential sources of an unacceptable behavior of the models, particularly in the proximity of the terminal states of the memristance.Since these problems appear due to the nature of modeling the rate of the change of the physical state variable versus its distance from its terminal states, they cannot be completely removed other than by refraining from using the window functions.
2) An alternative method of modeling ideal generic memristors is described which does not use the window functions and therefore it does not suffer from the problems under 1).
In the paper it is proposed to use the nonlinear transforming functions between the native and the physical state variables of the memristor (PNSM -Physical vs. Native State Map) instead of the window functions used up to now.There is an unambiguous relation (33) between the two characteristics (excepting the additive constant of integration, which can be set, for example, to zero).Compared with the window functions, the PNSM characteristic brings significant advantages, namely eliminating the stick effect as well as the apparent (nonconvergence) or hidden (incorrect solutions) problems that frequently bother the SPICE users when simulating the circuits containing memristors.
Lists of working input files containing benchmark models of the well-known HP memristor (Appendix 1classical window-based modeling, Appendix 2 -the proposed method) are available for readers from the SPICE community with the prospect of quickly mastering such an effective method.

Fig. 1 .
Fig. 1.Demonstration of the behavior of the memristor driven by sinusoidal current.The memristive port A-B is modeled by the equation R M(x) = R off -(R off -R on )x,where x is a state variable whose derivative with respect to time is proportional to the port current and the nonlinear function of state f(x).Concrete model parameters are given in SPICE code in Appendix 1.

Fig. 3 .
Fig. 3. Simulation results of the model from Fig. 1 for I max = 1 mA: gradually forming v-i pinched hysteresis loops, waveform of state variable, voltage and current exhibit initial transients.The model violates the wellknown fingerprints of ideal memristor.

Fig. 5 .
Fig. 5.The function F w (x), C w = 0, for transforming between normalized physical and native state variables of ideal generic memristor with the Joglekar window for various parameters p.The limit case p   corresponds to rectangular window, where the condition of one-to-one function is violated at points x = 0 and x = 1.

Fig. 6 .
Fig. 6.The function F w (x), C w = 0, for transforming between normalized physical and native state variables of ideal generic memristor with the Prodromakis window for various parameters p and for f wmax = 1.

Fig. 8 .Fig. 9 .
Fig. 8. Block schematic of the modeling via PNSM (Physical vs. Native State Map).The current is integrated into the charge (native state variable).The PNSM block transforms, by nonlinear function, the native state variable into the physical state variable.The latter is then used for computing the memristance in the PSM block (Parameter vs. State Map).The memristor voltage is computed as a product of the memristance and the current.

5 Fig. 10 .
Fig. 10.Normalized PNSM for various values of the parameter a in the approximation formula (50).

Figure 11
Figure 11 illustrates a possible solution of this problem.