Language model-based mathematical teaching animation generation method and system
Through a language model-based method, mathematical concepts are automatically converted into visual animations and explanatory documents, which solves the problems of high technical requirements and long production cycles for creators in existing technologies and realizes the efficient generation of high-quality mathematical teaching animations.
Patent Information
- Application Number
- CN202510773295.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-09-23
AI Technical Summary
Existing technologies for visualizing mathematical concepts have high technical requirements for creators, long production cycles, and lack of standardized and systematic methods, making it difficult to handle high-dimensional and abstract concepts.
A language model-based method is adopted to obtain mathematical concepts, classify and construct an animation template library, use the natural language model to convert it into a structured description, match the animation template and generate animation code, and perform rendering to generate mathematics teaching animation.
It lowers the technical threshold for mathematical visualization, improves creative efficiency, can handle complex and abstract mathematical concepts, and generate high-quality visual animations and explanatory documents.
Smart Images

Figure CN120689470A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence and animation generation technology, and in particular to a method and system for generating mathematics teaching animation based on a language model. Background Art
[0002] Currently, when visualizing mathematical concepts, existing methods mainly rely on manual programming and animation production. These methods have the following disadvantages: (1) they place high technical requirements on the creators, who need to master both mathematical theory and animation programming techniques; (2) they have a long production cycle, and even professionals need a lot of time to complete a high-quality mathematical concept animation; (3) they lack standardized and systematic methods, making mass production and widespread application difficult; and (4) they are difficult to handle high-dimensional and abstract mathematical concepts, especially in complex fields such as quantum field theory and optimal transport theory. Summary of the Invention
[0003] In view of the above-mentioned shortcomings of the prior art, the purpose of this application is to provide a method and system for generating mathematics teaching animation based on a language model, so as to solve the technical problems existing in the prior art.
[0004] To achieve the above-mentioned and other related purposes, the present application provides a method for generating mathematics teaching animation based on a language model, comprising the following steps:
[0005] Acquire mathematical concepts obtained in advance or in real time, classify the mathematical concepts, and construct a mathematical teaching animation template library according to the classification results;
[0006] Convert the mathematical concepts into structured descriptions using a pre-trained or real-time trained natural language model;
[0007] Matching a mathematics teaching animation template from the mathematics teaching animation template library according to the structured description, recording the matched mathematics teaching animation template as a target animation template, and generating an animation code associated with the target animation template;
[0008] The animation code is executed, and the target animation template is rendered based on the execution result of the animation code to generate a mathematics teaching animation corresponding to the target animation template.
[0009] Optionally, the process of classifying the mathematical concepts and constructing a mathematical teaching animation template library according to the classification results includes:
[0010] The mathematical concepts are classified based on feature information and visualization requirements of the mathematical concepts, and a mathematical teaching animation template library is constructed according to the classification results; wherein the feature information includes subject field, source and data size, and the mathematical teaching animation template library includes network visualization templates, training progress visualization templates, comparison scene templates, particle system templates, vector field templates and transmission templates for mathematical teaching animations, and each template in the mathematical teaching animation template library is used to form a mathematical teaching animation of one or more mathematical concepts; and
[0011] According to the type definition of the mathematical concept, visual expression rules are defined for the templates in the mathematical teaching animation template library, including: using particle systems to represent mathematical concepts that describe distribution, using vector fields and streamlines to represent mathematical concepts that describe vector fields or gradients, using nodes and connecting lines to represent mathematical concepts that describe network structures, and using parallel bar charts or regional representations to represent mathematical concepts that describe comparative relationships.
[0012] Optionally, the process of converting the mathematical concept into a structured description using a pre-trained or real-time trained natural language model includes:
[0013] A conversion engine for understanding the mathematical concepts is constructed using a pre-trained or real-time natural language model. The conversion engine includes: a task description portion, a domain constraint portion, an output format specification, and a reference example portion. The task description portion is used to indicate that the mathematical concepts are to be converted into Manim animation code; the domain constraint portion is used to limit the natural language model to focus on the visual expression of mathematical and physical concepts; the output format specification is used to define the required Python class structure, necessary import statements, and code organization; and the reference example portion is used to provide one or more conversion examples and guide the understanding of the natural language model and the expected output.
[0014] And, establish a method for identifying mathematical expressions in LaTeX format and mapping them into visual elements, including: a) using regular expressions to identify and extract LaTeX expressions in the mathematical concepts, and using regular expression patterns to match currency symbols and LaTeX expressions in the equation environment; b) classifying the extracted LaTeX expressions, wherein the classification includes scalar expressions, vector expressions, function expressions and / or matrix expressions; wherein the scalar expression is used for direct rendering using Manim's MathTex object, the vector expression is used for creating vector visualization by combining Arrow and MathTex, the function expression is used for drawing function curves using ParametricFunction or FunctionGraph, and the matrix expression is used for using Matrix type and converting to grid or transformation operations; d) processing nested expressions and complex mathematical structures to ensure the consistency and accuracy of visualization;
[0015] And, the natural language model is optimized for text description, including: e) segmenting the input text into paragraphs, identifying the topic of each paragraph, and re-ordering according to predefined priorities to ensure that the most important information is given priority; wherein, the topics include: formulas, process descriptions, definitions and contexts, and the priorities include: formulas have a higher priority than definitions, definitions have a higher priority than process descriptions, and process descriptions have a higher priority than contexts; f) using term frequency analysis and term importance scoring on the segmented text to identify the relationship between mathematical concepts and the segmented text, and the term importance scoring is calculated in the following way: term score = term frequency × domain specificity × position weight, wherein: term frequency represents the number of times the term appears in the text; domain specificity represents the domain relevance of the term, and the domain specificity is evaluated based on a predefined mathematical domain term library; position weight represents the importance of the position of the term in the text structure, and the terms in the title and the first paragraph have a higher weight.
[0016] Optionally, matching a mathematics teaching animation template from the mathematics teaching animation template library according to the structured description, recording the matched mathematics teaching animation template as a target animation template, and generating an animation code associated with the target animation template includes:
[0017] Constructing an animation code generation engine based on the structured description and converting the mathematical concept content into specific animation objects, properties and behaviors;
[0018] Obtain keywords and semantic features in the mathematical concepts, and perform mathematical teaching animation template matching from the mathematical teaching animation template library according to the keywords and the semantic features, and record the matched mathematical teaching animation template as the target animation template; there are: identifying the template type through keyword matching, and pointing to the particle system template, the keywords include "distribution", "particle", and "α"; pointing to the vector field template through vector field related terms, the vector field related terms include "gradient", "field", and "ν"; pointing to the optimal transmission template through transformation related terms, the transformation related terms include "mapping" and "transformation"; pointing to the comparison scene template through numerical comparison terms, and pointing to the network visualization template through network structure terms;
[0019] Dynamic parameter configuration is performed on the target animation template, including: initializing a basic parameter structure, wherein the basic parameters include color, position, duration, and scale; applying color mapping according to the template type corresponding to the target animation template, including assigning gradient colors from blue to gold to different distributions; setting position parameters according to spatial relationships in mathematical concept elements, including converting "left side" relationships into relative positions in a coordinate system; setting time control parameters for the animation according to a time sequence, mapping an event sequence to a preset animation time period; and returning a complete dynamic parameter configuration for use in animation generation, wherein the complete dynamic parameter configuration includes: color mapping, spatial positioning, time control, and value range.
[0020] Generate animation code associated with the target animation template and verify the animation code; including: checking whether the preset import statement exists, verifying whether the scene class construction method is complete, confirming whether all referenced objects have been defined, predicting runtime errors and providing corrections.
[0021] Optionally, the target animation template is rendered based on the execution result of the animation code to generate a mathematics teaching animation corresponding to the target animation template, including:
[0022] A 3D geometry rendering optimizer and a particle system renderer are added to a core rendering engine obtained in advance or in real time; wherein the core rendering engine is obtained based on an animation library, the 3D geometry rendering optimizer receives vertex and face data as input through a polyhedron creation function, generates a 3D polyhedron object with a custom color map, and applies different colors according to the type of face to increase the clarity of the geometric structure; the particle system renderer is used to generate various types of probability distribution visualizations, including Gaussian distribution and spiral distribution; for each distribution type, a specified number of particle points are created, and the visual effect is enhanced using randomly varying radius and opacity, and the generated particle groups are moved to specified locations;
[0023] Obtaining a rendering control system with multiple quality levels developed in advance or in real time, wherein the rendering control system is used to define a dedicated parameter configuration for each quality level, including a resolution identification configuration, a command line flag configuration, a frame rate configuration, a pixel width configuration, and a height configuration; the quality levels include a development quality level, a medium quality level, a high quality level, and an ultra-high quality level;
[0024] Based on the execution result of the animation code, the core rendering engine and the rendering control system are used to render the target animation template to generate a mathematics teaching animation corresponding to the target animation template.
[0025] Optionally, after generating the mathematics teaching animation, the method further includes:
[0026] Add glow effects to pre-set objects using pre-made or real-time glow generators, including duplicating the original object to increase size and apply gradient strokes, and creating glowing halos to visually highlight mathematical elements; and
[0027] Mapping values onto a color spectrum using a pre-or real-time color gradient mapper, including: receiving a list of values and a starting or ending color, normalizing each value in the list to the interval [0, 1], and interpolating within a specified color range to generate a color corresponding to the value size, used to represent the range of a mathematical function or the relative size of data;
[0028] Using a pre- or real-time scene complexity estimator to evaluate the computational complexity of the animation scene and provide a basis for performance optimization, the scene complexity estimator evaluates factors including the number of objects in the scene, whether it is a three-dimensional scene, the number of animation instructions, and the complexity of dynamic updates;
[0029] A rendering task allocator obtained in advance or in real time is used to allocate rendering tasks according to scene complexity and available computing resources, including: calculating the complexity score of each scene, sorting the scenes in descending order according to the complexity score, and allocating processing resources to the complex scenes based on the sorting results to ensure that the rendering tasks can utilize computing power.
[0030] Optionally, after generating the mathematics teaching animation, the method further includes:
[0031] Generate a mathematical explanation document associated with the mathematical teaching animation, and provide corresponding document templates for different types of mathematical concepts to ensure that the generated mathematical explanation document has a clear structure and matching content;
[0032] A mapping mechanism is established between the mathematical explanation document and the mathematical teaching animation. The mapping mechanism includes: extracting method functions in the animation code, analyzing the name and content of each method function, and determining the role of the corresponding method function in the mathematical concept; establishing a mapping relationship between methods and document structures, including: mapping the setting / initialization method to the introduction part, mapping the creation / display method to the key concept part, and mapping the animation / demonstration method to the visual explanation part; generating structured mapping data to guide the document generation process.
[0033] The present invention also provides a mathematics teaching animation generation system based on a language model, the system comprising:
[0034] The data set preprocessing and template construction module is used to obtain mathematical concepts obtained in advance or in real time, classify the mathematical concepts, and construct a mathematical teaching animation template library according to the classification results;
[0035] A text-to-animation description conversion engine module, configured to convert the mathematical concepts into structured descriptions using a pre-trained or real-time trained natural language model;
[0036] An animation code generation engine module is used to match a mathematics teaching animation template from the mathematics teaching animation template library according to the structured description, record the matched mathematics teaching animation template as a target animation template, and generate animation code associated with the target animation template;
[0037] The animation generation and rendering system module is used to execute the animation code, and render the target animation template based on the execution result of the animation code to generate a mathematics teaching animation corresponding to the target animation template.
[0038] Optionally, the system also includes a document generation system module, which is used to generate a mathematical explanation document associated with the mathematical teaching animation, and provide corresponding document templates for different types of mathematical concepts to ensure that the generated mathematical explanation document has a clear structure and matching content; and establish a mapping mechanism between the mathematical explanation document and the mathematical teaching animation, the mapping mechanism including: extracting method functions in the animation code, and analyzing the name and content of each method function to determine the role of the corresponding method function in the mathematical concept; establishing a mapping relationship between the method and the document structure, including: mapping the setting / initialization method to the introduction part, mapping the creation / display method to the key concept part, and mapping the animation / demonstration method to the visual explanation part; generating structured mapping data to guide the document generation process.
[0039] Optionally, the process of the text-to-animation description conversion engine module converting the mathematical concept into a structured description using a pre-trained or real-time trained natural language model includes:
[0040] A conversion engine for understanding the mathematical concepts is constructed using a pre-trained or real-time natural language model. The conversion engine includes: a task description portion, a domain constraint portion, an output format specification, and a reference example portion. The task description portion is used to indicate that the mathematical concepts are to be converted into Manim animation code; the domain constraint portion is used to limit the natural language model to focus on the visual expression of mathematical and physical concepts; the output format specification is used to define the required Python class structure, necessary import statements, and code organization; and the reference example portion is used to provide one or more conversion examples and guide the understanding of the natural language model and the expected output.
[0041] And, establish a method for identifying mathematical expressions in LaTeX format and mapping them into visual elements, including: a) using regular expressions to identify and extract LaTeX expressions in the mathematical concepts, and using regular expression patterns to match currency symbols and LaTeX expressions in the equation environment; b) classifying the extracted LaTeX expressions, wherein the classification includes scalar expressions, vector expressions, function expressions and / or matrix expressions; wherein the scalar expression is used for direct rendering using Manim's MathTex object, the vector expression is used for creating vector visualization by combining Arrow and MathTex, the function expression is used for drawing function curves using ParametricFunction or FunctionGraph, and the matrix expression is used for using Matrix type and converting to grid or transformation operations; d) processing nested expressions and complex mathematical structures to ensure the consistency and accuracy of visualization;
[0042] And, the natural language model is optimized for text description, including: e) segmenting the input text into paragraphs, identifying the topic of each paragraph, and re-ordering according to predefined priorities to ensure that the most important information is given priority; wherein, the topics include: formulas, process descriptions, definitions and contexts, and the priorities include: formulas have a higher priority than definitions, definitions have a higher priority than process descriptions, and process descriptions have a higher priority than contexts; f) using term frequency analysis and term importance scoring on the segmented text to identify the relationship between mathematical concepts and the segmented text, and the term importance scoring is calculated in the following way: term score = term frequency × domain specificity × position weight, wherein: term frequency represents the number of times the term appears in the text; domain specificity represents the domain relevance of the term, and the domain specificity is evaluated based on a predefined mathematical domain term library; position weight represents the importance of the position of the term in the text structure, and the terms in the title and the first paragraph have a higher weight.
[0043] As described above, the present application provides a method and system for generating mathematics teaching animations based on a language model, which has the following beneficial effects: the present application obtains mathematical concepts obtained in advance or in real time, and classifies the mathematical concepts, and constructs a mathematics teaching animation template library according to the classification results; then uses the natural language model trained in advance or in real time to convert the mathematical concepts into structured descriptions; at the same time, according to the structured descriptions, mathematics teaching animation templates are matched from the mathematics teaching animation template library, and the matched mathematics teaching animation templates are recorded as target animation templates, and animation codes associated with the target animation templates are generated; finally, the animation code is executed, and the target animation template is rendered based on the execution results of the animation code to generate a mathematics teaching animation corresponding to the target animation template. It can be seen from this that the present application can automatically convert mathematical concept descriptions in text form into high-quality visual animations, and generate corresponding explanatory documents at the same time, greatly reducing the technical threshold of mathematical visualization, improving creation efficiency, and being able to handle complex abstract mathematical concepts. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A flow chart of a method for generating mathematics teaching animation based on a language model provided in one embodiment of the present application;
[0045] Figure 2 This is a schematic diagram of the hardware structure of a mathematics teaching animation generation system based on a language model provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The following describes the embodiments of the present application through specific examples. Those skilled in the art can easily understand the other advantages and effects of the present application from the content disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.
[0047] It should be noted that the illustrations provided in this embodiment only illustrate the basic concept of the present application in a schematic manner. Therefore, the illustrations only show components related to the present application and are not drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component can be changed at will, and the component layout type may also be more complicated.
[0048] See also Figure 1 As shown, this embodiment provides a method for generating mathematics teaching animation based on a language model, comprising the following steps:
[0049] S110, obtaining mathematical concepts obtained in advance or in real time, classifying the mathematical concepts, and constructing a mathematical teaching animation template library according to the classification results;
[0050] S120, converts mathematical concepts into structured descriptions using pre- or real-time trained natural language models;
[0051] S130, matching a mathematics teaching animation template from a mathematics teaching animation template library according to the structured description, recording the matched mathematics teaching animation template as a target animation template, and generating an animation code associated with the target animation template;
[0052] S140 , executing the animation code, and rendering the target animation template based on the execution result of the animation code to generate a mathematics teaching animation corresponding to the target animation template.
[0053] According to the above records, in an exemplary embodiment, step S110 classifies mathematical concepts, and the process of constructing a mathematical teaching animation template library according to the classification results includes: classifying mathematical concepts based on feature information and visualization requirements of the mathematical concepts, and constructing a mathematical teaching animation template library according to the classification results; wherein the feature information includes subject area, source and data size, the mathematical teaching animation template library includes network visualization templates, training progress visualization templates, comparison scene templates, particle system templates, vector field templates and transmission templates for mathematical teaching animations, and each template in the mathematical teaching animation template library is used to form mathematical teaching animations of one or more mathematical concepts; and according to the type definition of the mathematical concepts, visual expression rules are defined for the templates in the mathematical teaching animation template library, including: using particle systems to represent mathematical concepts that describe distribution, using vector fields and streamlines to represent mathematical concepts that describe vector fields or gradients, using nodes and connecting lines to represent mathematical concepts that describe network structures, and using parallel bar charts or regional representations to represent mathematical concepts that describe comparative relationships. Specifically, this embodiment can use academic papers, textbooks, and popular science articles that contain complex mathematical and physical concepts, especially materials from advanced disciplines such as quantum electrodynamics, optimal transport theory, and the Benamou-Brenier theorem. These datasets total over 10GB of text content and cover more than 50 professional concepts in mathematics and physics.
[0054] According to the above records, in an exemplary embodiment, the process of converting mathematical concepts into structured descriptions using a pre- or real-time trained natural language model in step S120 includes: using a pre- or real-time trained natural language model to build a conversion engine for understanding mathematical concepts, the conversion engine including: a task description part, a domain constraint part, an output format specification, and a reference example part, wherein the task description part is used to indicate that mathematical concepts are converted into Manim animation code; the domain constraint part is used to limit the natural language model to focus on the visual expression of mathematical concepts and physical concepts; the output format specification is used to define the required Python class structure, necessary import statements, and code organization methods; the reference example part is used to provide one or more conversion examples and guide the understanding of the natural language model and the expected output. In addition, establish a system for identifying mathematical expressions in LaTeX format and mapping them into visual elements, including: a) using regular expressions to identify and extract LaTeX expressions in mathematical concepts, and adopting regular expression patterns to match currency symbols and LaTeX expressions in equation environments; b) classifying the extracted LaTeX expressions, which include scalar, vector, matrix, integral and differential equations; c) selecting visualization methods according to the expression type, which includes scalar expression, vector expression, function expression and / or matrix expression, among which scalar expression is used for direct rendering using Manim's MathTex object, vector expression is used to combine Arrow and MathTex to create vector visualization, function expression is used to draw function curves using ParametricFunction or FunctionGraph, and matrix expression is used to use Matrix type and convert to grid or transformation operation; d) handle nested expressions and complex mathematical structures to ensure the consistency and accuracy of visualization. In addition, the natural language model is optimized for text description, including: e) segmenting the input text into paragraphs, identifying the topic of each paragraph, and reordering according to predefined priorities to ensure that the most important information is prioritized; among them, topics include: formulas, process descriptions, definitions and contexts, and priorities include: formulas have higher priority than definitions, definitions have higher priority than process descriptions, and process descriptions have higher priority than contexts; f) using term frequency analysis and term importance scoring on the segmented text to identify the relationship between mathematical concepts and the segmented text, and the term importance scoring is calculated as follows: term score = term frequency × domain specificity × position weight, where: term frequency indicates the number of times the term appears in the text; domain specificity indicates the domain relevance of the term, and domain specificity is evaluated based on a predefined mathematical domain term library; position weight indicates the importance of the position of the term in the text structure, and terms in the title and first paragraph have higher weights.
[0055] Specifically, this embodiment can use DeepSeek AI, Google Gemini, and Grok3 models as a foundation, using prompt engineering technology to focus on understanding and converting mathematical concepts. The core prompt template of the conversion engine includes the following key components: a task description, a domain constraint, an output format specification, and a reference example. The task description clearly states that the mathematical concepts need to be converted into Manim animation code. The domain constraint is used to limit the model's focus on the visual expression of mathematical and physical concepts. The output format specification is used to define the required Python class structure, necessary import statements, and code organization. The reference example is used to provide 1-3 high-quality conversion examples to guide the model in understanding the expected output.
[0056] According to the above records, in an exemplary embodiment, step S130 matches the mathematics teaching animation template from the mathematics teaching animation template library according to the structured description, and records the matched mathematics teaching animation template as the target animation template, and the process of generating the animation code associated with the target animation template includes: constructing an animation code generation engine according to the structured description, and converting the mathematical concept content into specific animation objects, properties and behaviors; obtaining keywords and semantic features in the mathematical concepts, and matching the mathematics teaching animation template from the mathematics teaching animation template library according to the keywords and semantic features, and recording the matched mathematics teaching animation template as the target animation template; including: identifying the template type through keyword matching, and pointing to the particle system template, the keywords include "distribution", "particle", "α"; pointing to the vector field template through vector field related terms, the vector field related terms include "gradient", "field", "ν"; pointing to the optimal transmission template through transformation related terms, the transformation related terms include "mapping", "transformation"; through numerical The comparison term points to the comparison scene template, and the network structure term points to the network visualization template; the target animation template is dynamically configured with parameters, including: initializing the basic parameter structure, the basic parameters include color, position, duration and scale; applying color mapping according to the template type corresponding to the target animation template, including assigning gradient colors from blue to gold to different distributions; setting position parameters according to the spatial relationship in the mathematical concept elements, including converting the "left" relationship into a relative position in the coordinate system; setting the time control parameters of the animation according to the time series, mapping the event sequence to the preset animation time period; returning a complete dynamic parameter configuration for use in animation generation; wherein the complete dynamic parameter configuration includes: color mapping, spatial positioning, time control and numerical range; generating animation code associated with the target animation template, and verifying the animation code; including: checking whether the preset import statement exists, verifying whether the scene class construction method is complete, confirming whether all referenced objects have been defined, predicting runtime errors and providing corrections.
[0057] According to the above records, in an exemplary embodiment, step S140 renders the target animation template based on the execution result of the animation code, and the process of generating the mathematics teaching animation corresponding to the target animation template includes: adding a three-dimensional geometry rendering optimizer and a particle system renderer to the core rendering engine obtained in advance or in real time; wherein, the core rendering engine is obtained based on the animation library, and the three-dimensional geometry rendering optimizer receives vertex and face data as input through the polyhedron creation function, generates a three-dimensional polyhedron object with a custom color mapping, and applies different colors according to the type of face to increase the clarity of the geometric structure; the particle system renderer is used to generate various types of probability distribution visualizations, including Gaussian distribution and spiral distribution. distribution; for each distribution type, a specified number of particle points are created, and the visual effect is enhanced by using randomly changing radius and opacity, and the generated particle group is moved to the specified position; a rendering control system with multiple quality levels developed in advance or in real time is obtained, and the rendering control system is used to define a special parameter configuration for each quality level, including resolution identification configuration, command line flag configuration, frame rate configuration, pixel width configuration and height configuration; the quality levels include development quality level, medium quality level, high quality level and ultra-high quality level; based on the execution result of the animation code, the core rendering engine and the rendering control system are used to render the target animation template to generate the mathematics teaching animation corresponding to the target animation template.
[0058] According to the above records, in an exemplary embodiment, after generating the mathematics teaching animation, the mathematics teaching animation generation method based on the language model may further include: using a luminous effect generator obtained in advance or in real time to add a glow effect to a preset object, including: increasing the size and setting a gradient stroke effect by copying the original object, and creating a luminous halo to visually highlight the mathematical elements; and using a color gradient mapper obtained in advance or in real time to map the numerical value to the color spectrum, including: receiving a numerical value list, a starting or ending color, normalizing each numerical value in the numerical value list to the interval [0, 1], and interpolating within a specified color range to generate a color that corresponds to the numerical value size. The corresponding color is used to represent the value range of the mathematical function or the relative size of the data; the scene complexity evaluator obtained in advance or in real time is used to evaluate the computational complexity of the animation scene to provide a basis for performance optimization. The scene complexity evaluator evaluates factors including: the number of objects in the scene, whether it is a three-dimensional scene, the number of animation instructions, and the complexity of dynamic updates; the rendering task allocator obtained in advance or in real time is used to allocate rendering tasks according to the scene complexity and available computing resources, including: calculating the complexity score of each scene, and sorting it in descending order by the complexity score, and allocating processing resources to complex scenes based on the sorting results to ensure that the rendering tasks can utilize computing power.
[0059] According to the above records, in an exemplary embodiment, after generating a mathematics teaching animation, the language model-based mathematics teaching animation generation method can also include: generating a mathematics explanation document associated with the mathematics teaching animation, and providing corresponding document templates for different types of mathematical concepts to ensure that the generated mathematics explanation document has a clear structure and matching content; establishing a mapping mechanism between the mathematics explanation document and the mathematics teaching animation, the mapping mechanism including: extracting method functions in the animation code, analyzing the name and content of each method function, and determining the role of the corresponding method function in the mathematical concept; establishing a mapping relationship between the method and the document structure, including: mapping the setting / initialization method to the introduction section, mapping the creation / display method to the key concept section, and mapping the animation / demonstration method to the visual explanation section; generating structured mapping data to guide the document generation process. Specifically, the LaTeX document template structure in this embodiment includes sections such as title, introduction, mathematical foundations, key concepts, visual explanation (divided into sections by scenario), formula derivation, application, and references, and uses appropriate LaTeX packages (such as amsmath, amssymb, graphicx, etc.) to support the typesetting of complex mathematical formulas and graphics.
[0060] In summary, the present application provides a method for generating mathematical teaching animations based on a language model. The method obtains mathematical concepts obtained in advance or in real time, classifies the mathematical concepts, and constructs a mathematical teaching animation template library according to the classification results. The mathematical concepts are then converted into structured descriptions using a natural language model trained in advance or in real time. At the same time, mathematical teaching animation templates are matched from the mathematical teaching animation template library according to the structured descriptions, and the matched mathematical teaching animation templates are recorded as target animation templates, and animation code associated with the target animation templates is generated. Finally, the animation code is executed, and the target animation template is rendered based on the execution result of the animation code to generate a mathematical teaching animation corresponding to the target animation template. It can be seen that this method can automatically convert mathematical concept descriptions in text form into high-quality visual animations and generate corresponding explanatory documents at the same time, greatly reducing the technical threshold of mathematical visualization, improving creation efficiency, and being able to handle complex abstract mathematical concepts. In addition, the method proposes a high-precision multi-level cascade large language model technology architecture. DeepSeek AI, Google Gemini, and Grok3 models can be used to build a multi-level cascade architecture, and the hierarchical prompt engineering can achieve a 37% increase in the accuracy of mathematical concept recognition. Unlike traditional single-model applications, this system leverages the complementary advantages of multiple models to address the industry's difficult problem of understanding complex mathematical expressions. Specifically targeting a multi-level recursive parsing algorithm for LaTeX formulas, the accuracy rate has been increased from 78% of traditional methods to over 95%. This method also proposes adaptive dynamic template recognition and matching technology, which can be based on a template selection algorithm with a keyword-weighted scoring mechanism, supporting fuzzy semantic matching and multi-dimensional similarity calculation. Furthermore, it pioneers mathematical concept semantic feature vectorization technology, enabling automatic determination of the most appropriate visual representation. It implements an automatic expansion and evolution mechanism for the template library, extracting 3-5 new template paradigms for every 100 new mathematical concepts processed. This method also proposes an efficient matrixed LaTeX expression visualization mapping. By developing a dedicated matrixed LaTeX parsing engine that combines regular expressions and syntax analysis, it breaks through the limitations of traditional string processing and achieves formula semantic understanding through expression structure tree parsing technology. Furthermore, the visualization success rate for complex nested expressions (such as multiple integrals and tensor expressions) has increased by 48%, and the rendering speed has increased by 3 times. This method also proposes a rendering optimization technology with intelligent resource scheduling. Through a two-layer optimization system consisting of a scene complexity evaluator and a rendering task allocator, it can automatically predict rendering resource requirements based on the characteristics of mathematical concepts and achieve precise computing resource allocation. Moreover, for complex quantum field visualization containing more than 10,000 particles, the rendering time is shortened from 4 hours with traditional methods to 35 minutes.This method also proposes a document-animation collaboration technique using dual-stream parallel generation. By simultaneously generating animation code and explanatory documents, based on a shared semantic understanding layer, this technique resolves the inconsistency between animation and document in traditional approaches and establishes a precise scene-to-explanation mapping. Furthermore, the accuracy of references to animation keyframes in the document reaches 92%, and the semantic consistency between the explanatory text and visual elements is improved by 67%. This method also proposes a parameterized visual representation rule engine, a visual grammar system customized for different mathematical fields encompassing four dimensions: color, position, dynamics, and morphology. It also maps abstract mathematical concepts into standardized visual representations, building a mathematical-visual semantic bridge. It achieves a precise mapping of 15 basic mathematical concept types with 42 visual representation patterns, improving visual consistency by 85%. This method also proposes a fully automated, end-to-end generation system, enabling a seamless processing pipeline from text input to video output. Integrated error detection and self-repair mechanisms enable true "one-click" mathematical animation generation, a fully automated process requiring no human intervention. The complete processing cycle is reduced from several days in traditional methods to an average of 47 minutes, with an automatic repair success rate of 76%. This method also proposes a universal processing framework for mathematical concepts that is adaptable across disciplines. It supports a unified processing architecture across multiple disciplines, from elementary geometry to quantum field theory. It can also break through disciplinary barriers and establish a universal representation method for concepts in different mathematical fields. It has been verified to support concept visualization in 23 mathematical sub-disciplines, with a concept coverage rate more than three times that of existing systems.
[0061] In another exemplary embodiment of the present application, Figure 2 As shown, a mathematics teaching animation generation system based on a language model is provided, including:
[0062] The data set preprocessing and template construction module is used to obtain mathematical concepts obtained in advance or in real time, classify the mathematical concepts, and build a mathematical teaching animation template library based on the classification results;
[0063] A text-to-animation description conversion engine module, which is used to convert mathematical concepts into structured descriptions using pre-trained or real-time trained natural language models;
[0064] An animation code generation engine module is used to match a mathematics teaching animation template from a mathematics teaching animation template library according to the structured description, record the matched mathematics teaching animation template as a target animation template, and generate animation code associated with the target animation template;
[0065] Animation generation and rendering system module, used to execute animation code, and render the target animation template based on the execution result of the animation code, and generate the mathematics teaching animation corresponding to the target animation template;
[0066] The document generation system module is used to generate mathematical explanation documents associated with mathematical teaching animations. It provides corresponding document templates for different types of mathematical concepts, ensuring that the generated mathematical explanation documents have clear structure and matching content. Furthermore, it establishes a mapping mechanism between mathematical explanation documents and mathematical teaching animations. This mapping mechanism includes extracting method functions from the animation code, analyzing the name and content of each method function, and determining the role of the corresponding method function in the mathematical concept. It also establishes a mapping relationship between methods and document structure, including mapping setup / initialization methods to the introduction section, creation / display methods to the key concepts section, and animation / demonstration methods to the visual explanation section. Finally, it generates structured mapping data to guide the document generation process.
[0067] According to the above description, in one exemplary embodiment, the dataset preprocessing and template construction module can be divided into a first dataset mathematical concept and explanatory text dataset unit, a mathematical concept classification and template construction unit, and a visual representation rule definition unit. Specifically, for the first dataset mathematical concept and explanatory text dataset units, this embodiment uses academic papers, textbooks, and popular science articles containing complex mathematical and physical concepts, particularly materials covering advanced disciplines such as quantum electrodynamics, optimal transport theory, and the Benamou-Brenier theorem. These datasets total over 10GB of text content and cover more than 50 professional concepts in mathematics and physics.
[0068] The mathematical concept classification and template construction unit can construct an animation template library based on concept characteristics and visualization requirements. The template library constructed in this embodiment includes network visualization templates, training progress visualization templates, comparison scene templates, particle system templates, vector field templates, and optimal transmission templates. Each template is composed of well-defined parameterized scene classes and can be applied to a variety of similar mathematical concept visualizations.
[0069] For the visual representation rule definition unit, this embodiment defines visual representations for different mathematical concepts. Concepts describing distributions are represented using particle systems; concepts describing vector fields or gradients are represented using vector fields and streamlines; concepts describing network structures are represented using nodes and connecting lines; and concepts describing contrast relationships are represented using parallel bar charts or region-based representations.
[0070] According to the above description, in an exemplary embodiment, the text-to-animation description conversion engine module can be divided into a large language model application construction unit, a LaTeX parsing mechanism unit, a long text processing capability unit, a second data set mathematical concept and an explanatory text data set unit. Specifically,
[0071] This example uses DeepSeek AI, Google Gemini, and Grok3 models as the foundation for building large language model applications. Through prompt engineering, it focuses on understanding and converting mathematical concepts. The core prompt template of the conversion engine includes the following key components: a task description that explicitly states that mathematical concepts need to be converted into Manim animation code; a domain constraint that limits the model's focus to the visual expression of mathematical and physical concepts; an output format specification that defines the required Python class structure, necessary import statements, and code organization; and a reference example that provides one to three high-quality conversion examples to guide the model in understanding the desired output.
[0072] For the LaTeX parsing mechanism unit, in order to ensure that mathematical formulas can be correctly identified and converted into visual representations, this embodiment implements an algorithm that combines regular expressions and syntax analysis to identify mathematical expressions in LaTeX format and map them to appropriate visual elements. The LaTeX parsing mechanism includes the following key steps: a) Use regular expressions to identify and extract LaTeX expressions in text: the system uses regular expression patterns to match single dollar signs, double dollar signs, and LaTeX expressions in equation environments. b) Classify the extracted LaTeX expressions: scalar, vector, matrix, integral, differential equation, etc. c) Select the appropriate visualization method according to the expression type: scalar expression: direct rendering using Manim's MathTex object; vector expression: combine Arrow and MathTex to create vector visualization; function expression: use ParametricFunction or FunctionGraph to draw function curves; matrix expression: use Matrix type and may be converted to grid or transformation operations. d) Handle nested expressions and complex mathematical structures to ensure the consistency and accuracy of visualization.
[0073] For the long text processing unit, to extract key information from lengthy concept descriptions, this embodiment uses automatic segmentation and key information extraction techniques on the input mathematical description text. This technology detects mathematical terms, formulas, relationship descriptions, and dynamic changes in the text, and prioritizes this information to guide animation generation. This process includes the following algorithmic steps: a) Text segmentation algorithm: This algorithm first segments the input text into paragraphs, then identifies the topic of each paragraph (formula, definition, process description, or context), and finally reorders the paragraphs according to a predefined priority (formula > process > definition > context) to ensure that the most important information is processed first. b) Mathematical concept extraction algorithm: This algorithm uses term frequency analysis and term importance scoring on the segmented text to identify key mathematical concepts and their relationships. The term importance scoring is calculated using the following method: term score = term frequency × domain specificity × position weight; where term frequency represents the number of times a term appears in the text; domain specificity represents the domain relevance of the term, assessed based on a predefined mathematical domain terminology library; and position weight represents the importance of a term's position in the text structure, with terms in titles and first paragraphs receiving higher weights.
[0074] The mathematical concepts and explanatory text dataset units of the second data set are the same as those of the first data set, and are not described in detail here.
[0075] According to the above description, in an exemplary embodiment, the animation code generation engine module can be divided into a construction animation code generation engine unit, a template recognition and selection algorithm unit, a dynamic parameter configuration system unit and a code verification mechanism unit. Specifically,
[0076] The animation code generation engine unit is constructed based on the mathematical concept description obtained from the previous analysis. It selects an appropriate animation template and converts the concept content into specific animation objects, properties, and behaviors. The engine uses a hybrid rule-based and template-based approach to achieve the conversion from concept description to executable code.
[0077] The template identification and selection algorithm analyzes keywords and semantic features in the input text and determines the most suitable template through the following steps: Keyword matching identifies possible template types, such as "distribution," "particle," and "α," to identify particle system templates; vector field-related terms such as "gradient," "field," and "ν" to identify vector field templates; transformation-related terms such as "mapping" and "transformation" to identify optimal transport templates; numerical comparison terms to identify comparison scene templates; and network structure terms to identify network visualization templates. Specifically, a list of keywords is defined for each template, and the number of occurrences of these keywords in the input text is calculated as a match score. Finally, the template with the highest score is selected as the basis for animation generation. If all templates have a score of zero, the particle system template is used by default.
[0078] For the dynamic parameter configuration system unit, appropriate parameters are provided for the generated animation code, including color mapping, spatial positioning, time control, and value range, to ensure the scientific accuracy and visual beauty of the animation. The system adopts a parameter mapping algorithm, which mainly includes the following configuration steps: 1. Initialize the basic parameter structure, including settings such as color, position, duration, and scale; 2. Apply specific color mapping according to the template type: for example, in the particle system template, a gradient from blue to gold is assigned to different distributions; 3. Set position parameters according to the spatial relationship in the conceptual elements: for example, convert the "left" relationship into a relative position in the coordinate system; 4. Set the time control parameters of the animation according to the time sequence: map the event sequence to the appropriate animation time period; 5. Return the complete parameter configuration for use in animation generation.
[0079] Regarding the code verification mechanism unit, to ensure that the generated animation code can be executed correctly, this embodiment implements a set of code verification mechanisms to perform syntax checking and pre-runtime testing on the generated Manim code, including: checking the existence of necessary import statements, verifying the completeness of the scene class constructor, confirming that all referenced objects have been defined, predicting possible runtime errors and providing corrections. The core implementation of this verification mechanism adopts the following verification process: first, a verification result data structure is created to record the validity status and various errors of the code; then, necessary import statements (such as manim and numpy) are checked; then, the existence of the scene class constructor is verified; then, variable definitions and references in the code are analyzed to detect undefined variables; finally, potential logical errors are checked, such as the lack of waiting time in animation, and corresponding correction suggestions are given.
[0080] According to the above description, in an exemplary embodiment, the animation generation and rendering system module can be divided into a Manim rendering unit, a multi-quality level rendering control unit, a special effect enhancement system unit and a rendering performance optimization unit. Specifically,
[0081] For the Manim rendering unit, this embodiment uses the Manim library as the core rendering engine, which is optimized for the visualization of complex mathematical concepts and supports 3D rendering, perspective control, color gradient and special effects processing. In order to enhance the rendering effect, the following specialized renderer components are implemented: a) 3D geometry rendering optimizer: for efficient rendering of complex geometries (such as Rhombicosidodecahedron). This component receives vertex and face data as input through an optimized polyhedron creation function, generates a 3D polyhedron object with a custom color map, and can apply different colors according to the type of face (such as triangle, quadrilateral, pentagon, etc.) to make the structure of complex geometries clearer. b) Particle system renderer: used for the visualization of probability distribution and statistical models. This component can generate various types of probability distribution visualizations, including Gaussian distribution and spiral distribution. For each distribution type, the system creates a specified number of particle points, uses randomly changing radius and opacity to enhance the visual effect, and finally moves the generated particle group to the specified position.
[0082] The render control system supports multiple quality levels, from low-resolution quick previews to high-resolution final output, including 480p (development), 720p (medium quality), 1080p (high quality), and 4K (ultra-high quality). Each quality level is configured with dedicated parameters, including resolution identifiers, command-line flags, frame rate, and pixel width and height, allowing users to flexibly select the rendering quality they need.
[0083] For the special effects enhancement system unit, visual effects are added to the generated animation to enhance the expressiveness, including glow effects, depth of field control, motion blur and color gradients, which are particularly suitable for the visualization of quantum field theory, complex geometries and dynamic systems. The system contains the following core effect generators: a) Glow effect generator: adds a glow effect to key objects. This function creates a soft glow halo by copying the original object, increasing its size and setting a gradient stroke effect, making the key mathematical elements more visually prominent. b) Color gradient mapper: maps numerical values to the color spectrum. This function receives a list of numerical values and a start / end color, normalizes each numerical value to the [0,1] interval, and then interpolates within the specified color range to generate a color corresponding to the numerical value size. It is suitable for representing the value range of a mathematical function or the relative size of data.
[0084] For the rendering performance optimization unit, the rendering efficiency of complex scenes is improved by implementing an intelligent caching system and parallel rendering technology. This is especially effective for scenes containing a large number of particles or complex 3D objects. The rendering performance optimization system includes the following key components: a) Scene complexity evaluator: Evaluates the computational complexity of the animation scene to provide a basis for performance optimization. The evaluator takes into account the following factors: the number of objects in the scene (such as points, lines, circles, etc.), whether it is a 3D scene (the complexity coefficient of a 3D scene is doubled), the number of animation instructions, and the complexity of dynamic updates (such as scenes using UpdateFromFunc or always_redraw). b) Rendering task allocator: Allocates rendering tasks based on scene complexity and available computing resources. This component first calculates the complexity score of each scene, then sorts it in descending order of complexity, allocates more processing resources to complex scenes, and ensures that rendering tasks can efficiently utilize available computing power.
[0085] According to the above description, in an exemplary embodiment, the document generation system module can be divided into a digital interpretation document automatic generation unit, a LaTeX document template system unit, and an animation and document correspondence management system unit. Specifically,
[0086] For the automatic generation of mathematical explanation documents, the system can simultaneously generate animation code and detailed mathematical explanation documents based on the same input text. This technology adopts a dual-stream generation method and uses specialized prompt templates to guide a large language model to generate document content suitable for academic use.
[0087] The LaTeX document template system provides specialized document templates for different types of mathematical concepts, ensuring that the generated explanatory documents have a clear structure and professional content. The LaTeX document template structure in this embodiment includes sections such as title, introduction, mathematical foundations, key concepts, visual explanation (divided into sections by scenario), formula derivation, application, and references. Appropriate LaTeX packages (such as amsmath, amssymb, and graphicx) are used to support the typesetting of complex mathematical formulas and graphics.
[0088] The animation-document correspondence management system provides detailed explanations in the documentation for each key scene in the animation, helping viewers understand the mathematical concepts presented. This system is implemented through the following mapping mechanisms: 1. Extracting key methods (functions) from the animation code; 2. Analyzing the name and content of each method to determine its role in the mathematical concept; 3. Establishing a mapping relationship between methods and document structure, such as mapping setup / initialization methods to the introduction section, creation / display methods to the key concepts section, and animation / demonstration methods to the visual explanation section; and 4. Generating structured mapping data to guide the document generation process.
[0089] Based on the above description, as an example, input "demonstrate a square rotating 90 degrees clockwise around its center" into the mathematics teaching animation generation system, and the system automatically generates a rotation animation and marks the rotation angle. As another example, input "draw the intersection of the functions y = sin (x) and y = cos (x) from 0 to 2π", and the system outputs a dynamic intersection tracking animation. As an example, the test case: 50 instructions generate an animation, taking an average of 20 seconds, with an instruction parsing accuracy of 88%. As an example, performance optimization: reduce code generation time by preloading commonly used templates.
[0090] In summary, the present application provides a mathematical teaching animation generation system based on a language model, which obtains mathematical concepts obtained in advance or in real time, classifies the mathematical concepts, and constructs a mathematical teaching animation template library according to the classification results; then uses the natural language model trained in advance or in real time to convert the mathematical concepts into structured descriptions; at the same time, mathematical teaching animation templates are matched from the mathematical teaching animation template library according to the structured descriptions, and the matched mathematical teaching animation templates are recorded as target animation templates, and animation code associated with the target animation templates is generated; finally, the animation code is executed, and the target animation template is rendered based on the execution result of the animation code to generate a mathematical teaching animation corresponding to the target animation template. It can be seen that this method can automatically convert mathematical concept descriptions in text form into high-quality visual animations and generate corresponding explanatory documents at the same time, greatly reducing the technical threshold of mathematical visualization, improving creation efficiency, and being able to handle complex abstract mathematical concepts. In addition, this method proposes a high-precision multi-level cascade large language model technology architecture, which can use DeepSeek AI, Google Gemini and Grok3 models to build a multi-level cascade architecture, and achieve a 37% increase in the accuracy of mathematical concept recognition through hierarchical prompt engineering. Unlike traditional single-model applications, this system leverages the complementary advantages of multiple models to address the industry's difficult problem of understanding complex mathematical expressions. Specifically targeting a multi-level recursive parsing algorithm for LaTeX formulas, the accuracy rate has been increased from 78% of traditional methods to over 95%. This method also proposes adaptive dynamic template recognition and matching technology, which can be based on a template selection algorithm with a keyword-weighted scoring mechanism, supporting fuzzy semantic matching and multi-dimensional similarity calculation. Furthermore, it pioneers mathematical concept semantic feature vectorization technology, enabling automatic determination of the most appropriate visual representation. It implements an automatic expansion and evolution mechanism for the template library, extracting 3-5 new template paradigms for every 100 new mathematical concepts processed. This method also proposes an efficient matrixed LaTeX expression visualization mapping. By developing a dedicated matrixed LaTeX parsing engine that combines regular expressions and syntax analysis, it breaks through the limitations of traditional string processing and achieves formula semantic understanding through expression structure tree parsing technology. Furthermore, the visualization success rate for complex nested expressions (such as multiple integrals and tensor expressions) has increased by 48%, and the rendering speed has increased by 3 times. This method also proposes a rendering optimization technology with intelligent resource scheduling. Through a two-layer optimization system consisting of a scene complexity evaluator and a rendering task allocator, it can automatically predict rendering resource requirements based on the characteristics of mathematical concepts and achieve precise computing resource allocation. Moreover, for complex quantum field visualization containing more than 10,000 particles, the rendering time is shortened from 4 hours with traditional methods to 35 minutes.This method also proposes a document-animation collaboration technique using dual-stream parallel generation. By simultaneously generating animation code and explanatory documents, based on a shared semantic understanding layer, this technique resolves the inconsistency between animation and document in traditional approaches and establishes a precise scene-to-explanation mapping. Furthermore, the accuracy of references to animation keyframes in the document reaches 92%, and the semantic consistency between the explanatory text and visual elements is improved by 67%. This method also proposes a parameterized visual representation rule engine, a visual grammar system customized for different mathematical fields encompassing four dimensions: color, position, dynamics, and morphology. It also maps abstract mathematical concepts into standardized visual representations, building a mathematical-visual semantic bridge. It achieves a precise mapping of 15 basic mathematical concept types with 42 visual representation patterns, improving visual consistency by 85%. This method also proposes a fully automated, end-to-end generation system, enabling a seamless processing pipeline from text input to video output. Integrated error detection and self-repair mechanisms enable true "one-click" mathematical animation generation, a fully automated process requiring no human intervention. The complete processing cycle is reduced from several days in traditional methods to an average of 47 minutes, with an automatic repair success rate of 76%. This method also proposes a universal processing framework for mathematical concepts that is adaptable across disciplines. It supports a unified processing architecture across multiple disciplines, from elementary geometry to quantum field theory. It can also break through disciplinary barriers and establish a universal representation method for concepts in different mathematical fields. It has been verified to support concept visualization in 23 mathematical sub-disciplines, with a concept coverage rate more than three times that of existing systems.
[0091] It should be noted that the language model-based mathematics teaching animation generation system provided in the above embodiment and the language model-based mathematics teaching animation generation method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here. In actual application, the language model-based mathematics teaching animation generation system provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the system into different functional modules to complete all or part of the functions described above, which is not limited here. Therefore, the present application effectively overcomes the various shortcomings in the prior art and has a high industrial utilization value.
[0092] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical concepts disclosed in this application shall be covered by the claims of this application.
[0093] The structures, proportions, sizes, etc. illustrated in the drawings in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by those familiar with this technology. They are not intended to limit the conditions for implementation of this application and therefore have no substantial technical significance. Any structural modifications, changes in proportional relationships, or adjustments in size should still fall within the scope of the technical contents disclosed in this application without affecting the effects and objectives that can be achieved by this application. At the same time, terms such as "upper," "lower," "left," "right," "center," and "one" cited in this specification are only for the convenience of description and are not intended to limit the scope of implementation of this application. Changes or adjustments in their relative relationships should also be considered as the scope of implementation of this application without substantially changing the technical contents.
Claims
1. A method for generating mathematics teaching animation based on a language model, characterized in that: The method comprises the following steps: Acquire mathematical concepts obtained in advance or in real time, classify the mathematical concepts, and construct a mathematical teaching animation template library according to the classification results; Convert the mathematical concepts into structured descriptions using a pre-trained or real-time trained natural language model; Matching a mathematics teaching animation template from the mathematics teaching animation template library according to the structured description, recording the matched mathematics teaching animation template as a target animation template, and generating an animation code associated with the target animation template; The animation code is executed, and the target animation template is rendered based on the execution result of the animation code to generate a mathematics teaching animation corresponding to the target animation template.
2. The method for generating mathematics teaching animation based on language model according to claim 1, characterized in that: The process of classifying the mathematical concepts and constructing a mathematical teaching animation template library according to the classification results includes: The mathematical concepts are classified based on feature information and visualization requirements of the mathematical concepts, and a mathematical teaching animation template library is constructed according to the classification results; wherein the feature information includes subject field, source and data size, and the mathematical teaching animation template library includes network visualization templates, training progress visualization templates, comparison scene templates, particle system templates, vector field templates and transmission templates for mathematical teaching animations, and each template in the mathematical teaching animation template library is used to form a mathematical teaching animation of one or more mathematical concepts; and According to the type definition of the mathematical concept, visual expression rules are defined for the templates in the mathematical teaching animation template library, including: using particle systems to represent mathematical concepts that describe distribution, using vector fields and streamlines to represent mathematical concepts that describe vector fields or gradients, using nodes and connecting lines to represent mathematical concepts that describe network structures, and using parallel bar charts or regional representations to represent mathematical concepts that describe comparative relationships.
3. The method for generating mathematics teaching animation based on language model according to claim 1, characterized in that: The process of converting the mathematical concepts into structured descriptions using a pre-trained or real-time trained natural language model includes: A conversion engine for understanding the mathematical concepts is constructed using a pre-trained or real-time natural language model. The conversion engine includes: a task description portion, a domain constraint portion, an output format specification, and a reference example portion. The task description portion is used to indicate that the mathematical concepts are to be converted into Manim animation code; the domain constraint portion is used to limit the natural language model to focus on the visual expression of mathematical and physical concepts; the output format specification is used to define the required Python class structure, necessary import statements, and code organization; and the reference example portion is used to provide one or more conversion examples and guide the understanding of the natural language model and the expected output. And, establish a method for identifying mathematical expressions in LaTeX format and mapping them into visual elements, including: a) using regular expressions to identify and extract LaTeX expressions in the mathematical concepts, and using regular expression patterns to match currency symbols and LaTeX expressions in the equation environment; b) classifying the extracted LaTeX expressions, wherein the classification includes scalar expressions, vector expressions, function expressions and / or matrix expressions; wherein the scalar expression is used for direct rendering using Manim's MathTex object, the vector expression is used for creating vector visualization by combining Arrow and MathTex, the function expression is used for drawing function curves using ParametricFunction or FunctionGraph, and the matrix expression is used for using Matrix type and converting to grid or transformation operations; d) processing nested expressions and complex mathematical structures to ensure the consistency and accuracy of visualization; And, the natural language model is optimized for text description, including: e) segmenting the input text into paragraphs, identifying the topic of each paragraph, and re-ordering according to predefined priorities to ensure that the most important information is given priority; wherein, the topics include: formulas, process descriptions, definitions and contexts, and the priorities include: formulas have a higher priority than definitions, definitions have a higher priority than process descriptions, and process descriptions have a higher priority than contexts; f) using term frequency analysis and term importance scoring on the segmented text to identify the relationship between mathematical concepts and the segmented text, and the term importance scoring is calculated in the following way: term score = term frequency × domain specificity × position weight, wherein: term frequency represents the number of times the term appears in the text; domain specificity represents the domain relevance of the term, and the domain specificity is evaluated based on a predefined mathematical domain term library; position weight represents the importance of the position of the term in the text structure, and the terms in the title and the first paragraph have a higher weight.
4. The method for generating mathematics teaching animation based on language model according to claim 1, characterized in that: The process of matching a mathematics teaching animation template from the mathematics teaching animation template library according to the structured description, recording the matched mathematics teaching animation template as a target animation template, and generating an animation code associated with the target animation template includes: Constructing an animation code generation engine based on the structured description and converting the mathematical concept content into specific animation objects, properties and behaviors; Obtain keywords and semantic features in the mathematical concepts, and perform mathematical teaching animation template matching from the mathematical teaching animation template library according to the keywords and the semantic features, and record the matched mathematical teaching animation template as the target animation template; there are: identifying the template type through keyword matching and pointing to the particle system template, the keywords include "distribution", "particle", and "α"; pointing to the vector field template through vector field related terms, the vector field related terms include "gradient", "field", and "ν"; pointing to the optimal transmission template through transformation related terms, the transformation related terms include "mapping" and "transformation"; pointing to the comparison scene template through numerical comparison terms, and pointing to the network visualization template through network structure terms; Dynamic parameter configuration is performed on the target animation template, including: initializing a basic parameter structure, wherein the basic parameters include color, position, duration, and scale; applying color mapping according to the template type corresponding to the target animation template, including assigning gradient colors from blue to gold to different distributions; setting position parameters according to spatial relationships in mathematical concept elements, including converting "left" relationships into relative positions in a coordinate system; setting time control parameters for the animation according to a time sequence, mapping an event sequence to a preset animation time period; and returning a complete dynamic parameter configuration for use in animation generation, wherein the complete dynamic parameter configuration includes: color mapping, spatial positioning, time control, and value range. Generate animation code associated with the target animation template and verify the animation code; including: checking whether the preset import statement exists, verifying whether the scene class construction method is complete, confirming whether all referenced objects have been defined, predicting runtime errors and providing corrections.
5. The method for generating mathematics teaching animation based on language model according to claim 1, characterized in that: The target animation template is rendered based on the execution result of the animation code to generate a mathematics teaching animation corresponding to the target animation template, including: A 3D geometry rendering optimizer and a particle system renderer are added to a core rendering engine obtained in advance or in real time; wherein the core rendering engine is obtained based on an animation library, the 3D geometry rendering optimizer receives vertex and face data as input through a polyhedron creation function, generates a 3D polyhedron object with a custom color map, and applies different colors according to the type of face to increase the clarity of the geometric structure; the particle system renderer is used to generate various types of probability distribution visualizations, including Gaussian distribution and spiral distribution; for each distribution type, a specified number of particle points are created, and the visual effect is enhanced using randomly varying radius and opacity, and the generated particle groups are moved to specified positions; Obtaining a rendering control system with multiple quality levels developed in advance or in real time, wherein the rendering control system is used to define a dedicated parameter configuration for each quality level, including a resolution identification configuration, a command line flag configuration, a frame rate configuration, a pixel width configuration, and a height configuration; the quality levels include a development quality level, a medium quality level, a high quality level, and an ultra-high quality level; Based on the execution result of the animation code, the core rendering engine and the rendering control system are used to render the target animation template to generate a mathematics teaching animation corresponding to the target animation template.
6. The method for generating mathematics teaching animation based on language model according to claim 5, characterized in that: After generating the mathematics teaching animation, the method further includes: Add glow effects to pre-set objects using pre-made or real-time glow generators, including duplicating the original object to increase size and apply gradient strokes, and creating glowing halos to visually highlight mathematical elements; and Mapping values onto a color spectrum using a pre-or real-time color gradient mapper, including: receiving a list of values and a starting or ending color, normalizing each value in the list to the interval [0, 1], and interpolating within a specified color range to generate a color corresponding to the value size, used to represent the range of a mathematical function or the relative size of data; Using a pre- or real-time scene complexity estimator to evaluate the computational complexity of the animation scene and provide a basis for performance optimization, the scene complexity estimator evaluates factors including the number of objects in the scene, whether it is a three-dimensional scene, the number of animation instructions, and the complexity of dynamic updates; A rendering task allocator obtained in advance or in real time is used to allocate rendering tasks according to scene complexity and available computing resources, including: calculating the complexity score of each scene, sorting the scenes in descending order according to the complexity score, and allocating processing resources to the complex scenes based on the sorting results to ensure that the rendering tasks can utilize computing power.
7. The method for generating mathematics teaching animation based on language model according to claim 1, 5 or 6, characterized in that: After generating the mathematics teaching animation, the method further includes: Generate a mathematical explanation document associated with the mathematical teaching animation, and provide corresponding document templates for different types of mathematical concepts to ensure that the generated mathematical explanation document has a clear structure and matching content; A mapping mechanism is established between the mathematical explanation document and the mathematical teaching animation. The mapping mechanism includes: extracting method functions in the animation code, analyzing the name and content of each method function, and determining the role of the corresponding method function in the mathematical concept; establishing a mapping relationship between methods and document structures, including: mapping the setting / initialization method to the introduction part, mapping the creation / display method to the key concept part, and mapping the animation / demonstration method to the visual explanation part; generating structured mapping data to guide the document generation process.
8. A mathematics teaching animation generation system based on language model, characterized in that: The system includes: The data set preprocessing and template construction module is used to obtain mathematical concepts obtained in advance or in real time, classify the mathematical concepts, and construct a mathematical teaching animation template library according to the classification results; A text-to-animation description conversion engine module, configured to convert the mathematical concepts into structured descriptions using a pre-trained or real-time trained natural language model; An animation code generation engine module is used to match a mathematics teaching animation template from the mathematics teaching animation template library according to the structured description, record the matched mathematics teaching animation template as a target animation template, and generate animation code associated with the target animation template; The animation generation and rendering system module is used to execute the animation code, and render the target animation template based on the execution result of the animation code to generate a mathematics teaching animation corresponding to the target animation template.
9. The mathematics teaching animation generation system based on language model according to claim 8 is characterized in that: The system also includes a document generation system module for generating a mathematical explanation document associated with the mathematical teaching animation and providing corresponding document templates for different types of mathematical concepts to ensure that the generated mathematical explanation document has a clear structure and matching content; In addition, a mapping mechanism is established between the mathematical explanation document and the mathematical teaching animation. The mapping mechanism includes: extracting method functions in the animation code, analyzing the name and content of each method function, and determining the role of the corresponding method function in the mathematical concept; establishing a mapping relationship between methods and document structures, including: mapping the setting / initialization method to the introduction part, mapping the creation / display method to the key concept part, and mapping the animation / demonstration method to the visual explanation part; generating structured mapping data to guide the document generation process.
10. The mathematics teaching animation generation system based on language model according to claim 8 is characterized in that: The process of the text-to-animation description conversion engine module converting the mathematical concept into a structured description using a pre-trained or real-time trained natural language model includes: A conversion engine for understanding the mathematical concepts is constructed using a pre-trained or real-time natural language model. The conversion engine includes: a task description portion, a domain constraint portion, an output format specification, and a reference example portion. The task description portion is used to indicate that the mathematical concepts are to be converted into Manim animation code; the domain constraint portion is used to limit the natural language model to focus on the visual expression of mathematical and physical concepts; the output format specification is used to define the required Python class structure, necessary import statements, and code organization; and the reference example portion is used to provide one or more conversion examples and guide the understanding of the natural language model and the expected output. And, establish a method for identifying mathematical expressions in LaTeX format and mapping them into visual elements, including: a) using regular expressions to identify and extract LaTeX expressions in the mathematical concepts, and using regular expression patterns to match currency symbols and LaTeX expressions in the equation environment; b) classifying the extracted LaTeX expressions, wherein the classification includes scalar expressions, vector expressions, function expressions and / or matrix expressions; wherein the scalar expression is used for direct rendering using Manim's MathTex object, the vector expression is used for creating vector visualization by combining Arrow and MathTex, the function expression is used for drawing function curves using ParametricFunction or FunctionGraph, and the matrix expression is used for using Matrix type and converting to grid or transformation operations; d) processing nested expressions and complex mathematical structures to ensure the consistency and accuracy of visualization; And, the natural language model is optimized for text description, including: e) segmenting the input text into paragraphs, identifying the topic of each paragraph, and re-ordering according to predefined priorities to ensure that the most important information is given priority; wherein, the topics include: formulas, process descriptions, definitions and contexts, and the priorities include: formulas have a higher priority than definitions, definitions have a higher priority than process descriptions, and process descriptions have a higher priority than contexts; f) using term frequency analysis and term importance scoring on the segmented text to identify the relationship between mathematical concepts and the segmented text, and the term importance scoring is calculated in the following way: term score = term frequency × domain specificity × position weight, wherein: term frequency represents the number of times the term appears in the text; domain specificity represents the domain relevance of the term, and the domain specificity is evaluated based on a predefined mathematical domain term library; position weight represents the importance of the position of the term in the text structure, and the terms in the title and the first paragraph have a higher weight.