[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-86058-en":3,"doc-seo-86058-105":28,"detail-sidebar-cat-0-en-105":89},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":4,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":11,"language":21,"language_code":22,"site_id":23,"html_lang":22,"table_of_contents":24,"faqs":25,"seo_title":13,"seo_description":14,"update_tm":26,"read_time":27},86058,687197207057,"Sage","https://ap-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0",8,"Research & Report","Structure-Preserving Neural ODEs via Nonstandard Finite Difference Discretization","Neural ordinary differential equations (NODEs) can learn continuous-time dynamics but often fail to preserve key qualitative properties such as positivity. A structure-preserving Neural ODE framework is proposed using nonstandard finite difference (NSFD) discretization. The learned dynamics are parameterized by nonnegative production and destruction rates, producing an explicit differentiable update compatible with automatic differentiation. The method unconditionally preserves positivity for any time step while keeping first-order consistency, and is extended with Patankar-type discretizations to preserve conservation laws exactly. Experiments on an SIR epidemic model yield physically meaningful, robust trajectories and improved structure preservation over conventional NODEs.","arXiv :2607 . 10858v1 [math .NA] 12 Jul 2026  \nStructure-Preserving Neural ODEs via Nonstandard Finite  \nDiﬀerence Discretization  \nAchraf Zinihia,b , Matthias Ehrhardta,∗, Moulay Rchid Sidi Ammib  \na University of Wuppertal, Applied and Computational Mathematics,  \nGaußstrasse 20, 42119 Wuppertal, Germany  \nbMoulay Ismail University of Meknes, FST Errachidia,  \nDepartment of Mathematics, AMNEA Group, Errachidia 52000, Morocco  \nAbstract  \nAlthough neural ordinary diﬀerential equations (NODEs) are a powerful framework for learning continuous-time dynamics, they generally do not preserve essential qualitative properties, such as positivity. We propose a structure-preserving Neural ODE framework based on nonstandard ﬁnite diﬀerence (NSFD) discretization. The learned dynamics are parameterized by nonnegative production and destruction rates, yielding an explicit, diﬀerentiable update that integrates seamlessly into standard automatic diﬀerentiation pipelines. We prove that the resulting scheme unconditionally preserves positivity for arbitrary time-step sizes while retaining ﬁrst-order consistency. We outline an extension based on Patankar-type discretizations that preserves conservation laws exactly. Numerical experiments on an SIR epidemic model show that our approach generates physically meaningful trajectories, remains robust under coarse discretizations, and outperforms conventional NODEs in preserving the qualitative structure of the learned dynamics.  \nKeywords: Neural ODEs, NSFD schemes, Positivity preservation, Structure-preserving discretization, Scientiﬁc machine learning  \n2020 Mathematics Subject Classiﬁcation: 65L05, 65L20, 68T07, 92D30  \n1. Introduction  \nNeural ODEs [1] parameterize the right-hand side of an initial value problem x˙ = fθ (x, t) by a neural network fθ and treat the network as an implicit, continuous-depth model that is ﬁt to data by diﬀerentiating through a numerical ODE solver. This formulation is advantageous for learning the latent dynamics of physical and biological systems, including epidemic models, because it preserves the continuous-time structure of the underlying phenomenon rather than treating time as a discrete, recurrent index. However, in these applications, the  \n∗ Corresponding author  \nEmail addresses: [a.zinihi@edu.umi.ac.ma](a.zinihi@edu.umi.ac.ma) (Achraf Zinihi), [ehrhardt@uni-wuppertal.de](ehrhardt@uni-wuppertal.de) (Matthias  \nEhrhardt), [rachidsidiammi@yahoo.fr](rachidsidiammi@yahoo.fr) (Moulay Rchid Sidi Ammi)  \nstate variables usually have a physical meaning, such as compartment sizes, concentrations, or population counts, and they must remain nonnegative. Often, they also satisfy additional invariants, such as a constant total population. A generic fθ provides no such guarantee: nothing in the training objective prevents the learned ﬂow from producing negative states, particularly under extrapolation or coarse time stepping, and the standard remedies (clipping, penalty terms for constraint violations, or projection back onto the feasible region after each solver step) are post-hoc corrections rather than structural guarantees. Furthermore, these remedies can also introduce non-smoothness or bias into the learned dynamics.  \nA separate line of work in numerical analysis, dating back to [2] and rigorously developed by [3] and many others (see [4] and the references therein for recent high-order constructions), shows that nonstandard ﬁnite diﬀerence (NSFD) schemes can be designed so that the discrete scheme preserves the positivity, boundedness, and other qualitative features of a continuous dynamical system for every step size, not just for a step size below some stability threshold. The central device is a nonlocal treatment of the right-hand side, along with a generalized, model-dependent denominator function that replaces ∆t. This approach has been applied extensively to compartmental epidemic models with prescribed (not learned) right-hand sides [5] . In the NODE litera","cbCaibCDpdvo1YYi","https://ap.wps.com/l/cbCaibCDpdvo1YYi","pdf",193010,1,"English","en",105,"# 1. Introduction\n# 2. Gain-Loss Neural ODEs\n# 3. NSFD Update and Unconditional Positivity\n# 4. Patankar-Type Conservation-Preserving Extension\n# 5. Numerical Experiments on SIR","[{\"question\":\"Why do standard Neural ODEs fail to guarantee nonnegative states?\",\"answer\":\"Standard NODE training does not prevent the learned vector field from producing negative states, especially under extrapolation or coarse time stepping. Remedies like clipping or projection are post-hoc and lack structural guarantees.\"},{\"question\":\"How does the proposed method enforce positivity unconditionally?\",\"answer\":\"It constrains the NODE vector field into a gain/loss (production/destruction) form and couples it with an NSFD time-stepping rule. The resulting update preserves positivity for arbitrary time-step sizes while remaining first-order consistent.\"},{\"question\":\"What is the role of the Patankar-type extension in the framework?\",\"answer\":\"It extends the gain/loss parameterization into a flux-based Patankar-type discretization to preserve conservation laws exactly. This targets invariants beyond positivity in the learned dynamics.\"}]",1784208155,20,{"code":4,"msg":29,"data":30},"ok",{"site_id":23,"language":22,"slug":31,"title":13,"keywords":32,"description":14,"schema_data":33,"social_meta":84,"head_meta":86,"extra_data":88,"updated_unix":26},"structure-preserving-neural-odes-via-nonstandard-finite-difference-discretization","",{"@graph":34,"@context":83},[35,52,66],{"@type":36,"itemListElement":37},"BreadcrumbList",[38,42,46,49],{"item":39,"name":40,"@type":41,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":43,"name":44,"@type":41,"position":45},"https://docshare.wps.com/document/","Document",2,{"item":47,"name":12,"@type":41,"position":48},"https://docshare.wps.com/document/research-report/",3,{"item":50,"name":13,"@type":41,"position":51},"https://docshare.wps.com/document/structure-preserving-neural-odes-via-nonstandard-finite-difference-discretization/86058/",4,{"url":50,"name":13,"@type":53,"author":54,"headline":13,"publisher":56,"fileFormat":59,"inLanguage":22,"description":14,"dateModified":60,"datePublished":60,"encodingFormat":59,"isAccessibleForFree":61,"interactionStatistic":62},"DigitalDocument",{"name":9,"@type":55},"Person",{"url":39,"name":57,"@type":58},"DocShare","Organization","application/pdf","2026-07-16",true,{"@type":63,"interactionType":64,"userInteractionCount":4},"InteractionCounter",{"@type":65},"ViewAction",{"@type":67,"mainEntity":68},"FAQPage",[69,75,79],{"name":70,"@type":71,"acceptedAnswer":72},"Why do standard Neural ODEs fail to guarantee nonnegative states?","Question",{"text":73,"@type":74},"Standard NODE training does not prevent the learned vector field from producing negative states, especially under extrapolation or coarse time stepping. Remedies like clipping or projection are post-hoc and lack structural guarantees.","Answer",{"name":76,"@type":71,"acceptedAnswer":77},"How does the proposed method enforce positivity unconditionally?",{"text":78,"@type":74},"It constrains the NODE vector field into a gain/loss (production/destruction) form and couples it with an NSFD time-stepping rule. The resulting update preserves positivity for arbitrary time-step sizes while remaining first-order consistent.",{"name":80,"@type":71,"acceptedAnswer":81},"What is the role of the Patankar-type extension in the framework?",{"text":82,"@type":74},"It extends the gain/loss parameterization into a flux-based Patankar-type discretization to preserve conservation laws exactly. This targets invariants beyond positivity in the learned dynamics.","https://schema.org",{"og:url":50,"og:type":85,"og:title":13,"og:site_name":57,"og:description":14},"article",{"robots":87,"canonical":50},"index,follow",{"doc_id":7,"site_id":23},{"code":4,"msg":5,"data":90},[91,95,99,103,108,113,118,121,125,128,132],{"id":20,"doc_module":4,"doc_module_name":44,"category_name":92,"show_sort_weight":93,"slug":94},"Story & Novel",90,"story-novel",{"id":45,"doc_module":4,"doc_module_name":44,"category_name":96,"show_sort_weight":97,"slug":98},"Literature",80,"literature",{"id":51,"doc_module":4,"doc_module_name":44,"category_name":100,"show_sort_weight":101,"slug":102},"Exam",70,"exam",{"id":104,"doc_module":4,"doc_module_name":44,"category_name":105,"show_sort_weight":106,"slug":107},5,"Comic",60,"comic",{"id":109,"doc_module":4,"doc_module_name":44,"category_name":110,"show_sort_weight":111,"slug":112},6,"Technology",50,"technology",{"id":114,"doc_module":4,"doc_module_name":44,"category_name":115,"show_sort_weight":116,"slug":117},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":44,"category_name":12,"show_sort_weight":119,"slug":120},30,"research-report",{"id":122,"doc_module":4,"doc_module_name":44,"category_name":123,"show_sort_weight":27,"slug":124},9,"Religion & Spirituality","religion-spirituality",{"id":27,"doc_module":4,"doc_module_name":44,"category_name":126,"show_sort_weight":27,"slug":127},"World Cup","world-cup",{"id":129,"doc_module":4,"doc_module_name":44,"category_name":130,"show_sort_weight":129,"slug":131},10,"Lifestyle","lifestyle",{"id":133,"doc_module":4,"doc_module_name":44,"category_name":134,"show_sort_weight":104,"slug":135},19,"General","general"]