MATHCAD PRIME
APLICADO A ESTRUCTURAS DE HORMIGÓN ARMADO
CAP 0.5.- Programación -IF- ELSE- ELSE IF
0.1 Programar una funcion que devuleva un opuesto en texto
‖ |
opuesto ⎛⎝var⎞⎠ ≔ ‖ if var = “Negro”| |
‖ |
‖ ‖ “Blanco” ||
‖ ||
‖ if var = “Blanco”| |
‖ ‖ “Negro” | ||
‖ ‖
x ≔ “Negro”
opuesto ⎛⎝x⎞⎠ = “Blanco”
0.2.- Programar un intervalo con IF y ELSE IF
‖ ||
intervalo ⎛⎝x⎞⎠ ≔ ‖ if > 100
||
‖ ‖ ‖ “region 1” | |
‖ ||
‖ else if x > 50 | |
‖
‖ ‖ “region 2” | |
‖ ||
‖ else ||
‖ ‖ “region 3” | ||
‖ ‖
x ≔ 102
intervalo ⎛⎝x⎞⎠ = ?
0.3.- Programar Funciones por intervalo
‖ ||
y ⎛⎝t⎞⎠ ≔ ‖ if -10 < t < 0
||
‖ ‖ ‖y←t ||
‖ ||
‖ else if t = 0 ||
‖ ‖ ‖ y ← 10 ||
‖ ||
‖ else if t > 0 ||
‖ ‖ y ← 10 + 0.25 ⋅ t 2 ||
‖ ‖ || y ⎛⎝t⎞⎠
‖ else ||
‖ ‖y←0 || |
‖ ‖ | 35
30
25
20
15
10
t
5
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
-5
-10
07/01/2020
Página 1 de 1