Proposals of math codes. Area polygon. Vertices rectangle. Linear regression. Decimal IP

Hello friends,

these are mathematical problems proposals to perform with App Inventor BLOCKS.

Please do not publish the answers in this discussion, since they are proposals for users who want to try or teachers who want to propose to their students.

1.- Given ordered coordinates of a polygon with n vertices, find area of the polygon.
The coordinates are given either in clockwise or anticlockwise.

Example:
coordinates (x1,y1,x2,y2,x3,y3,...) = 4,10,9,7,11,2,2,2

area = 45.5

Information:
https://www.mathopenref.com/coordpolygonarea.html

Solution with extension:

p150_extension_area.aia (11.2 KB)

1B.- Given ordered coordinates of a polygon with n vertices, find perimeter of the polygon.
The coordinates are given either in clockwise or anticlockwise.
https://www.mathsisfun.com/algebra/distance-2-points.html

1C.- Calculate the sum of the length of these segments.
longitud

Coordinates: x1,y1,x2,y2,x3,y3,...
Coordinates: 0,0,0,5,1,5,2,5,3,2,4,5,5,5,5,-5,6,-5,7,-4,8,-5,9,-5,10,-5,10,0

Sol: 35.15298

Unfinished: p150_longitud_i.aia (38.2 KB)

16 Likes

2.- Given height, width and angle alfa of a rectangle, find coordinates of vertices.

Solution with extension:

p150_extension_GeoVertice.aia (21.5 KB)

13 Likes

3.- Calculate the ecuation Linear Regression of n points.

lineal1

Example:
xValues = 10,20,30,40,50,60
yValues = 40,60,70,50,60,70

Linear regression: y = 0.37143 X + 45.33333

Information:
https://www.socscistatistics.com/tests/regression/default.aspx

Solution with extension:

p150_extension_linear.aia (14.0 KB)

12 Likes

4.- Given a decimal number convert to IP.

Example:
Decimal = 3232241721

IP = 192.168.24.57

Convert decimal to IP online:
https://www.browserling.com/tools/dec-to-ip

9 Likes

Nice examples showing the power of App Inventor.

5 Likes

5.- Evaluate the definite integral with an error less than 1‰
integral1

integral3
p84Ei_integrales.aia (1.9 KB)

apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

8 Likes

6.- Adapt this code to App Inventor to get moon age.


http://www.primaryhomeworkhelp.co.uk/moon/hemispheres.html
fasesluna4

apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

////////////////////////////////////////////////////////////////////////////////
                //// CODE TO GET MOON AGE. Variable $jd //////////
///////////////////////////////////////////////////////////////////////////////
    $day = Read($Input1)
    $month = Read($Input2)
    $year = Read($Input3)

    $c = 0
    $e = 0
    $jd = 0
    $b = 0

    If ($month < 3) Then
    $year = $year - 1
    $month = $month + 12
    EndIf

    $month = $month + 1
    $c = 365.25 * $year
    $e = 30.6 * $month
    $jd = $c + $e + $day - 694039.09   ;  jd is total time

    $jd =  $jd / 29.5305882            ; divide moon cycle

    $b = Int ($jd)    
    $jd = $jd - $b                      ;  **$jd  is MOON AGE**
    $b = Round($jd * 8)                 

    If ($b >= 8 ) Then $b = 0
        
    Switch $b
    Case 0
        $fase = "Luna nueva"
    Case 1
        $fase = "Poco creciente"
    Case 2
        $fase = "Cuarto creciente"
    Case 3
        $fase = "Muy creciente"
    Case 4
        $fase = "Luna llena"
    Case 5
        $fase = "Poco menguante"
    Case 6
        $fase = "Cuarto menguante"
    Case 7
        $fase = "Muy menguante"
    EndSwitch

    GUICtrlSetData($Label5, $b & "-" & $fase)
9 Likes

7.- Solve two equations with two unknowns.

dosecuaciones6

