SimpleMath Script SimpleMath is a programming script with a syntax similar to JavaScript, but extremely simplified to support only number and boolean types. SimpleMath is to be used only for Function Calculator . Here are the key features and rules: Variables Declare variables using the 'var' keyword: var a; var b = 3; Assign values to variables: a = b; a = 3 + b; Variables follow strict scope rules similar to java. Variable should be declared first using 'var' keyword. Without decalaration it can not be used. Data Types Only two data types: number and boolean Types are inferred, not specified Number literals: Any numeric value Boolean literals: true or false Collection data structures such as array or list are not supported. Only single data type number and boolean are supported. SimpleMath does not have "null" or "undefined" unlike javascript. When null or undefined value needs to be returned in a function you can return very unlikely number such...
How Deep Is the Well? Exploring Physics with Code Have you ever dropped a rock into a well and wondered how deep it is? The sound of the splash echoes back, but how can we calculate the depth without physically measuring it? Let’s dive into the fascinating world of physics and programming to solve this age-old question using Function Calculator. The Science Behind It When you drop an object into a well, two key events occur: The Fall : The object falls under the influence of gravity, accelerating as it goes. The Sound : After hitting the water, the sound of the splash travels back up to you. By combining these two events, we can calculate the depth of the well using basic physics. The total time t (the time it takes for you to hear the splash) is a combination of: The time it takes for the object to fall (fallTime). The time it takes for the sound to travel back up ( soundTime ). Using these principles, we can derive a quadratic equation to calculate the depth. The Fo...
How to move disks in Hanoi tower : programming example Welcome to the blog post where we showcase the capabilities of our Function Calculator by solving one of the most famous problems in computer science and mathematics: The Tower of Hanoi . This post will introduce how to program to solve hanoi problem. What is the Tower of Hanoi? The Tower of Hanoi is a mathematical puzzle consisting of three rods (pegs) and a number of disks of different sizes. The puzzle starts with all disks stacked on one rod in decreasing size, with the largest disk at the bottom. The objective is to move all disks from the source rod to the destination rod, following these rules: Only one disk can be moved at a time. A disk can only be placed on top of a larger disk or an empty rod. You must use an auxiliary rod to assist in moving the disks. Below is code examples that solve hanoi tower problem. You can copy below code and go to the Factory page in the Function Calculator and past...
Comments
Post a Comment