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...
Daily life functions Convert weight in grams to weight in ounces. def gramsToOunces(g)=g*0.0353; Convert weight in ounces to weight in grams. def ouncesToGrams(o)=o*28.35; Convert Celsius temperature to Fahrenheit temperature def CelsiusToFahrenheit(c)=c*9/5+32; Convert Fahrenheit temperature to Celsius temperature def FahrenheitToCelsius(f)=(f-32)*5/9; Convert length in centimeters to length in inches def centimetersToInches(c)=c*0.3937; Convert length in inches to length in centimeters def inchesToCentimeters(i)=i*2.54; Mathematic functions Number 'n' is prime number? def isPrime(n) { if (n <= 1) { return false; } var i = 2; while (i * i <= n) { if (n % i == 0) { return false; } i = i + 1; } return true; ...
Comments
Post a Comment