p84Di_dos_ecuaciones.aia (2.6 KB) (unfinished).

10 Likes

8.- Trigonometric projections of sine and cosine.

Drag your finger over the circle and get the horizontal and vertical projection of the radius.

radius = Canvas1.Width / 2

p7Yi2_proyecciones.aia (4.0 KB) (unfinished).
apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

8 Likes

9.- Calculates the linear equation given two points.
recta2

apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

6 Likes

10.- Draw the Archimedean spiral.

r = a + b*θ

Let
a = 5
b = 4
θ in radians. Five 360º turnings.

p84Gi_espiral_arq.aia (2.3 KB) (unfinished).
apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

8 Likes

11.- Using a Clock with a TimerInterval of 4 seconds, 7-bit digital random numbers are presented on a Label.

The user must click on the Button_0 or Button_1 to add the parity bit (even).
A Label shows whether the user's response is correct or not.
The number of bytes created and the number of correct answers must also be displayed.



p91i_crear_bit_paridad_juego.aia (3.5 KB) (unfinished).
apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

6 Likes

12.- Pully on an incline with friction.

A 5 kg mass is placed on an incline with friction. Making an angle of 30 degrees with the horizontal. A rope is attached and positioned over a pulley at the top of the incline. A 6 kg mass is suspend from the free end. What is the acceleration of the system.
m1 going up or down?
Assume µ = 0.20

Information: https://www.youtube.com/watch?v=Fek9Pa2jQio
apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

6 Likes

13.- Uniform Rectilinear Motion.

A green car starts and maintains a speed of 90 km/h in a straight line.
Another red car located 24 km, starts 2 hours later at a speed of 120 km/h
Calculate how long it will take to reach the green car.

Information: https://ekuatio.com/en/uniform-rectilinear-motion-solving-problems-step-by-step/
apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

6 Likes

14.- Find the inverse of a given number.
Show number and result with multiples and submultiples prefix.

Information: https://www.medcalc.org/manual/decimal_multiples_and_submultiples_of_si_units.php
apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

5 Likes

15.- Find the impedance and phase angle of a circuit RLC.

Information: https://www.youtube.com/watch?v=IVS-vjHdC1c
apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

6 Likes

16.- Wheatstone bridge.
a) Create a random value for Rx.
b) Move the Slider until the volts are approximately zero.
c) Now Rx = R * (R2 / R1)

Information: https://www.youtube.com/watch?v=VbiOLkhQC4w
Information: https://en.wikipedia.org/wiki/Wheatstone_bridge

p82Ii_wheatstone.aia (18.4 KB) (unfinished).
apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

8 Likes

17.- Limit of a function. Evaluate expression. Parse mathematical expressions.

To evaluate an algebraic expression we can use:

a) JavaScript: http://kio4.com/appinventor/168_javascript_evaluar_expresion.htm

b) JavaScript: https://groups.google.com/forum/#!category-topic/mitappinventortest/specific-programming-issue/0oVTthDFChY

c) Math extension by Taifun: https://puravidaapps.com/math.php

...but the proposal is to calculate the limits of these functions using only blocks.

  • Example:

... when approaching value is 5, we can let x = 4.99999 or 5.00001

Information: https://www.mathwarehouse.com/calculus/limits/limits-indeterminate-factorable.php
Verification: https://www.dcode.fr/limit
Examples: https://www.matesfacil.com/BAC/limites/ejercicios-resueltos-limites-1.html

p78D_limites.aia (2.4 KB)

7 Likes

18.- Find the prime factors of a number.

primos_factores4

Verification: https://www.dcode.fr/prime-factors-decomposition
apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

8 Likes

19.- Statistical.

In a class of 18 students, they have obtained the following scores:
4,4,4,5,5,5,5,5,7,7,8,8,8,8,9,9,9,10.
Calculate the mean, variance and standard deviation of that distribution.




apk file in external link: http://kio4.com/appinventor/apk_archivos.htm

6 Likes