Skip to main content

Álgebra lineal simplificada con integración a Google Sheets y Excel para estudiantes

Project description

📚 Álgebra Lineal con Google Sheets y Excel

Álgebra lineal simplificada para estudiantes con integración perfecta a Google Sheets y Excel.

Permite a estudiantes y profesores trabajar con matrices almacenadas en Google Sheets (por nombre o por enlace) o en archivos Excel locales, usando Python de forma intuitiva y sencilla. Perfecto para cursos de álgebra lineal, análisis numérico y ciencias de datos.

🚀 Instalación

pip install algebra-lineal-sheets

¡Y listo! No necesitas configurar nada más.

📋 Uso Básico

1. Preparar Google Sheet

  • Crear Google Sheet llamado matrices
  • Añadir pestañas con nombres: A, B, v, etc.
  • Llenar con datos numéricos (sin texto ni fórmulas)

2. Usar en Python

# Importar y configurar (una vez por sesión)
from algebra_lineal import *
configurar()

# Ver qué matrices tienes disponibles
workspace()

# Importar matrices específicas
importar('A', 'B', 'v')

# Realizar operaciones de álgebra lineal
C = A @ B                      # Multiplicación matricial
suma = A + B                   # Suma de matrices
Ainv = np.linalg.inv(A)       # Matriz inversa
det_A = np.linalg.det(A)      # Determinante

# Exportar resultados de vuelta a Google Sheets
exportar('C', 'suma', 'Ainv')

📊 Ejemplo Completo

from algebra_lineal import *
import numpy as np

# Configurar conexión con Google Sheets
configurar()

# Ver workspace
workspace()
# 🏢 WORKSPACE: 'matrices'
# ===========================================================================
# #   NOMBRE               DIMENSIONES  TIPO           
# ---------------------------------------------------------------------------
# 1   A                    3×3          📋 Matriz      
# 2   B                    3×3          📋 Matriz      
# 3   v                    3×1          📉 Vector columna

# Importar matrices necesarias
importar('A', 'B', 'v')

# Resolver sistema de ecuaciones Ax = b
b = v  # Usar vector v como término independiente
x = np.linalg.solve(A, b)

# Verificar solución
verificacion = A @ x - b
error = np.linalg.norm(verificacion)

print(f"Solución: x = {x}")
print(f"Error: {error:.2e}")

# Exportar resultados
exportar('x', 'verificacion')

🔧 Funciones Disponibles

Función Descripción Ejemplo
configurar() Configuración inicial configurar(sheet='prope2026'), configurar(sheet='https://docs...') o configurar(sheet='matrices.xlsx')
workspace() Ver matrices en Sheets workspace()
importar() Importar matrices importar('A', 'B')
exportar() Exportar resultados exportar('C')
cambiar_sheet() Cambiar archivo cambiar_sheet('proyecto2')
ayuda() Ayuda completa ayuda()

📚 Para Estudiantes

Google Colab (Recomendado)

# 1. Instalar paquete
!pip install algebra-lineal-sheets

# 2. Importar y configurar
from algebra_lineal import *
configurar()

# 3. ¡Empezar a trabajar!
workspace()
importar('A', 'B')
resultado = A @ B
exportar('resultado')

Operaciones Comunes

# Después de importar matrices A, B, v
C = A @ B                          # Multiplicación matricial
suma = A + B                       # Suma
transpuesta = A.T                  # Transpuesta
inversa = np.linalg.inv(A)         # Inversa (si existe)
determinante = np.linalg.det(A)    # Determinante
autovalores = np.linalg.eigvals(A) # Autovalores
rango = np.linalg.matrix_rank(A)   # Rango
norma = np.linalg.norm(v)          # Norma de vector

👨‍🏫 Para Profesores

Ventajas Pedagógicas

  • Enfoque en matemáticas: Los estudiantes se concentran en álgebra lineal, no en programación
  • Datos modificables: Cambiar valores en Google Sheets sin tocar código
  • Colaborativo: Fácil compartir matrices entre estudiantes
  • Visual: Ver resultados inmediatamente en Google Sheets
  • Escalable: Funciona igual para 10 o 1000 estudiantes

Configuración de Clase

  1. Crear plantilla: Google Sheet con matrices ejemplo
  2. Compartir plantilla: Estudiantes hacen copia
  3. Dar instrucciones simples:
    !pip install algebra-lineal-sheets
    from algebra_lineal import *
    configurar()
    

Ejemplo de Ejercicio

# Ejercicio: Transformaciones lineales
importar('T', 'v1', 'v2', 'v3')  # Matriz T y vectores

