-
Notifications
You must be signed in to change notification settings - Fork 0
/
Graficas_y_Tablas.py
513 lines (419 loc) · 19.9 KB
/
Graficas_y_Tablas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
"""
Dentro del siguiente codigo se realizan las graficas y tablas requeridas para el trabajo
estas se separan del resto del código con el fin de llevar un desarrollo más ordenado
en archivos menos densos para el lector
"""
from Modulos import *
from Trabajo_estructural_2021 import *
####
# Librerias
import sympy as sy
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import transforms
from sympy import init_printing
init_printing()
# %% Graficas
# LA = 5 # longitud de A en metros
# LB = 4 # longitud de B en metros
# LC = sy.sqrt(6**2 + 2**2) # longitud de C en metros
# LD = sy.sqrt(5**2 + 2**2) # longitud de D en metros
xA_eval = np.linspace(0, LA, 100)
xB_eval = np.linspace(0, LB, 100)
xC_eval1 = np.linspace(0, float(sy.sqrt(10)), 100)
xC_eval2 = np.linspace(float(sy.sqrt(10)), float(LC), 100)
xD_eval = np.linspace(0, float(LD), 100)
Escala = 100
EscalaP = 0.01
EscalaV = 0.001
EscalaM = 0.01
# Datos Graficas
# Elemento A
u_A_gra, v_A_gra = [], []
P_A_gra = []
M_A_gra = []
V_A_gra = []
# Elemento B
u_B_gra, v_B_gra = [], []
P_B_gra = []
M_B_gra = []
V_B_gra = []
# Elemento C
u_C1_gra, v_C1_gra = [], []
u_C2_gra, v_C2_gra = [], []
P_C1_gra, P_C2_gra = [], []
M_C1_gra, M_C2_gra = [], []
V_C1_gra, V_C2_gra = [], []
# Elemento D
u_D_gra, v_D_gra = [], []
P_D_gra = []
M_D_gra = []
V_D_gra = []
# Elemento A
for i in xA_eval:
u_A_gra.append(uA.subs({x: i})*Escala)
v_A_gra.append(vA.subs({x: i})*Escala)
P_A_gra.append(P_A.subs({x: i})*EscalaP)
M_A_gra.append(M_A.subs({x: i})*EscalaM)
V_A_gra.append(V_A.subs({x: i})*EscalaV)
# Elemento B
for i in xB_eval:
u_B_gra.append(uB.subs({x: i})*Escala)
v_B_gra.append(vB.subs({x: i})*Escala)
P_B_gra.append(P_B.subs({x: i})*EscalaP)
M_B_gra.append(M_B.subs({x: i})*EscalaM)
V_B_gra.append(V_B.subs({x: i})*EscalaV)
# Elemento C
for i in xC_eval1:
u_C1_gra.append(uC_1.subs({x: i})*Escala)
v_C1_gra.append(vC_1.subs({x: i})*Escala)
P_C1_gra.append(P_C1.subs({x: i})*EscalaP)
M_C1_gra.append(M_C1.subs({x: i})*EscalaM)
V_C1_gra.append(V_C1.subs({x: i})*EscalaV)
###########################
for i in xC_eval2:
u_C2_gra.append(uC_2.subs({x: i})*Escala)
v_C2_gra.append(vC_2.subs({x: i})*Escala)
P_C2_gra.append(P_C2.subs({x: i})*EscalaP)
M_C2_gra.append(M_C2.subs({x: i})*EscalaM)
V_C2_gra.append(V_C2.subs({x: i})*EscalaV)
# Elemento D
for i in xD_eval:
u_D_gra.append(uD.subs({x: i})*Escala)
v_D_gra.append(vD.subs({x: i})*Escala)
P_D_gra.append(P_D.subs({x: i})*EscalaP)
M_D_gra.append(M_D.subs({x: i})*EscalaM)
V_D_gra.append(V_D.subs({x: i})*EscalaV)
x_elem_C = np.linspace(0, 6, 100)
Elem_C = []
for i in x_elem_C:
y = (2/6)*x + 7
Elem_C.append(y.subs({x: i}))
x_elem_D = np.linspace(0, 5, 100)
Elem_D = []
for i in x_elem_D:
y = -(2/5)*x + 9
Elem_D.append(y.subs({x: i}))
"""
Transformación de la grafica utilizando
base = plt.gca().transData
rot = transforms.Affine2D().rotate('angle in radians').translate(x,y)
"""
base = plt.gca().transData
rot_C = transforms.Affine2D().rotate(theta_C).translate(0, 7)
rot_A = transforms.Affine2D().rotate(radians(90)).translate(6, 0)
rot_B = transforms.Affine2D().rotate(radians(90)).translate(6, 5)
rot_D = transforms.Affine2D().rotate(theta_D).translate(6, 9)
# %% campo de desplazamiento vertical
# Estructura
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.axvline(6, 0, 0.9, color='k', linewidth=0.8)
plt.axhline(y=5, color='k', label='Suelo', linestyle=':', linewidth=0.8)
plt.plot(x_elem_C, Elem_C, color='k', linewidth=0.8)
plt.plot(np.linspace(6, 11, 100), Elem_D, color='k', linewidth=0.8)
# grid
plt.axvline(1, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=1, color='k', linestyle='-', linewidth=0.3)
plt.axvline(3, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=3, color='k', linestyle='--', linewidth=0.3)
plt.axvline(5, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axvline(7, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=7, color='k', linestyle='--', linewidth=0.3)
plt.axvline(9, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=9, color='k', linestyle='--', linewidth=0.3)
plt.axvline(11, 0, 11, color='k', linestyle='--', linewidth=0.3)
# Campos
plt.plot(xC_eval1, v_C1_gra, color='k', linestyle='--', transform=rot_C + base)
plt.plot(xC_eval2, v_C2_gra, color='k', linestyle='--', transform=rot_C + base)
plt.plot(xA_eval, v_A_gra, color='k', linestyle='--', transform=rot_A + base)
plt.plot(xB_eval, v_B_gra, color='k', linestyle='--', transform=rot_B + base)
plt.plot(xD_eval, v_D_gra, color='k', linestyle='--', transform=rot_D + base)
# # values
# plt.text(np.array(7), np.array(0.5), f"{sy.N(v_A_gra[0],3)}")
# plt.text(np.array(7), np.array(4.5), f"{sy.N(v_A_gra[99],3)}")
# plt.text(np.array(7), np.array(5.5), f"{sy.N(v_B_gra[0],3)}")
# plt.text(np.array(6), np.array(9.5), f"{sy.N(v_B_gra[99],3)}")
# plt.text(np.array(-0.3), np.array(7.5), f"{sy.N(v_C1_gra[0],3)}")
# plt.text(np.array(4.2), np.array(9.3), f"{sy.N(v_C2_gra[99],3)}")
# plt.text(np.array(7.3), np.array(8.7), f"{sy.N(v_D_gra[0],3)}")
# plt.text(np.array(10), np.array(6), f"{sy.N(v_D_gra[99],3)}")
plt.axis([-1, 12, 0, 10])
plt.xlabel('$x$[m]', fontsize=16)
plt.ylabel('$y$[m]', fontsize=16)
plt.grid(linestyle='--', linewidth=0.3, color='k')
plt.savefig('LaTex/Graficas/Grafica_Des_vertical.pdf', bbox_inches='tight')
# plt.show()
plt.close()
# %% campo de desplazamiento horizontal
# Estructura
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.axvline(6, 0, 0.5, label='Elemento A', color='k', linewidth=0.8)
plt.axvline(6, 0.5, 0.9, label='Elemento B', color='k', linewidth=0.8)
plt.axhline(y=5, color='k', linestyle=':', linewidth=0.8)
plt.plot(x_elem_C, Elem_C, label='Elemento C', color='k', linewidth=0.8)
plt.plot(np.linspace(6, 11, 100), Elem_D,
label='Elemento D', color='k', linewidth=0.8)
# grid
plt.axvline(1, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=1, color='k', linestyle='-', linewidth=0.3)
plt.axvline(3, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=3, color='k', linestyle='--', linewidth=0.3)
plt.axvline(5, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axvline(7, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=7, color='k', linestyle='--', linewidth=0.3)
plt.axvline(9, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=9, color='k', linestyle='--', linewidth=0.3)
plt.axvline(11, 0, 11, color='k', linestyle='--', linewidth=0.3)
# Campos
plt.plot(xC_eval1, u_C1_gra, color='k', linestyle='--', transform=rot_C + base)
plt.plot(xC_eval2, u_C2_gra, color='k', linestyle='--', transform=rot_C + base)
plt.plot(xA_eval, u_A_gra, color='k', linestyle='--', transform=rot_A + base)
plt.plot(xB_eval, u_B_gra, color='k', linestyle='--', transform=rot_B + base)
plt.plot(xD_eval, u_D_gra, color='k', linestyle='--', transform=rot_D + base)
# # values
# plt.text(np.array(xA_eval[0] + 0.3), np.array(u_A_gra[0] + 0.3), f"{sy.N(u_A_gra[0],3)}",
# transform=rot_A + base)
# plt.text(np.array(xA_eval[99] + 0.3), np.array(u_A_gra[99] + 0.3), f"{sy.N(u_A_gra[99],3)}",
# transform=rot_A + base)
# plt.text(np.array(xB_eval[0] + 0.3), np.array(u_B_gra[0] + 0.3), f"{sy.N(u_B_gra[0],3)}",
# transform=rot_B + base)
# plt.text(np.array(xB_eval[99] + 0.3), np.array(u_B_gra[99] + 0.3), f"{sy.N(u_B_gra[99],3)}",
# transform=rot_B + base)
# plt.text(np.array(xC_eval1[0] + 0.3), np.array(u_C1_gra[0] + 0.3), f"{sy.N(u_C1_gra[0],3)}",
# transform=rot_C + base)
# plt.text(np.array(xC_eval2[99] + 0.3), np.array(u_C2_gra[99] + 0.3), f"{sy.N(u_C2_gra[99],3)}",
# transform=rot_C + base)
# plt.text(np.array(xD_eval[0] + 0.3), np.array(u_D_gra[0] + 0.3), f"{sy.N(u_D_gra[0],3)}",
# transform=rot_D + base)
# plt.text(np.array(xD_eval[99] + 0.3), np.array(u_D_gra[99] + 0.3), f"{sy.N(u_D_gra[99],3)}",
# transform=rot_D + base)
plt.axis([-1, 12, 0, 10])
plt.xlabel('$x$[m]', fontsize=16, weight="bold")
plt.ylabel('$y$[m]', fontsize=16, weight="bold")
plt.grid(linestyle='--', linewidth=0.3, color='k')
plt.savefig('LaTex/Graficas/Grafica_Des_horizontal.pdf', bbox_inches='tight')
# plt.show()
plt.close()
# %% Campo de fuerza axial
# Estructura
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.axvline(6, 0, 0.5, label='Elemento A', color='k', linewidth=0.8)
plt.axvline(6, 0.5, 0.9, label='Elemento B', color='k', linewidth=0.8)
plt.axhline(y=5, color='k', linestyle=':', linewidth=0.8)
plt.plot(x_elem_C, Elem_C, label='Elemento C', color='k', linewidth=0.8)
plt.plot(np.linspace(6, 11, 100), Elem_D,
label='Elemento D', color='k', linewidth=0.8)
# grid
plt.axvline(1, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=1, color='k', linestyle='-', linewidth=0.3)
plt.axvline(3, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=3, color='k', linestyle='--', linewidth=0.3)
plt.axvline(5, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axvline(7, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=7, color='k', linestyle='--', linewidth=0.3)
plt.axvline(9, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=9, color='k', linestyle='--', linewidth=0.3)
plt.axvline(11, 0, 11, color='k', linestyle='--', linewidth=0.3)
# Campos
plt.plot(xC_eval1, P_C1_gra, color='k', linestyle='--', transform=rot_C + base)
plt.plot(xC_eval2, P_C2_gra, color='k', linestyle='--', transform=rot_C + base)
plt.plot(xA_eval, P_A_gra, color='k', linestyle='--', transform=rot_A + base)
plt.plot(xB_eval, P_B_gra, color='k', linestyle='--', transform=rot_B + base)
plt.plot(xD_eval, P_D_gra, color='k', linestyle='--', transform=rot_D + base)
# # values
plt.text(np.array(xA_eval[0] + 0.5), np.array(P_A_gra[0] - 0.5),
f"{sy.N(P_A_gra[0],3)}", transform=rot_A + base)
# plt.text(np.array(xA_eval[99] + 0.3), np.array(P_A_gra[99] + 0.3),
# f"{sy.nsimplify(P_A_gra[99],tolerance=1e-6)}", transform=rot_A + base)
# plt.text(np.array(xB_eval[0] - 0.5), np.array(P_B_gra[0] + 0.3),
# f"{sy.N(P_B_gra[0],3)}", transform=rot_B + base)
plt.text(np.array(xB_eval[99] + 0.3), np.array(P_B_gra[99] +
0.3), f"{sy.N(P_B_gra[99],3)}", transform=rot_B + base)
plt.text(np.array(xC_eval1[0] - 1), np.array(P_C1_gra[0] + 0.3),
f"{sy.N(P_C1_gra[0],3)}", transform=rot_C + base)
plt.text(np.array(xC_eval2[99] - 2), np.array(P_C2_gra[99] + 0.4),
f"${sy.N(P_C2_gra[99],3)}^C$", transform=rot_C + base)
plt.text(np.array(xD_eval[0] + 0.3), np.array(P_D_gra[0] + 0.5),
f"${sy.N(P_D_gra[0],3)}^D$", transform=rot_D + base)
plt.text(np.array(xD_eval[99] - 0.3), np.array(P_D_gra[99] -
0.5), f"{sy.N(P_D_gra[99],3)}", transform=rot_D + base)
plt.axis([-1, 12, 0, 10])
plt.xlabel('$x$[m]', fontsize=16, weight="bold")
plt.ylabel('$y$[m]', fontsize=16, weight="bold")
plt.grid(linestyle='--', linewidth=0.3, color='k')
plt.savefig('LaTex/Graficas/Grafica_campo_fuerza_axial.pdf',
bbox_inches='tight')
# plt.show()
plt.close()
# %% Campo de momento flector
# Estructura
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.axvline(6, 0, 0.5, label='Elemento A', color='k', linewidth=0.8)
plt.axvline(6, 0.5, 0.9, label='Elemento B', color='k', linewidth=0.8)
plt.axhline(y=5, color='k', linestyle=':', linewidth=0.8)
plt.plot(x_elem_C, Elem_C, label='Elemento C', color='k', linewidth=0.8)
plt.plot(np.linspace(6, 11, 100), Elem_D,
label='Elemento D', color='k', linewidth=0.8)
# grid
plt.axvline(1, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=1, color='k', linestyle='-', linewidth=0.3)
plt.axvline(3, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=3, color='k', linestyle='--', linewidth=0.3)
plt.axvline(5, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axvline(7, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=7, color='k', linestyle='--', linewidth=0.3)
plt.axvline(9, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=9, color='k', linestyle='--', linewidth=0.3)
plt.axvline(11, 0, 11, color='k', linestyle='--', linewidth=0.3)
# Campos
plt.plot(xC_eval1, M_C1_gra, color='k', linestyle='--', transform=rot_C + base)
plt.plot(xC_eval2, M_C2_gra, color='k', linestyle='--', transform=rot_C + base)
plt.plot(xA_eval, M_A_gra, color='k', linestyle='--', transform=rot_A + base)
plt.plot(xB_eval, M_B_gra, color='k', linestyle='--', transform=rot_B + base)
plt.plot(xD_eval, M_D_gra, color='k', linestyle='--', transform=rot_D + base)
# # values
plt.text(np.array(xA_eval[0] + 0.5), np.array(M_A_gra[0] - 0.3),
f"{sy.N(M_A_gra[0],3)}", transform=rot_A + base)
# plt.text(np.array(xA_eval[99] - 0.5), np.array(M_A_gra[99] - 0.5), f"{sy.N(M_A_gra[99],3)}",transform=rot_A + base)
plt.text(np.array(xB_eval[0] + 0.3), np.array(M_B_gra[0] - 0.5),
f"{sy.N(M_B_gra[0],3)}", transform=rot_B + base)
plt.text(np.array(xB_eval[99] + 0.5), np.array(M_B_gra[99] - 0.3),
f"${sy.N(M_B_gra[99],3)}^B$", transform=rot_B + base)
plt.text(np.array(xC_eval1[0] - 1), np.array(M_C1_gra[0] + 0.3),
f"{sy.N(M_C1_gra[0],3)}", transform=rot_C + base)
plt.text(np.array(xC_eval2[99] - 0.3), np.array(M_C2_gra[99] - 0.5),
f"${sy.N(M_C2_gra[99],3)}^C$", transform=rot_C + base)
plt.text(np.array(xD_eval[0] - 1.5), np.array(M_D_gra[0]-1),
f"${sy.N(M_D_gra[0],3)}^D$", transform=rot_D + base)
plt.text(np.array(xD_eval[99] - 0.3), np.array(M_D_gra[99] -
0.5), f"{sy.N(M_D_gra[99],3)}", transform=rot_D + base)
plt.axis([-1, 12, 0, 10])
plt.xlabel('$x$[m]', fontsize=16, weight="bold")
plt.ylabel('$y$[m]', fontsize=16, weight="bold")
plt.grid(linestyle='--', linewidth=0.3, color='k')
plt.savefig('LaTex/Graficas/Grafica_campo_momento_flector.pdf',
bbox_inches='tight')
# plt.show()
plt.close()
# %% Campo de fuerza cortante
# Estructura
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.axvline(6, 0, 0.5, label='Elemento A', color='k', linewidth=0.8)
plt.axvline(6, 0.5, 0.9, label='Elemento B', color='k', linewidth=0.8)
plt.axhline(y=5, color='k', linestyle=':', linewidth=0.8)
plt.plot(x_elem_C, Elem_C, label='Elemento C', color='k', linewidth=0.8)
plt.plot(np.linspace(6, 11, 100), Elem_D,
label='Elemento D', color='k', linewidth=0.8)
# plt.text(6.3, 2.5, 'A')
# plt.text(6.3, 7, 'B')
# plt.text(3.4, 7.3, 'C')
# plt.text(8.5, 7.3, 'D')
# grid
plt.axvline(1, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=1, color='k', linestyle='-', linewidth=0.3)
plt.axvline(3, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=3, color='k', linestyle='--', linewidth=0.3)
plt.axvline(5, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axvline(7, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=7, color='k', linestyle='--', linewidth=0.3)
plt.axvline(9, 0, 11, color='k', linestyle='--', linewidth=0.3)
plt.axhline(y=9, color='k', linestyle='--', linewidth=0.3)
plt.axvline(11, 0, 11, color='k', linestyle='--', linewidth=0.3)
# Campos
plt.plot(xC_eval1, V_C1_gra, color='k', linestyle='--', transform=rot_C + base)
plt.plot(xC_eval2, V_C2_gra, color='k', linestyle='--', transform=rot_C + base)
plt.plot(xA_eval, V_A_gra, color='k', linestyle='--', transform=rot_A + base)
plt.plot(xB_eval, V_B_gra, color='k', linestyle='--', transform=rot_B + base)
plt.plot(xD_eval, V_D_gra, color='k', linestyle='--', transform=rot_D + base)
# values
plt.text(np.array(xA_eval[0]+0.5), np.array(V_A_gra[0]-0.5),
f"{sy.N(V_A_gra[0],3)}", transform=rot_A + base)
# plt.text(np.array(xA_eval[99]-0.5), np.array(V_A_gra[99]-0.5), f"{sy.N(V_A_gra[99],3)}",transform=rot_A + base)
plt.text(np.array(xB_eval[0]), np.array(V_B_gra[0]-0.5),
f"{sy.N(V_B_gra[0],3)}", transform=rot_B + base)
plt.text(np.array(xB_eval[99]+0.4), np.array(V_B_gra[99]-0.3),
f"${sy.N(V_B_gra[99],3)}^B$", transform=rot_B + base)
plt.text(np.array(xC_eval1[0]-0.3), np.array(V_C1_gra[0]-0.7),
f"{sy.N(V_C1_gra[0],3)}", transform=rot_C + base)
plt.text(np.array(xC_eval2[99]-1.5), np.array(V_C2_gra[99]+0.5),
f"{sy.N(V_C2_gra[99],3)}", transform=rot_C + base)
plt.text(np.array(xD_eval[0]+0.5), np.array(V_D_gra[0]-1),
f"${sy.N(V_D_gra[0],3)}^D$", transform=rot_D + base)
plt.text(np.array(xD_eval[99]-0.8), np.array(V_D_gra[99]-0.8),
f"{sy.N(V_D_gra[99],3)}", transform=rot_D + base)
plt.axis([-1, 12, 0, 10])
plt.xlabel('$x$[m]', fontsize=16, weight="bold")
plt.ylabel('$y$[m]', fontsize=16, weight="bold")
plt.grid(linestyle='--', linewidth=0.3, color='k')
plt.savefig('LaTex/Graficas/Grafica_campo_fuerza_cortante.pdf',
bbox_inches='tight')
# plt.show()
plt.close()
# %% Tablas
def Tablas_fuerzas_internas(FI, xi, xj, n, F, Elem):
"""
Genera las tablas para los valores de x_E/10
Donde:
FI: Fuerza interna
xi,xj: intervalo de evaluación de FI
n: número de veces que se divide el intervalo
F: nombre de la fuerza interna
Elem: Elemento al que coresponde la tabla
"""
import pandas as pd
xE = np.linspace(float(xi), float(xj), n)
data = {f"$x_{Elem}$": [], f"${F}$": []}
for i in xE:
valor = np.round(float(FI.subs({x: i})), decimals=5)
data[f"$x_{Elem}$"].append(np.round(float(i), decimals=5))
data[f"${F}$"].append(valor)
tabla = pd.DataFrame.from_dict(data)
return tabla
A, B, C, D = sy.symbols('A,B,C,D')
# Elemento A
PA_Tabla = Tablas_fuerzas_internas(P_A, 0, LA, 10, "P($x'_A$)", A)
MA_Tabla = Tablas_fuerzas_internas(M_A, 0, LA, 10, "M($x'_A$)", A)
VA_Tabla = Tablas_fuerzas_internas(V_A, 0, LA, 10, "V($x'_A$)", A)
# Elemento B
PB_Tabla = Tablas_fuerzas_internas(P_B, 0, LB, 10, "P($x'_B$)", B)
MB_Tabla = Tablas_fuerzas_internas(M_B, 0, LB, 10, "M($x'_B$)", B)
VB_Tabla = Tablas_fuerzas_internas(V_B, 0, LB, 10, "V($x'_B$)", B)
# Elemento D
PD_Tabla = Tablas_fuerzas_internas(P_D, 0, float(LD), 10, "P($x'_C$)", D)
MD_Tabla = Tablas_fuerzas_internas(M_D, 0, float(LD), 10, "M($x'_C$)", D)
VD_Tabla = Tablas_fuerzas_internas(V_D, 0, float(LD), 10, "V($x'_C$)", D)
# Elemento C
PC1_Tabla = Tablas_fuerzas_internas(P_C1, 0, float(
LC), 10, "P($x'_C$)", C).drop(index=[5, 6, 7, 8, 9])
MC1_Tabla = Tablas_fuerzas_internas(M_C1, 0, float(
LC), 10, "M($x'_C$)", C).drop(index=[5, 6, 7, 8, 9])
VC1_Tabla = Tablas_fuerzas_internas(V_C1, 0, float(
LC), 10, "V($x'_C$)", C).drop(index=[5, 6, 7, 8, 9])
PC2_Tabla = Tablas_fuerzas_internas(P_C2, 0, float(
LC), 10, "P($x'_C$)", C).drop(index=[0, 1, 2, 3, 4])
MC2_Tabla = Tablas_fuerzas_internas(M_C2, 0, float(
LC), 10, "M($x'_C$)", C).drop(index=[0, 1, 2, 3, 4])
VC2_Tabla = Tablas_fuerzas_internas(V_C2, 0, float(
LC), 10, "V($x'_C$)", C).drop(index=[0, 1, 2, 3, 4])
# Merge fuerzas internas Elemento C
PC_Tabla = pd.concat([PC1_Tabla, PC2_Tabla])
MC_Tabla = pd.concat([MC1_Tabla, MC2_Tabla])
VC_Tabla = pd.concat([VC1_Tabla, VC2_Tabla])
Elemento_A = pd.merge(PA_Tabla, pd.merge(
VA_Tabla, MA_Tabla, on='$x_A$'), on='$x_A$')
Elemento_B = pd.merge(PB_Tabla, pd.merge(
VB_Tabla, MB_Tabla, on='$x_B$'), on='$x_B$')
Elemento_C = pd.merge(PC_Tabla, pd.merge(
VC_Tabla, MC_Tabla, on='$x_C$'), on='$x_C$')
Elemento_D = pd.merge(PD_Tabla, pd.merge(
VD_Tabla, MD_Tabla, on='$x_D$'), on='$x_D$')
Elemento_A.name = 'Elemento_A'
Elemento_B.name = 'Elemento_B'
Elemento_C.name = 'Elemento_C'
Elemento_D.name = 'Elemento_D'