Z3/Answers
Jump to navigation
Jump to search
1. Given a number n, find all roots from 1 to n of a given number N. ===Answer=== nrootsofn:=(1..n)√n; 2. Add these up. ===Answer=== nrootsofn:=(1..n)√n; SUM(nrootsofn(29)) 3. Find the sum of 1 to n for all even numbers from 1 to 100. ===Answer=== EVENS(1..100).$$(SUM) 4. Find the factorial of reciprocals of a series of numbers from 1 to a large numbers and see how it compares to the value of e. ===Answer=== [https://en.wikipedia.org/wiki/E_(mathematical_constant) e] is defined as: <img src=https://wikimedia.org/api/rest_v1/media/math/render/svg/4ecf44cf7290248f810619067256c209975ad8e1> FACTORIAL(0)+Σ(SERIESOF("1/x!",100)) or SUM(SERIESOF("1/x!",100,0)) give the result as 2.7182818284590455 which is quite close to e value of 2.71828182845904523536028747135266249775724709369995... (sequence A001113 in OEIS). Σ(SERIESOF("1/x!",100)) ( 1 to 100 only) is missing the original 1, and hence can be written as Σ(SERIESOF("1/x!",100,0)) ∑(0..100@"1/x!") also works SUM((0..100).$("1/x!")) is another answer. 5. Create 3x4x5x6 array and fill with numbers 1 to 100 ===Answer=== |3x4x5x6|.fillwith(1..100) 6. Do same and fill with random numbers. ===Answer=== |3x4x5x6|.random(100) 7. Do same and fill with cube root of numbers 1 to 100 ===Answer=== |3x4x5x6|.fillwith(CUBEROOT(1..100)) 8. Create an equation or formula for surface area of a cylinder. Try to do with units. Do this as a function that converts and does it on units supplied by user automatically if possible. ===Answer=== Surface Area of a cylinder : 2πr(h+r) ar:=2<*>π<*>(r<>(cm))<*>((h<>(cm))<+>(r<>(cm))) ar(10,30) 9. Create a function that given the radius and height of a cylinder, returns an array of radius height surface area and volume. Use Greek letters to be similar to formula that are generally used. 10. Do the same for a cone as equations and as a function. 11. Use array programming when needed. Notations can be as close to what are given in normal calculations in real situations. 12. A helium balloon with an internal pressure of 1.00 atm and a volume of 4.50 L at 20.00 C is released. What volume will the balloon occupy at an altitude where the pressure is 0.600 atm and the temperature is –20.00 C? 13. How many moles of gas occupy 98 L at a pressure of 2.8 atmospheres and a temperature of 292 K? 14. Following is precipitation data 2016 Day 1 Day 2 Day 3 Day 4 January 0 0 0 0 February 4 12 4 3 March 42 33 32 42 April 22 12 22 22 May 21 16 12 14 June 4 5 3 2 For the given days, Find the total precipitation for each month. Which day was the precipitation the most? Find total precipitation for the all months.