Documentation / LearningLemur

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • WirisQuizzes

      • LearningLemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Miscellaneous

                      • Wiris Integrations

                        • Home
                        • LearningLemur
                        • Using LearningLemur
                        • Advanced Logic in LearningLemur
                        • Advanced Logic in LearningLemur

                        Understanding Advanced Logic in LearningLemur

                        Reading time: 2min

                        Advanced Logic in LearningLemur allows you to generate dynamic mathematical questions using controlled randomization, conditional rules, loops, and custom functions. It enables teachers to create robust, reusable question templates that automatically produce multiple valid variations while preserving pedagogical intent.

                        What It Is

                        Advanced Logic is the rule-based engine that powers dynamic question generation in LearningLemur. Instead of manually writing each question variation, you define:

                        • Variables
                        • Mathematical relationships
                        • Conditions
                        • Constraints

                        The system then automatically generates consistent, mathematically valid problem instances. Advanced Logic is conceptually similar to using a lightweight programming language inside your question. It supports:

                        • Random value generation
                        • Conditional statements
                        • Loops
                        • Mathematical functions
                        • Vector and matrix operations
                        • Custom function definitions

                        It is designed specifically for educational use, not general-purpose programming.

                        Why It Matters

                        Without Advanced Logic, teachers would need to:

                        • Manually create multiple versions of the same exercise
                        • Risk inconsistent difficulty between variations
                        • Lose control over edge cases (e.g., irrational roots, invalid fractions, non-unique systems)

                        Advanced Logic solves these problems by allowing you to:

                        • Control mathematical properties (e.g., "solutions must be integers")
                        • Avoid undesired outcomes (e.g., zero denominators, non-square discriminants)
                        • Guarantee pedagogical constraints
                        • Scale a single question into unlimited variants

                        This increases question quality, reduces repetition, and improves assessment fairness.

                        How It Works

                        Advanced Logic executes in stages when a question is generated.

                        Stage 1: Variable Initialization

                        The system evaluates all variable definitions in the algorithm section. Example conceptual actions:

                        • Generate random numbers
                        • Define sets
                        • Initialize matrices or vectors

                        All variables are computed before the question is rendered.

                        Stage 2: Constraint Enforcement

                        If your logic includes loops or conditions, the system ensures that mathematical constraints are satisfied. Common mechanisms include:

                        • while loops
                        • repeat…until loops
                        • Logical conditions (&&, ||)

                        If a condition is not met, the system regenerates values until the constraint is satisfied. This is how you guarantee properties such as:

                        • Coprime numbers
                        • Perfect square discriminants
                        • Non-zero determinants

                        Stage 3: Derived Calculations

                        Once valid variables are established, dependent values are computed. Examples:

                        • Computing solutions
                        • Building matrices
                        • Calculating right-hand side vectors

                        These derived variables are typically used for grading or answer validation.

                        Stage 4: Rendering and Grading

                        After all logic is evaluated:

                        • The question statement is rendered using computed variables
                        • Student responses are compared against the defined solution logic
                        • Grading rules are applied

                        The logic is executed on the server and is not visible to students.

                        Key Rules or Behaviours

                        • Logic is executed before the question is displayed
                        • All constraints must terminate — infinite loops will prevent question generation
                        • Variables defined later in the algorithm can depend on earlier ones
                        • Zero exclusion syntax (e.g., /[0]) prevents invalid mathematical cases
                        • Deterministic logic produces reproducible results per attempt

                        Examples

                        Example 1: Controlled Random Fractions

                        You generate two fractions but enforce coprime numerator/denominator pairs. Result: Fractions are always irreducible.

                        Example 2: Guaranteed Integer Solutions

                        You first define a solution vector and then compute the coefficients backward. Result: The generated system always has the intended solution.

                        Common Misunderstandings

                        Misconception: Advanced Logic is programming

                        Clarification: It uses programming-like syntax, but its purpose is mathematical control, not software development.

                        Misconception: Random automatically means unpredictable

                        Clarification: Random values can be fully controlled through constraints and validation loops.

                        Misconception: Loops are risky

                        Clarification: Loops are safe when intervals are properly designed, and termination conditions are guaranteed.

                        Related Concepts

                        • Common Patterns and Best Practices
                        • Advanced Logic Examples in LearningLemur
                        • Glossary of Commands

                        Was this article helpful?

                        Yes
                        No
                        Give feedback about this article

                        Related Articles

                        • Programming
                        • Improvements

                        Understanding Advanced Logic in LearningLemur

                        What It Is Why It Matters How It Works Stage 1: Variable Initialization Stage 2: Constraint Enforcement Stage 3: Derived Calculations Stage 4: Rendering and Grading Key Rules or Behaviours Examples Example 1: Controlled Random Fractions Example 2: Guaranteed Integer Solutions Common Misunderstandings Misconception: Advanced Logic is programming Misconception: Random automatically means unpredictable Misconception: Loops are risky Related Concepts

                        Making people’s STEM work more meaningful

                        MathType

                        • MathType for Office Tools
                        • MathType for Mac
                        • MathType for Microsoft 365
                        • MathType for Google Workspace
                        • MathType for LMS
                        • MathType for XML Editors
                        • Arabic notation
                        • Our products accessibility
                        • MathType is online

                        WirisQuizzes

                        Learning Lemur

                        Solutions for Education

                        • Blackboard Learn
                        • Brightspace by D2L
                        • Canvas
                        • Google Classroom
                        • Moodle
                        • Schoology

                        Solutions for Publishing Houses

                        Solutions for Technical Writers

                        Solutions for Chemistry

                        Integrations

                        • HTML Editors
                        • MathType in WordPress

                        Pricing

                        Company

                        Careers

                        Blog

                        Contact Us

                        Buy Now

                        Plugin Downloads

                        © Wiris 2025

                        • Cookie Settings
                        • Cookie Policy
                        • Terms of Use
                        • Privacy Policy / GDPR
                        • Student Data Privacy
                        • Compliance
                        • Powered by Helpjuice
                        Expand