# Aplicar transformación
w1 = T @ v1
w2 = T @ v2  
w3 = T @ v3

# Analizar propiedades
det_T = np.linalg.det(T)
es_invertible = abs(det_T) > 1e-10

# Exportar análisis
exportar('w1', 'w2', 'w3', 'det_T')

🛠️ Configuración Avanzada

Fuentes de datos: nombre, enlace o Excel local

configurar(sheet=...) y cambiar_sheet(...) aceptan tres formas y detectan automáticamente cuál es:

# 1. Google Sheet por NOMBRE
configurar(sheet='prope2026')

# 2. Google Sheet por ENLACE (copia el enlace de edición del navegador)
configurar(sheet='https://docs.google.com/spreadsheets/d/1vpg.../edit')

# 3. Excel LOCAL en tu PC — no necesita internet ni cuenta de Google
configurar(sheet='C:/Users/ana/Documents/matrices.xlsx')

También puedes cambiar de fuente en cualquier momento, o usar otra solo para una operación puntual:

cambiar_sheet('prope2026')
importar('A', 'B')

importar('A', sheet_name='otro_archivo')       # solo esta vez
exportar('C', sheet_name='resultados.xlsx')    # crea el Excel si no existe

⚠️ Importante: importar('prope2026') NO abre el archivo prope2026 — busca una pestaña llamada prope2026 dentro del archivo activo. Para cambiar de archivo usa cambiar_sheet('prope2026').

Modo Excel local

Ideal para trabajar sin internet y sin cuenta de Google (en tu PC con Anaconda, VS Code, etc.). La estructura es la misma: una pestaña = una matriz.

from algebra_lineal import *
configurar(sheet='matrices.xlsx')   # sin autenticación
workspace()
importar('A', 'B')
C = A @ B
exportar('C')                       # se guarda en el mismo .xlsx

Notas del modo Excel:

  • Solo archivos .xlsx (no .xls antiguo)
  • Si el archivo tiene fórmulas, debe haberse guardado desde Excel al menos una vez para que Python pueda leer los valores calculados
  • exportar() crea el archivo si no existe

Verificar Variables

# Ver qué variables están disponibles para exportar
listar_variables_exportables()

❓ Solución de Problemas

Error: "No se pudo abrir 'matrices'"

  • ✅ Verificar que el Google Sheet existe
  • ✅ Verificar que se llama exactamente 'matrices'
  • ✅ Verificar permisos de acceso

Importa las matrices de OTRO archivo (no el que quiero)

  • ✅ El paquete siempre usa el archivo activo (por defecto matrices)
  • ✅ Cambiar con cambiar_sheet('mi_archivo') o configurar(sheet='mi_archivo')
  • ✅ Ver qué archivo está activo: aparece en los mensajes de importar() y workspace()

Error: "Variable no encontrada"

  • ✅ Ejecutar importar() antes de usar variables
  • ✅ Verificar nombres exactos con workspace()

Error de autenticación

  • ✅ Ejecutar configurar() nuevamente
  • ✅ En Colab: Runtime → Restart and run all

🔄 Actualización

pip install --upgrade algebra-lineal-sheets

📦 Requisitos

  • Python 3.8+
  • numpy >= 1.20.0
  • gspread >= 5.0.0
  • google-auth >= 2.0.0
  • openpyxl >= 3.0.0 (para el modo Excel local)

Se instalan automáticamente con el paquete.

📄 Licencia

MIT License - Ver LICENSE para más detalles.

🤝 Contribuir

¡Las contribuciones son bienvenidas!

📧 Contacto

🔗 Enlaces Útiles


¡Si te resulta útil, compártelo con otros profesores!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

algebra_lineal_sheets-1.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

algebra_lineal_sheets-1.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file algebra_lineal_sheets-1.1.0.tar.gz.

File metadata

  • Download URL: algebra_lineal_sheets-1.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for algebra_lineal_sheets-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6fed18fcc8211b1bb4bc6ff0c0a43b07ae10aee06d8c2ed819b849b2af8950a8
MD5 45701f3b721b7f41f48ed4362ff348f8
BLAKE2b-256 6d43bc942b5e5aaa2a32ccc5394d2ba78623501cec219f3068286b1a0a359b81

See more details on using hashes here.

File details

Details for the file algebra_lineal_sheets-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for algebra_lineal_sheets-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd1674909b1b37dc5c6c41d2eaf5f1c7aa3e72a35b4220544a3a3dfa420fd8dd
MD5 d2744aaa3fe27f2db7191fc951c6607c
BLAKE2b-256 c25e0ce22a93d1deb42ffa2de60760a8892cc2f8596c80c5abd5e959d2e4a4d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page