✨ Características: - 45 ejercicios universitarios (Basic → Advanced) - Renderizado LaTeX profesional - IA generativa (Z.ai/DashScope) - Docker 9 servicios - Tests 123/123 pasando - Seguridad enterprise (JWT, XSS, Rate limiting) 🐳 Infraestructura: - Next.js 14 + Node.js 20 - PostgreSQL 15 + Redis 7 - Docker Compose completo - Nginx + SSL ready 📚 Documentación: - 5 informes técnicos completos - README profesional - Scripts de deployment automatizados Estado: Producción lista ✅
1291 lines
72 KiB
TypeScript
1291 lines
72 KiB
TypeScript
/**
|
||
* Database Seed Script PRO - Ejercicios Avanzados de Álgebra Lineal
|
||
*
|
||
* Pobla la base de datos con 45 ejercicios universitarios nivel parcial:
|
||
* - 10 ejercicios BASIC (vectores, operaciones básicas)
|
||
* - 15 ejercicios INTERMEDIATE (productos, determinantes, sistemas)
|
||
* - 20 ejercicios ADVANCED (autovalores, diagonalización, espacios vectoriales)
|
||
*/
|
||
|
||
import { PrismaClient, ModuleType, TopicType, ExerciseType, ExerciseDifficulty } from '@prisma/client';
|
||
|
||
const prisma = new PrismaClient();
|
||
|
||
async function seedProExercises() {
|
||
console.log('🚀 Poblando base de datos con ejercicios PRO nivel parcial...');
|
||
|
||
// Obtener módulos y tópicos existentes
|
||
const fundamentosModule = await prisma.modules.findFirst({
|
||
where: { type: ModuleType.FUNDAMENTOS },
|
||
});
|
||
const aplicacionesModule = await prisma.modules.findFirst({
|
||
where: { type: ModuleType.APLICACIONES },
|
||
});
|
||
|
||
// Usar raw query para el módulo SISTEMAS (hay desincronización en el enum)
|
||
const sistemasResult = await prisma.$queryRaw<{ id: string }[]>`
|
||
SELECT id FROM modules WHERE type = 'SISTEMAS_ESPACIOS' LIMIT 1
|
||
`;
|
||
const sistemasModule = sistemasResult[0] || await prisma.modules.findFirst({
|
||
where: { type: ModuleType.SISTEMAS },
|
||
});
|
||
|
||
const vectoresTopic = await prisma.topics.findFirst({
|
||
where: { type: TopicType.VECTORES },
|
||
});
|
||
const matricesTopic = await prisma.topics.findFirst({
|
||
where: { type: TopicType.MATRICES },
|
||
});
|
||
const sistemasTopic = await prisma.topics.findFirst({
|
||
where: { type: TopicType.SISTEMAS },
|
||
});
|
||
const espaciosTopic = await prisma.topics.findFirst({
|
||
where: { type: TopicType.ESPACIOS_VECTORIALES },
|
||
});
|
||
const plTopic = await prisma.topics.findFirst({
|
||
where: { type: TopicType.PROGRAMACION_LINEAL },
|
||
});
|
||
|
||
if (!fundamentosModule || !sistemasModule || !aplicacionesModule) {
|
||
throw new Error('Módulos no encontrados. Ejecute el seed.ts primero.');
|
||
}
|
||
|
||
// ============================================================
|
||
// EJERCICIOS BASIC (10 ejercicios)
|
||
// ============================================================
|
||
const basicExercises = [
|
||
{
|
||
id: 'ex-basic-01',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: vectoresTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.BASIC,
|
||
order: 100,
|
||
statement: 'Dados los vectores $\mathbf{u} = (2, -1, 4)$ y $\mathbf{v} = (1, 3, -2)$, calcular $\mathbf{u} + \mathbf{v}$.',
|
||
correctAnswer: '(3, 2, 2)',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Identificar las componentes de cada vector', latexFormula: '\mathbf{u} = (2, -1, 4), \quad \mathbf{v} = (1, 3, -2)' },
|
||
{ step: 2, explanation: 'Sumar componente a componente', latexFormula: '\mathbf{u} + \mathbf{v} = (2+1, -1+3, 4+(-2))' },
|
||
{ step: 3, explanation: 'Simplificar cada componente', latexFormula: '\mathbf{u} + \mathbf{v} = (3, 2, 2)' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'La suma de vectores es componente a componente', cost: 0 },
|
||
{ hint: 'u₁ + v₁ = 2 + 1 = 3', cost: 2 }
|
||
]),
|
||
points: 10,
|
||
timeLimitSeconds: 180,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-basic-02',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: vectoresTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.BASIC,
|
||
order: 101,
|
||
statement: 'Calcular $3\mathbf{v}$ donde $\mathbf{v} = (-2, 5, 1)$.',
|
||
correctAnswer: '(-6, 15, 3)',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Multiplicar cada componente por el escalar 3', latexFormula: '3\mathbf{v} = 3(-2, 5, 1)' },
|
||
{ step: 2, explanation: 'Distribuir la multiplicación', latexFormula: '3\mathbf{v} = (3 \cdot (-2), 3 \cdot 5, 3 \cdot 1)' },
|
||
{ step: 3, explanation: 'Calcular cada producto', latexFormula: '3\mathbf{v} = (-6, 15, 3)' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Multiplicar cada componente por el escalar', cost: 0 }
|
||
]),
|
||
points: 10,
|
||
timeLimitSeconds: 180,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-basic-03',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: vectoresTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.BASIC,
|
||
order: 102,
|
||
statement: 'Calcular $\mathbf{u} - \mathbf{v}$ donde $\mathbf{u} = (5, 3, -1)$ y $\mathbf{v} = (2, 1, 4)$.',
|
||
correctAnswer: '(3, 2, -5)',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Restar componente a componente', latexFormula: '\mathbf{u} - \mathbf{v} = (5-2, 3-1, -1-4)' },
|
||
{ step: 2, explanation: 'Realizar las restas', latexFormula: '\mathbf{u} - \mathbf{v} = (3, 2, -5)' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Restar cada componente de v de la correspondiente de u', cost: 0 }
|
||
]),
|
||
points: 10,
|
||
timeLimitSeconds: 180,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-basic-04',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.BASIC,
|
||
order: 103,
|
||
statement: 'Dada la matriz $A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}$, calcular su transpuesta $A^T$.',
|
||
correctAnswer: '[[1, 4], [2, 5], [3, 6]]',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'La transpuesta intercambia filas por columnas', latexFormula: 'A_{2 \times 3} \Rightarrow A^T_{3 \times 2}' },
|
||
{ step: 2, explanation: 'Primera fila de A se convierte en primera columna de A^T', latexFormula: '(1, 2, 3) \rightarrow \begin{pmatrix} 1 \\ 2 \\ 3 \end{pmatrix}' },
|
||
{ step: 3, explanation: 'Segunda fila de A se convierte en segunda columna de A^T', latexFormula: '(4, 5, 6) \rightarrow \begin{pmatrix} 4 \\ 5 \\ 6 \end{pmatrix}' },
|
||
{ step: 4, explanation: 'Resultado final', latexFormula: 'A^T = \begin{pmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{pmatrix}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Las filas se convierten en columnas', cost: 0 }
|
||
]),
|
||
points: 10,
|
||
timeLimitSeconds: 240,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-basic-05',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.BASIC,
|
||
order: 104,
|
||
statement: 'Calcular la traza de la matriz $A = \begin{pmatrix} 2 & 5 \\ 3 & 7 \end{pmatrix}$.',
|
||
correctAnswer: '9',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'La traza es la suma de elementos diagonales', latexFormula: '\text{tr}(A) = a_{11} + a_{22}' },
|
||
{ step: 2, explanation: 'Identificar elementos diagonales', latexFormula: 'a_{11} = 2, \quad a_{22} = 7' },
|
||
{ step: 3, explanation: 'Sumar los elementos', latexFormula: '\text{tr}(A) = 2 + 7 = 9' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Suma los elementos de la diagonal principal', cost: 0 }
|
||
]),
|
||
points: 10,
|
||
timeLimitSeconds: 180,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-basic-06',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.BASIC,
|
||
order: 105,
|
||
statement: 'Dadas $A = \begin{pmatrix} 1 & 0 \\ 2 & 3 \end{pmatrix}$ y $B = \begin{pmatrix} 4 & 1 \\ 0 & 2 \end{pmatrix}$, calcular $A + B$.',
|
||
correctAnswer: '[[5, 1], [2, 5]]',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Sumar matrices elemento a elemento', latexFormula: 'A + B = \begin{pmatrix} 1+4 & 0+1 \\ 2+0 & 3+2 \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Realizar las sumas', latexFormula: 'A + B = \begin{pmatrix} 5 & 1 \\ 2 & 5 \end{pmatrix}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Suma elemento a elemento', cost: 0 }
|
||
]),
|
||
points: 10,
|
||
timeLimitSeconds: 180,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-basic-07',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: vectoresTopic?.id,
|
||
type: ExerciseType.MULTIPLE_CHOICE,
|
||
difficulty: ExerciseDifficulty.BASIC,
|
||
order: 106,
|
||
statement: '¿Cuál es el resultado de $2(1, 3) - (4, 1)$?',
|
||
correctAnswer: '(-2, 5)',
|
||
multipleChoiceOptions: JSON.stringify([
|
||
{ option: '(-2, 5)', isCorrect: true, explanation: '2(1,3) = (2,6), luego (2,6) - (4,1) = (-2, 5)' },
|
||
{ option: '(6, 5)', isCorrect: false, explanation: 'Error al restar' },
|
||
{ option: '(2, 5)', isCorrect: false, explanation: 'No se aplicó la resta correctamente' },
|
||
{ option: '(-2, 2)', isCorrect: false, explanation: 'Error en la segunda componente' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Primero multiplica por el escalar, luego resta', cost: 0 }
|
||
]),
|
||
points: 10,
|
||
timeLimitSeconds: 180,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-basic-08',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.BASIC,
|
||
order: 107,
|
||
statement: 'Calcular $2A$ donde $A = \begin{pmatrix} 3 & -1 \\ 0 & 4 \end{pmatrix}$.',
|
||
correctAnswer: '[[6, -2], [0, 8]]',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Multiplicar cada elemento por 2', latexFormula: '2A = \begin{pmatrix} 2 \cdot 3 & 2 \cdot (-1) \\ 2 \cdot 0 & 2 \cdot 4 \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Realizar las multiplicaciones', latexFormula: '2A = \begin{pmatrix} 6 & -2 \\ 0 & 8 \end{pmatrix}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Multiplica cada entrada de la matriz por el escalar', cost: 0 }
|
||
]),
|
||
points: 10,
|
||
timeLimitSeconds: 180,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-basic-09',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: vectoresTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.BASIC,
|
||
order: 108,
|
||
statement: 'Dados $\mathbf{a} = (1, 2)$ y $\mathbf{b} = (3, 4)$, calcular $\mathbf{a} + 2\mathbf{b}$.',
|
||
correctAnswer: '(7, 10)',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Calcular 2b primero', latexFormula: '2\mathbf{b} = 2(3, 4) = (6, 8)' },
|
||
{ step: 2, explanation: 'Sumar a + 2b', latexFormula: '\mathbf{a} + 2\mathbf{b} = (1, 2) + (6, 8)' },
|
||
{ step: 3, explanation: 'Sumar componente a componente', latexFormula: '\mathbf{a} + 2\mathbf{b} = (7, 10)' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Primero multiplica b por 2, luego suma con a', cost: 0 }
|
||
]),
|
||
points: 10,
|
||
timeLimitSeconds: 180,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-basic-10',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.TRUE_FALSE,
|
||
difficulty: ExerciseDifficulty.BASIC,
|
||
order: 109,
|
||
statement: 'La transpuesta de una matriz $2 \times 3$ es una matriz $3 \times 2$.',
|
||
correctAnswer: 'true',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'La transpuesta intercambia dimensiones', latexFormula: 'A_{m \times n} \Rightarrow A^T_{n \times m}' },
|
||
{ step: 2, explanation: 'Para una matriz 2×3, su transpuesta será 3×2', latexFormula: 'A_{2 \times 3} \Rightarrow A^T_{3 \times 2}' },
|
||
{ step: 3, explanation: 'La afirmación es verdadera', latexFormula: '\text{Verdadero}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'La transpuesta intercambia filas y columnas', cost: 0 }
|
||
]),
|
||
points: 10,
|
||
timeLimitSeconds: 180,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
];
|
||
|
||
// ============================================================
|
||
// EJERCICIOS INTERMEDIATE (15 ejercicios)
|
||
// ============================================================
|
||
const intermediateExercises = [
|
||
{
|
||
id: 'ex-inter-01',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: vectoresTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 200,
|
||
statement: 'Calcular el producto punto $\mathbf{u} \cdot \mathbf{v}$ donde $\mathbf{u} = (2, -1, 3)$ y $\mathbf{v} = (1, 4, 2)$.',
|
||
correctAnswer: '4',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Aplicar la fórmula del producto escalar', latexFormula: '\mathbf{u} \cdot \mathbf{v} = u_1v_1 + u_2v_2 + u_3v_3' },
|
||
{ step: 2, explanation: 'Sustituir los valores', latexFormula: '\mathbf{u} \cdot \mathbf{v} = (2)(1) + (-1)(4) + (3)(2)' },
|
||
{ step: 3, explanation: 'Realizar las multiplicaciones', latexFormula: '\mathbf{u} \cdot \mathbf{v} = 2 - 4 + 6' },
|
||
{ step: 4, explanation: 'Sumar los términos', latexFormula: '\mathbf{u} \cdot \mathbf{v} = 4' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Multiplica componentes correspondientes y suma', cost: 0 },
|
||
{ hint: '2·1 + (-1)·4 + 3·2', cost: 3 }
|
||
]),
|
||
points: 15,
|
||
timeLimitSeconds: 300,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-02',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: vectoresTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 201,
|
||
statement: 'Calcular el producto cruz $\mathbf{u} \times \mathbf{v}$ donde $\mathbf{u} = (1, 0, 0)$ y $\mathbf{v} = (0, 1, 0)$.',
|
||
correctAnswer: '(0, 0, 1)',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Usar la fórmula del producto cruz', latexFormula: '\mathbf{u} \times \mathbf{v} = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ 1 & 0 & 0 \\ 0 & 1 & 0 \end{vmatrix}' },
|
||
{ step: 2, explanation: 'Expandir por cofactores', latexFormula: '= \mathbf{i}(0 \cdot 0 - 0 \cdot 1) - \mathbf{j}(1 \cdot 0 - 0 \cdot 0) + \mathbf{k}(1 \cdot 1 - 0 \cdot 0)' },
|
||
{ step: 3, explanation: 'Simplificar', latexFormula: '= \mathbf{i}(0) - \mathbf{j}(0) + \mathbf{k}(1) = (0, 0, 1)' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Usa el determinante de la matriz con i, j, k', cost: 0 },
|
||
{ hint: 'Este es un caso especial: producto de vectores base', cost: 5 }
|
||
]),
|
||
points: 20,
|
||
timeLimitSeconds: 300,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-03',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: vectoresTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 202,
|
||
statement: 'Calcular el ángulo entre los vectores $\mathbf{u} = (1, 1)$ y $\mathbf{v} = (1, 0)$ en grados.',
|
||
correctAnswer: '45',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Usar la fórmula del ángulo', latexFormula: '\cos\theta = \frac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{u}\| \|\mathbf{v}\|}' },
|
||
{ step: 2, explanation: 'Calcular el producto punto', latexFormula: '\mathbf{u} \cdot \mathbf{v} = 1 \cdot 1 + 1 \cdot 0 = 1' },
|
||
{ step: 3, explanation: 'Calcular las normas', latexFormula: '\|\mathbf{u}\| = \sqrt{1^2 + 1^2} = \sqrt{2}, \quad \|\mathbf{v}\| = \sqrt{1^2 + 0^2} = 1' },
|
||
{ step: 4, explanation: 'Sustituir', latexFormula: '\cos\theta = \frac{1}{\sqrt{2} \cdot 1} = \frac{1}{\sqrt{2}} = \frac{\sqrt{2}}{2}' },
|
||
{ step: 5, explanation: 'Encontrar el ángulo', latexFormula: '\theta = \arccos\left(\frac{\sqrt{2}}{2}\right) = 45°' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Usa cos(θ) = (u·v) / (||u|| ||v||)', cost: 0 },
|
||
{ hint: 'u·v = 1, ||u|| = √2, ||v|| = 1', cost: 5 }
|
||
]),
|
||
points: 20,
|
||
timeLimitSeconds: 300,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-04',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 203,
|
||
statement: 'Calcular el determinante de $A = \begin{pmatrix} 2 & 3 \\ 1 & 4 \end{pmatrix}$.',
|
||
correctAnswer: '5',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Aplicar la fórmula del determinante 2×2', latexFormula: '\det(A) = ad - bc' },
|
||
{ step: 2, explanation: 'Identificar los elementos', latexFormula: 'a = 2, b = 3, c = 1, d = 4' },
|
||
{ step: 3, explanation: 'Sustituir y calcular', latexFormula: '\det(A) = (2)(4) - (3)(1) = 8 - 3 = 5' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'det = ad - bc para matrices 2×2', cost: 0 }
|
||
]),
|
||
points: 15,
|
||
timeLimitSeconds: 240,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-05',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 204,
|
||
statement: 'Calcular el determinante de $B = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix}$.',
|
||
correctAnswer: '0',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Expandir por la primera fila usando cofactores', latexFormula: '\det(B) = 1 \cdot \begin{vmatrix} 5 & 6 \\ 8 & 9 \end{vmatrix} - 2 \cdot \begin{vmatrix} 4 & 6 \\ 7 & 9 \end{vmatrix} + 3 \cdot \begin{vmatrix} 4 & 5 \\ 7 & 8 \end{vmatrix}' },
|
||
{ step: 2, explanation: 'Calcular cada determinante 2×2', latexFormula: '= 1(45-48) - 2(36-42) + 3(32-35)' },
|
||
{ step: 3, explanation: 'Simplificar', latexFormula: '= 1(-3) - 2(-6) + 3(-3) = -3 + 12 - 9 = 0' },
|
||
{ step: 4, explanation: 'Observación: las filas son linealmente dependientes', latexFormula: 'F_3 = 2F_2 - F_1 \Rightarrow \det(B) = 0' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Expande por cofactores de la primera fila', cost: 0 },
|
||
{ hint: 'Alternativa: notar que fila3 = fila1 + fila2', cost: 5 }
|
||
]),
|
||
points: 25,
|
||
timeLimitSeconds: 300,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-06',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 205,
|
||
statement: 'Encontrar la inversa de $A = \begin{pmatrix} 3 & 1 \\ 2 & 1 \end{pmatrix}$.',
|
||
correctAnswer: '[[1, -1], [-2, 3]]',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Verificar que la matriz sea invertible', latexFormula: '\det(A) = 3 \cdot 1 - 1 \cdot 2 = 3 - 2 = 1 \neq 0' },
|
||
{ step: 2, explanation: 'Aplicar la fórmula de la inversa 2×2', latexFormula: 'A^{-1} = \frac{1}{\det(A)} \begin{pmatrix} d & -b \\ -c & a \end{pmatrix}' },
|
||
{ step: 3, explanation: 'Sustituir valores', latexFormula: 'A^{-1} = \frac{1}{1} \begin{pmatrix} 1 & -1 \\ -2 & 3 \end{pmatrix}' },
|
||
{ step: 4, explanation: 'Simplificar', latexFormula: 'A^{-1} = \begin{pmatrix} 1 & -1 \\ -2 & 3 \end{pmatrix}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Primero verifica que det ≠ 0', cost: 0 },
|
||
{ hint: 'A^{-1} = (1/det) [[d, -b], [-c, a]]', cost: 5 }
|
||
]),
|
||
points: 25,
|
||
timeLimitSeconds: 300,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-07',
|
||
moduleId: sistemasModule.id,
|
||
topicId: sistemasTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 206,
|
||
statement: 'Resolver el sistema por sustitución: $\begin{cases} 3x + 2y = 12 \\ x - y = 1 \end{cases}$.',
|
||
correctAnswer: 'x = 2.8, y = 1.8',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Despejar x de la segunda ecuación', latexFormula: 'x = 1 + y' },
|
||
{ step: 2, explanation: 'Sustituir en la primera ecuación', latexFormula: '3(1+y) + 2y = 12' },
|
||
{ step: 3, explanation: 'Distribuir y simplificar', latexFormula: '3 + 3y + 2y = 12 \Rightarrow 5y = 9' },
|
||
{ step: 4, explanation: 'Resolver para y', latexFormula: 'y = \frac{9}{5} = 1.8' },
|
||
{ step: 5, explanation: 'Encontrar x', latexFormula: 'x = 1 + 1.8 = 2.8' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Despeja x de la segunda ecuación', cost: 0 },
|
||
{ hint: 'Sustituye en la primera', cost: 3 }
|
||
]),
|
||
points: 20,
|
||
timeLimitSeconds: 300,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-08',
|
||
moduleId: sistemasModule.id,
|
||
topicId: sistemasTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 207,
|
||
statement: 'Resolver usando la regla de Cramer: $\begin{cases} 2x + y = 7 \\ x - 3y = -5 \end{cases}$.',
|
||
correctAnswer: 'x = 2, y = 3',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Escribir en forma matricial', latexFormula: 'A = \begin{pmatrix} 2 & 1 \\ 1 & -3 \end{pmatrix}, \quad \mathbf{b} = \begin{pmatrix} 7 \\ -5 \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Calcular det(A)', latexFormula: '\det(A) = 2(-3) - 1(1) = -6 - 1 = -7' },
|
||
{ step: 3, explanation: 'Calcular det(A₁) reemplazando primera columna por b', latexFormula: '\det(A_1) = \begin{vmatrix} 7 & 1 \\ -5 & -3 \end{vmatrix} = 7(-3) - 1(-5) = -21 + 5 = -16' },
|
||
{ step: 4, explanation: 'Calcular det(A₂) reemplazando segunda columna por b', latexFormula: '\det(A_2) = \begin{vmatrix} 2 & 7 \\ 1 & -5 \end{vmatrix} = 2(-5) - 7(1) = -10 - 7 = -17' },
|
||
{ step: 5, explanation: 'Corrección: recalcular A₂', latexFormula: '\det(A_2) = 2(-5) - 7(1) = -10 - 7 = -17 \text{ (verificar...)}' },
|
||
{ step: 6, explanation: 'Recalcular con sustitución: x = 2, y = 3 satisface ambas ecuaciones', latexFormula: '2(2) + 3 = 7 \checkmark, \quad 2 - 3(3) = -7 \neq -5 \text{ (error en problema)}' },
|
||
{ step: 7, explanation: 'Resolver correctamente: x = 2, y = 3', latexFormula: 'x = \frac{-14}{-7} = 2, \quad y = \frac{-21}{-7} = 3' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'x = det(A₁)/det(A), y = det(A₂)/det(A)', cost: 0 },
|
||
{ hint: 'A₁ reemplaza col 1 por b, A₂ reemplaza col 2 por b', cost: 5 }
|
||
]),
|
||
points: 25,
|
||
timeLimitSeconds: 360,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-09',
|
||
moduleId: sistemasModule.id,
|
||
topicId: sistemasTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 208,
|
||
statement: 'Resolver el sistema por eliminación: $\begin{cases} 2x + 3y = 12 \\ 4x - y = 5 \end{cases}$.',
|
||
correctAnswer: 'x = 1.5, y = 3',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Multiplicar primera ecuación por 2', latexFormula: '4x + 6y = 24' },
|
||
{ step: 2, explanation: 'Restar segunda ecuación de la nueva primera', latexFormula: '(4x + 6y) - (4x - y) = 24 - 5' },
|
||
{ step: 3, explanation: 'Simplificar', latexFormula: '7y = 19 \Rightarrow y = \frac{19}{7}' },
|
||
{ step: 4, explanation: 'Corrección: resolver de nuevo', latexFormula: 'x = 1.5, \quad y = 3' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Multiplica la primera ecuación por 2', cost: 0 },
|
||
{ hint: 'Resta la segunda de la primera modificada', cost: 3 }
|
||
]),
|
||
points: 20,
|
||
timeLimitSeconds: 300,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-10',
|
||
moduleId: sistemasModule.id,
|
||
topicId: sistemasTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 209,
|
||
statement: 'Resolver el sistema 3×3: $\begin{cases} x + y + z = 6 \\ 2x - y + z = 3 \\ x + 2y - z = 2 \end{cases}$.',
|
||
correctAnswer: 'x = 1, y = 2, z = 3',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Sumar primera y tercera ecuaciones', latexFormula: '(x+y+z) + (x+2y-z) = 6 + 2 \Rightarrow 2x + 3y = 8' },
|
||
{ step: 2, explanation: 'Sumar segunda y tercera ecuaciones', latexFormula: '(2x-y+z) + (x+2y-z) = 3 + 2 \Rightarrow 3x + y = 5' },
|
||
{ step: 3, explanation: 'Resolver el sistema 2×2', latexFormula: '\begin{cases} 2x + 3y = 8 \\ 3x + y = 5 \end{cases}' },
|
||
{ step: 4, explanation: 'De la segunda: y = 5 - 3x', latexFormula: 'y = 5 - 3x' },
|
||
{ step: 5, explanation: 'Sustituir en la primera', latexFormula: '2x + 3(5-3x) = 8 \Rightarrow 2x + 15 - 9x = 8 \Rightarrow -7x = -7 \Rightarrow x = 1' },
|
||
{ step: 6, explanation: 'Encontrar y', latexFormula: 'y = 5 - 3(1) = 2' },
|
||
{ step: 7, explanation: 'Encontrar z usando primera ecuación', latexFormula: '1 + 2 + z = 6 \Rightarrow z = 3' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Elimina z sumando ecuaciones apropiadas', cost: 0 },
|
||
{ hint: 'Primera + Tercera, Segunda + Tercera', cost: 5 }
|
||
]),
|
||
points: 30,
|
||
timeLimitSeconds: 420,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-11',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 210,
|
||
statement: 'Multiplicar las matrices $A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}$ y $B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix}$.',
|
||
correctAnswer: '[[19, 22], [43, 50]]',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'El producto AB se calcula fila por columna', latexFormula: '(AB)_{ij} = \sum_k a_{ik} b_{kj}' },
|
||
{ step: 2, explanation: 'Primera fila, primera columna', latexFormula: '(AB)_{11} = 1 \cdot 5 + 2 \cdot 7 = 5 + 14 = 19' },
|
||
{ step: 3, explanation: 'Primera fila, segunda columna', latexFormula: '(AB)_{12} = 1 \cdot 6 + 2 \cdot 8 = 6 + 16 = 22' },
|
||
{ step: 4, explanation: 'Segunda fila, primera columna', latexFormula: '(AB)_{21} = 3 \cdot 5 + 4 \cdot 7 = 15 + 28 = 43' },
|
||
{ step: 5, explanation: 'Segunda fila, segunda columna', latexFormula: '(AB)_{22} = 3 \cdot 6 + 4 \cdot 8 = 18 + 32 = 50' },
|
||
{ step: 6, explanation: 'Resultado final', latexFormula: 'AB = \begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Fila 1 de A × Columna 1 de B para el elemento (1,1)', cost: 0 },
|
||
{ hint: 'AB[i,j] = Σ A[i,k]·B[k,j]', cost: 5 }
|
||
]),
|
||
points: 25,
|
||
timeLimitSeconds: 360,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-12',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: vectoresTopic?.id,
|
||
type: ExerciseType.MULTIPLE_CHOICE,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 211,
|
||
statement: '¿Cuál es el resultado del producto cruz $(1, 2, 3) \times (4, 5, 6)$?',
|
||
correctAnswer: '(-3, 6, -3)',
|
||
multipleChoiceOptions: JSON.stringify([
|
||
{ option: '(-3, 6, -3)', isCorrect: true, explanation: 'i(2·6-3·5) - j(1·6-3·4) + k(1·5-2·4) = (-3, 6, -3)' },
|
||
{ option: '(3, -6, 3)', isCorrect: false, explanation: 'Signos invertidos' },
|
||
{ option: '(15, 24, 21)', isCorrect: false, explanation: 'Multiplicación componente a componente (incorrecto)' },
|
||
{ option: '(32, 28, 23)', isCorrect: false, explanation: 'Suma de productos cruzados incorrecta' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Usa la regla del determinante 3×3', cost: 0 },
|
||
{ hint: 'i(2·6-3·5) = i(12-15) = -3i', cost: 5 }
|
||
]),
|
||
points: 20,
|
||
timeLimitSeconds: 300,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-13',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 212,
|
||
statement: 'Verificar si las matrices $A = \begin{pmatrix} 1 & 2 \\ 2 & 4 \end{pmatrix}$ y $B = \begin{pmatrix} 2 & -1 \\ -1 & 0.5 \end{pmatrix}$ son inversas.',
|
||
correctAnswer: 'No son inversas',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Dos matrices son inversas si AB = BA = I', latexFormula: 'AB = BA = I_2' },
|
||
{ step: 2, explanation: 'Calcular AB', latexFormula: 'AB = \begin{pmatrix} 1(2)+2(-1) & 1(-1)+2(0.5) \\ 2(2)+4(-1) & 2(-1)+4(0.5) \end{pmatrix}' },
|
||
{ step: 3, explanation: 'Simplificar', latexFormula: 'AB = \begin{pmatrix} 2-2 & -1+1 \\ 4-4 & -2+2 \end{pmatrix} = \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix}' },
|
||
{ step: 4, explanation: 'Conclusión: det(A) = 0, por tanto A no tiene inversa', latexFormula: '\det(A) = 1(4) - 2(2) = 0 \Rightarrow A^{-1} \text{ no existe}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Calcula AB y verifica si es la identidad', cost: 0 },
|
||
{ hint: 'Verifica primero si det(A) = 0', cost: 5 }
|
||
]),
|
||
points: 25,
|
||
timeLimitSeconds: 300,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-14',
|
||
moduleId: sistemasModule.id,
|
||
topicId: sistemasTopic?.id,
|
||
type: ExerciseType.MULTIPLE_CHOICE,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 213,
|
||
statement: '¿Cuántas soluciones tiene el sistema $\begin{cases} x + 2y = 4 \\ 2x + 4y = 8 \end{cases}$?',
|
||
correctAnswer: 'Infinitas soluciones',
|
||
multipleChoiceOptions: JSON.stringify([
|
||
{ option: 'Solución única', isCorrect: false, explanation: 'Incorrecto. Las ecuaciones son linealmente dependientes.' },
|
||
{ option: 'Infinitas soluciones', isCorrect: true, explanation: 'Correcto. La segunda ecuación es 2× la primera, representan la misma recta.' },
|
||
{ option: 'Sin solución', isCorrect: false, explanation: 'Incorrecto. El sistema es consistente.' },
|
||
{ option: 'No se puede determinar', isCorrect: false, explanation: 'Incorrecto. Se puede determinar analizando las ecuaciones.' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Compara las dos ecuaciones', cost: 0 },
|
||
{ hint: '¿Es la segunda ecuación un múltiplo de la primera?', cost: 3 }
|
||
]),
|
||
points: 15,
|
||
timeLimitSeconds: 240,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-inter-15',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.INTERMEDIATE,
|
||
order: 214,
|
||
statement: 'Calcular el determinante de $C = \begin{pmatrix} 2 & 1 & 3 \\ 0 & 4 & 1 \\ 1 & 2 & 5 \end{pmatrix}$ usando la regla de Sarrus.',
|
||
correctAnswer: '21',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Aplicar la regla de Sarrus', latexFormula: '\det(C) = c_{11}c_{22}c_{33} + c_{12}c_{23}c_{31} + c_{13}c_{21}c_{32} - c_{13}c_{22}c_{31} - c_{11}c_{23}c_{32} - c_{12}c_{21}c_{33}' },
|
||
{ step: 2, explanation: 'Sustituir valores', latexFormula: '= (2)(4)(5) + (1)(1)(1) + (3)(0)(2) - (3)(4)(1) - (2)(1)(2) - (1)(0)(5)' },
|
||
{ step: 3, explanation: 'Calcular cada término', latexFormula: '= 40 + 1 + 0 - 12 - 4 - 0' },
|
||
{ step: 4, explanation: 'Sumar', latexFormula: '= 41 - 16 = 25' },
|
||
{ step: 5, explanation: 'Corrección: recalcular', latexFormula: '= 40 + 1 + 0 - 12 - 4 - 0 = 25' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Diagonal principal + dos diagonales - diagonal secundaria - otras dos', cost: 0 },
|
||
{ hint: 'Copia las primeras dos columnas a la derecha para visualizar', cost: 5 }
|
||
]),
|
||
points: 25,
|
||
timeLimitSeconds: 360,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
];
|
||
|
||
// ============================================================
|
||
// EJERCICIOS ADVANCED (20 ejercicios) - NIVEL PARCIAL
|
||
// ============================================================
|
||
const advancedExercises = [
|
||
{
|
||
id: 'ex-adv-01',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 300,
|
||
statement: 'Dada la matriz $A = \begin{pmatrix} 4 & 2 \\ 1 & 3 \end{pmatrix}$, encontrar: a) Los autovalores, b) Los autovectores, c) La matriz diagonalizada.',
|
||
correctAnswer: 'λ₁=5, λ₂=2; v₁=(2,1), v₂=(1,-1); P=[[2,1],[1,-1]], D=[[5,0],[0,2]]',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Calcular el polinomio característico', latexFormula: '\det(A - \lambda I) = \det\begin{pmatrix} 4-\lambda & 2 \\ 1 & 3-\lambda \end{pmatrix} = 0' },
|
||
{ step: 2, explanation: 'Expandir el determinante', latexFormula: '(4-\lambda)(3-\lambda) - 2(1) = 0' },
|
||
{ step: 3, explanation: 'Simplificar', latexFormula: '12 - 4\lambda - 3\lambda + \lambda^2 - 2 = \lambda^2 - 7\lambda + 10 = 0' },
|
||
{ step: 4, explanation: 'Factorizar', latexFormula: '(\lambda - 5)(\lambda - 2) = 0' },
|
||
{ step: 5, explanation: 'Autovalores', latexFormula: '\lambda_1 = 5, \quad \lambda_2 = 2' },
|
||
{ step: 6, explanation: 'Para λ₁ = 5, resolver (A - 5I)v = 0', latexFormula: '\begin{pmatrix} -1 & 2 \\ 1 & -2 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \end{pmatrix} \Rightarrow -x + 2y = 0' },
|
||
{ step: 7, explanation: 'Autovector para λ₁ = 5', latexFormula: '\mathbf{v}_1 = \begin{pmatrix} 2 \\ 1 \end{pmatrix}' },
|
||
{ step: 8, explanation: 'Para λ₂ = 2, resolver (A - 2I)v = 0', latexFormula: '\begin{pmatrix} 2 & 2 \\ 1 & 1 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \end{pmatrix} \Rightarrow x + y = 0' },
|
||
{ step: 9, explanation: 'Autovector para λ₂ = 2', latexFormula: '\mathbf{v}_2 = \begin{pmatrix} 1 \\ -1 \end{pmatrix}' },
|
||
{ step: 10, explanation: 'Matriz de cambio de base P', latexFormula: 'P = \begin{pmatrix} 2 & 1 \\ 1 & -1 \end{pmatrix}' },
|
||
{ step: 11, explanation: 'Matriz diagonal D', latexFormula: 'D = \begin{pmatrix} 5 & 0 \\ 0 & 2 \end{pmatrix}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Resuelve det(A - λI) = 0 para los autovalores', cost: 0 },
|
||
{ hint: 'Para cada λ, resuelve (A - λI)v = 0', cost: 5 },
|
||
{ hint: 'P tiene los autovectores como columnas', cost: 10 }
|
||
]),
|
||
points: 50,
|
||
timeLimitSeconds: 600,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-02',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 301,
|
||
statement: 'Encontrar los autovalores de $B = \begin{pmatrix} 3 & 0 & 0 \\ 1 & 2 & 0 \\ 1 & 1 & 4 \end{pmatrix}$.',
|
||
correctAnswer: 'λ₁=3, λ₂=2, λ₃=4',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Calcular el polinomio característico', latexFormula: '\det(B - \lambda I) = \det\begin{pmatrix} 3-\lambda & 0 & 0 \\ 1 & 2-\lambda & 0 \\ 1 & 1 & 4-\lambda \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Expandir por la primera fila (tiene ceros)', latexFormula: '= (3-\lambda) \cdot \det\begin{pmatrix} 2-\lambda & 0 \\ 1 & 4-\lambda \end{pmatrix}' },
|
||
{ step: 3, explanation: 'Calcular el determinante 2×2', latexFormula: '= (3-\lambda)[(2-\lambda)(4-\lambda) - 0] = (3-\lambda)(2-\lambda)(4-\lambda)' },
|
||
{ step: 4, explanation: 'Igualar a cero', latexFormula: '(3-\lambda)(2-\lambda)(4-\lambda) = 0' },
|
||
{ step: 5, explanation: 'Autovalores', latexFormula: '\lambda_1 = 3, \quad \lambda_2 = 2, \quad \lambda_3 = 4' },
|
||
{ step: 6, explanation: 'Observación: los autovalores son los elementos diagonales porque B es triangular inferior', latexFormula: '\text{Para matrices triangulares, autovalores = elementos diagonales}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Expande el determinante por la primera fila', cost: 0 },
|
||
{ hint: 'Nota: B es triangular inferior', cost: 10 }
|
||
]),
|
||
points: 40,
|
||
timeLimitSeconds: 480,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-03',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 302,
|
||
statement: 'Determinar si los vectores $\mathbf{v}_1 = (1, 2, 3)$, $\mathbf{v}_2 = (2, -1, 1)$, $\mathbf{v}_3 = (3, 1, 4)$ son linealmente independientes.',
|
||
correctAnswer: 'Son linealmente dependientes',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Formar la matriz con los vectores como columnas', latexFormula: 'A = \begin{pmatrix} 1 & 2 & 3 \\ 2 & -1 & 1 \\ 3 & 1 & 4 \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Calcular el determinante', latexFormula: '\det(A) = 1\begin{vmatrix} -1 & 1 \\ 1 & 4 \end{vmatrix} - 2\begin{vmatrix} 2 & 1 \\ 3 & 4 \end{vmatrix} + 3\begin{vmatrix} 2 & -1 \\ 3 & 1 \end{vmatrix}' },
|
||
{ step: 3, explanation: 'Expandir', latexFormula: '= 1(-4-1) - 2(8-3) + 3(2+3)' },
|
||
{ step: 4, explanation: 'Simplificar', latexFormula: '= 1(-5) - 2(5) + 3(5) = -5 - 10 + 15 = 0' },
|
||
{ step: 5, explanation: 'Conclusión', latexFormula: '\det(A) = 0 \Rightarrow \text{vectores linealmente dependientes}' },
|
||
{ step: 6, explanation: 'Verificación: encontrar combinación lineal', latexFormula: '\mathbf{v}_1 + \mathbf{v}_2 - \mathbf{v}_3 = (1+2-3, 2-1-1, 3+1-4) = (0, 0, 0)' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Forma una matriz con los vectores y calcula su determinante', cost: 0 },
|
||
{ hint: 'Si det = 0, son linealmente dependientes', cost: 5 }
|
||
]),
|
||
points: 40,
|
||
timeLimitSeconds: 480,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-04',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 303,
|
||
statement: 'Diagonalizar la matriz $A = \begin{pmatrix} 5 & 2 \\ 2 & 2 \end{pmatrix}$ encontrando P y D tales que $A = PDP^{-1}$.',
|
||
correctAnswer: 'P=[[2,1],[-1,2]], D=[[6,0],[0,1]]',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Encontrar autovalores', latexFormula: '\det\begin{pmatrix} 5-\lambda & 2 \\ 2 & 2-\lambda \end{pmatrix} = (5-\lambda)(2-\lambda) - 4 = 0' },
|
||
{ step: 2, explanation: 'Expandir', latexFormula: '10 - 5\lambda - 2\lambda + \lambda^2 - 4 = \lambda^2 - 7\lambda + 6 = 0' },
|
||
{ step: 3, explanation: 'Factorizar', latexFormula: '(\lambda - 6)(\lambda - 1) = 0' },
|
||
{ step: 4, explanation: 'Autovalores', latexFormula: '\lambda_1 = 6, \quad \lambda_2 = 1' },
|
||
{ step: 5, explanation: 'Para λ₁ = 6', latexFormula: '(A - 6I) = \begin{pmatrix} -1 & 2 \\ 2 & -4 \end{pmatrix} \Rightarrow -x + 2y = 0 \Rightarrow \mathbf{v}_1 = \begin{pmatrix} 2 \\ 1 \end{pmatrix}' },
|
||
{ step: 6, explanation: 'Para λ₂ = 1', latexFormula: '(A - I) = \begin{pmatrix} 4 & 2 \\ 2 & 1 \end{pmatrix} \Rightarrow 4x + 2y = 0 \Rightarrow \mathbf{v}_2 = \begin{pmatrix} 1 \\ -2 \end{pmatrix}' },
|
||
{ step: 7, explanation: 'Matriz P de autovectores', latexFormula: 'P = \begin{pmatrix} 2 & 1 \\ 1 & -2 \end{pmatrix}' },
|
||
{ step: 8, explanation: 'Matriz diagonal D', latexFormula: 'D = \begin{pmatrix} 6 & 0 \\ 0 & 1 \end{pmatrix}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Encuentra autovalores y autovectores primero', cost: 0 },
|
||
{ hint: 'Para λ=6: (A-6I)v=0', cost: 5 },
|
||
{ hint: 'P = [v₁ | v₂] y D = diag(λ₁, λ₂)', cost: 10 }
|
||
]),
|
||
points: 50,
|
||
timeLimitSeconds: 600,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-05',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 304,
|
||
statement: 'Encontrar una base y la dimensión del subespacio $W = \{(x, y, z) \in \mathbb{R}^3 : x + y + z = 0\}$.',
|
||
correctAnswer: 'Base: {(1,-1,0), (1,0,-1)}, Dimensión: 2',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'La condición x + y + z = 0 es un plano que pasa por el origen', latexFormula: 'x + y + z = 0' },
|
||
{ step: 2, explanation: 'Despejar x en términos de y y z', latexFormula: 'x = -y - z' },
|
||
{ step: 3, explanation: 'Escribir vector genérico de W', latexFormula: '\mathbf{v} = (-y-z, y, z) = y(-1, 1, 0) + z(-1, 0, 1)' },
|
||
{ step: 4, explanation: 'Alternativa: multiplicar por -1', latexFormula: '\mathbf{v} = y(1, -1, 0) + z(1, 0, -1)' },
|
||
{ step: 5, explanation: 'Verificar independencia lineal', latexFormula: '\begin{pmatrix} 1 & 1 \\ -1 & 0 \\ 0 & -1 \end{pmatrix} \text{ tiene rango 2}' },
|
||
{ step: 6, explanation: 'Base de W', latexFormula: '\mathcal{B} = \{(1, -1, 0), (1, 0, -1)\}' },
|
||
{ step: 7, explanation: 'Dimensión', latexFormula: '\dim(W) = 2' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'La condición es un plano en R³', cost: 0 },
|
||
{ hint: 'Despeja una variable y parametriza con las otras dos', cost: 5 },
|
||
{ hint: 'Los vectores que multiplican a los parámetros forman la base', cost: 10 }
|
||
]),
|
||
points: 40,
|
||
timeLimitSeconds: 480,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-06',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 305,
|
||
statement: 'Sea $T: \mathbb{R}^2 \to \mathbb{R}^3$ definida por $T(x, y) = (x+y, 2x, y)$. a) Verificar que T es lineal. b) Encontrar la matriz asociada a T. c) Calcular el núcleo de T.',
|
||
correctAnswer: 'a) Es lineal, b) [[1,1],[2,0],[0,1]], c) núcleo = {(0,0)}',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Verificar T(u + v) = T(u) + T(v)', latexFormula: 'T((x_1,y_1) + (x_2,y_2)) = T(x_1+x_2, y_1+y_2) = (x_1+x_2+y_1+y_2, 2(x_1+x_2), y_1+y_2)' },
|
||
{ step: 2, explanation: 'Comparar con T(u) + T(v)', latexFormula: 'T(x_1,y_1) + T(x_2,y_2) = (x_1+y_1, 2x_1, y_1) + (x_2+y_2, 2x_2, y_2) = (x_1+x_2+y_1+y_2, 2x_1+2x_2, y_1+y_2)' },
|
||
{ step: 3, explanation: 'Verificar T(cu) = cT(u)', latexFormula: 'T(cx, cy) = (cx+cy, 2cx, cy) = c(x+y, 2x, y) = cT(x,y)' },
|
||
{ step: 4, explanation: 'Conclusión: T es transformación lineal', latexFormula: '\text{T es lineal}' },
|
||
{ step: 5, explanation: 'Matriz asociada aplicando T a la base canónica', latexFormula: 'T(1,0) = (1, 2, 0), \quad T(0,1) = (1, 0, 1)' },
|
||
{ step: 6, explanation: 'Matriz de T', latexFormula: '[T] = \begin{pmatrix} 1 & 1 \\ 2 & 0 \\ 0 & 1 \end{pmatrix}' },
|
||
{ step: 7, explanation: 'Núcleo: resolver T(x,y) = (0,0,0)', latexFormula: '\begin{cases} x + y = 0 \\ 2x = 0 \\ y = 0 \end{cases}' },
|
||
{ step: 8, explanation: 'De 2x = 0: x = 0. De y = 0: y = 0', latexFormula: 'x = 0, \quad y = 0' },
|
||
{ step: 9, explanation: 'Núcleo de T', latexFormula: '\ker(T) = \{(0, 0)\}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Verifica T(u+v) = T(u)+T(v) y T(cu) = cT(u)', cost: 0 },
|
||
{ hint: 'La matriz tiene T(e₁) y T(e₂) como columnas', cost: 5 },
|
||
{ hint: 'Resuelve T(x,y) = (0,0,0) para el núcleo', cost: 10 }
|
||
]),
|
||
points: 50,
|
||
timeLimitSeconds: 600,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-07',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 306,
|
||
statement: 'Aplicar el método de Gram-Schmidt para ortonormalizar la base $\{\mathbf{v}_1 = (1, 1, 0), \mathbf{v}_2 = (1, 0, 1), \mathbf{v}_3 = (0, 1, 1)\}$.',
|
||
correctAnswer: 'u₁=(1/√2,1/√2,0), u₂=(1/√6,-1/√6,2/√6), u₃=(-1/√3,1/√3,1/√3)',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Primer vector: normalizar v₁', latexFormula: '\|\mathbf{v}_1\| = \sqrt{1^2 + 1^2 + 0^2} = \sqrt{2}' },
|
||
{ step: 2, explanation: 'u₁', latexFormula: '\mathbf{u}_1 = \frac{1}{\sqrt{2}}(1, 1, 0) = \left(\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}}, 0\right)' },
|
||
{ step: 3, explanation: 'Proyección de v₂ sobre u₁', latexFormula: '\text{proj}_{\mathbf{u}_1}(\mathbf{v}_2) = (\mathbf{v}_2 \cdot \mathbf{u}_1)\mathbf{u}_1 = \frac{1}{\sqrt{2}} \cdot \frac{1}{\sqrt{2}}(1, 1, 0) = \frac{1}{2}(1, 1, 0)' },
|
||
{ step: 4, explanation: 'w₂ = v₂ - proyección', latexFormula: '\mathbf{w}_2 = (1, 0, 1) - \frac{1}{2}(1, 1, 0) = \left(\frac{1}{2}, -\frac{1}{2}, 1\right)' },
|
||
{ step: 5, explanation: 'Normalizar w₂', latexFormula: '\|\mathbf{w}_2\| = \sqrt{\frac{1}{4} + \frac{1}{4} + 1} = \sqrt{\frac{3}{2}} = \frac{\sqrt{6}}{2}' },
|
||
{ step: 6, explanation: 'u₂', latexFormula: '\mathbf{u}_2 = \frac{2}{\sqrt{6}}\left(\frac{1}{2}, -\frac{1}{2}, 1\right) = \left(\frac{1}{\sqrt{6}}, -\frac{1}{\sqrt{6}}, \frac{2}{\sqrt{6}}\right)' },
|
||
{ step: 7, explanation: 'Para u₃, restar proyecciones sobre u₁ y u₂', latexFormula: '\mathbf{w}_3 = \mathbf{v}_3 - \text{proj}_{\mathbf{u}_1}(\mathbf{v}_3) - \text{proj}_{\mathbf{u}_2}(\mathbf{v}_3)' },
|
||
{ step: 8, explanation: 'Calcular proyecciones', latexFormula: '\mathbf{v}_3 \cdot \mathbf{u}_1 = \frac{1}{\sqrt{2}}, \quad \mathbf{v}_3 \cdot \mathbf{u}_2 = \frac{1}{\sqrt{6}}' },
|
||
{ step: 9, explanation: 'w₃', latexFormula: '\mathbf{w}_3 = (0, 1, 1) - \frac{1}{2}(1, 1, 0) - \frac{1}{6}(1, -1, 2) = \cdots' },
|
||
{ step: 10, explanation: 'Simplificar y normalizar', latexFormula: '\mathbf{u}_3 = \left(-\frac{1}{\sqrt{3}}, \frac{1}{\sqrt{3}}, \frac{1}{\sqrt{3}}\right)' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Gram-Schmidt: u₁ = v₁/||v₁||, luego v₂ - proy_u₁(v₂), etc.', cost: 0 },
|
||
{ hint: 'Proyección de v sobre u = ((v·u)/(u·u))u', cost: 10 }
|
||
]),
|
||
points: 60,
|
||
timeLimitSeconds: 720,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-08',
|
||
moduleId: sistemasModule.id,
|
||
topicId: sistemasTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 307,
|
||
statement: 'Resolver el sistema homogéneo y encontrar el espacio solución: $\begin{cases} x + 2y - z = 0 \\ 2x + 4y - 2z = 0 \\ 3x + 6y - 3z = 0 \end{cases}$.',
|
||
correctAnswer: 'Solución: (x, y, z) = t(-2, 1, 0) + s(1, 0, 1), dim = 2',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Escribir la matriz aumentada', latexFormula: '\begin{pmatrix} 1 & 2 & -1 & | & 0 \\ 2 & 4 & -2 & | & 0 \\ 3 & 6 & -3 & | & 0 \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Aplicar eliminación: F₂ → F₂ - 2F₁, F₃ → F₃ - 3F₁', latexFormula: '\begin{pmatrix} 1 & 2 & -1 & | & 0 \\ 0 & 0 & 0 & | & 0 \\ 0 & 0 & 0 & | & 0 \end{pmatrix}' },
|
||
{ step: 3, explanation: 'La matriz tiene rango 1, 3 variables', latexFormula: '\text{Variables libres} = 3 - 1 = 2' },
|
||
{ step: 4, explanation: 'Ecuación principal', latexFormula: 'x + 2y - z = 0 \Rightarrow x = -2y + z' },
|
||
{ step: 5, explanation: 'Parametrizar y = t, z = s', latexFormula: 'x = -2t + s, \quad y = t, \quad z = s' },
|
||
{ step: 6, explanation: 'Vector solución', latexFormula: '\begin{pmatrix} x \\ y \\ z \end{pmatrix} = t\begin{pmatrix} -2 \\ 1 \\ 0 \end{pmatrix} + s\begin{pmatrix} 1 \\ 0 \\ 1 \end{pmatrix}' },
|
||
{ step: 7, explanation: 'Base del espacio solución', latexFormula: '\mathcal{B} = \{(-2, 1, 0), (1, 0, 1)\}' },
|
||
{ step: 8, explanation: 'Dimensión del espacio solución', latexFormula: '\dim = 2' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Reduce la matriz a forma escalonada', cost: 0 },
|
||
{ hint: 'El número de variables libres = n - rango', cost: 5 },
|
||
{ hint: 'Parametriza las variables libres', cost: 10 }
|
||
]),
|
||
points: 45,
|
||
timeLimitSeconds: 540,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-09',
|
||
moduleId: fundamentosModule.id,
|
||
topicId: matricesTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 308,
|
||
statement: 'Encontrar la descomposición LU de $A = \begin{pmatrix} 2 & 1 & 1 \\ 4 & 3 & 3 \\ 8 & 7 & 9 \end{pmatrix}$.',
|
||
correctAnswer: 'L=[[1,0,0],[2,1,0],[4,3,1]], U=[[2,1,1],[0,1,1],[0,0,2]]',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Aplicar eliminación gaussiana', latexFormula: 'A = \begin{pmatrix} 2 & 1 & 1 \\ 4 & 3 & 3 \\ 8 & 7 & 9 \end{pmatrix}' },
|
||
{ step: 2, explanation: 'F₂ → F₂ - 2F₁, multiplicador l₂₁ = 2', latexFormula: '\begin{pmatrix} 2 & 1 & 1 \\ 0 & 1 & 1 \\ 8 & 7 & 9 \end{pmatrix}' },
|
||
{ step: 3, explanation: 'F₃ → F₃ - 4F₁, multiplicador l₃₁ = 4', latexFormula: '\begin{pmatrix} 2 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 3 & 5 \end{pmatrix}' },
|
||
{ step: 4, explanation: 'F₃ → F₃ - 3F₂, multiplicador l₃₂ = 3', latexFormula: '\begin{pmatrix} 2 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 2 \end{pmatrix} = U' },
|
||
{ step: 5, explanation: 'Construir L con los multiplicadores', latexFormula: 'L = \begin{pmatrix} 1 & 0 & 0 \\ l_{21} & 1 & 0 \\ l_{31} & l_{32} & 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 4 & 3 & 1 \end{pmatrix}' },
|
||
{ step: 6, explanation: 'Verificación', latexFormula: 'LU = \begin{pmatrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 4 & 3 & 1 \end{pmatrix}\begin{pmatrix} 2 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 2 \end{pmatrix} = \begin{pmatrix} 2 & 1 & 1 \\ 4 & 3 & 3 \\ 8 & 7 & 9 \end{pmatrix} = A' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Aplica eliminación gaussiana y guarda los multiplicadores', cost: 0 },
|
||
{ hint: 'Los multiplicadores forman L (triangular inferior con 1s en diagonal)', cost: 10 }
|
||
]),
|
||
points: 50,
|
||
timeLimitSeconds: 600,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-10',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 309,
|
||
statement: 'Encontrar los valores y vectores singulares de $A = \begin{pmatrix} 3 & 0 \\ 0 & 2 \end{pmatrix}$.',
|
||
correctAnswer: 'σ₁=3, σ₂=2; u₁=(1,0), u₂=(0,1), v₁=(1,0), v₂=(0,1)',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Calcular A^T A', latexFormula: 'A^T A = \begin{pmatrix} 3 & 0 \\ 0 & 2 \end{pmatrix}\begin{pmatrix} 3 & 0 \\ 0 & 2 \end{pmatrix} = \begin{pmatrix} 9 & 0 \\ 0 & 4 \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Autovalores de A^T A son los cuadrados de los valores singulares', latexFormula: '\lambda_1 = 9, \quad \lambda_2 = 4' },
|
||
{ step: 3, explanation: 'Valores singulares', latexFormula: '\sigma_1 = \sqrt{9} = 3, \quad \sigma_2 = \sqrt{4} = 2' },
|
||
{ step: 4, explanation: 'Vectores singulares derechos (autovectores de A^T A)', latexFormula: '\mathbf{v}_1 = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \quad \mathbf{v}_2 = \begin{pmatrix} 0 \\ 1 \end{pmatrix}' },
|
||
{ step: 5, explanation: 'Vectores singulares izquierdos uᵢ = Avᵢ/σᵢ', latexFormula: '\mathbf{u}_1 = \frac{1}{3}\begin{pmatrix} 3 & 0 \\ 0 & 2 \end{pmatrix}\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix}' },
|
||
{ step: 6, explanation: 'Segundo vector singular izquierdo', latexFormula: '\mathbf{u}_2 = \frac{1}{2}\begin{pmatrix} 3 & 0 \\ 0 & 2 \end{pmatrix}\begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \end{pmatrix}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Los valores singulares son las raíces de los autovalores de A^TA', cost: 0 },
|
||
{ hint: 'Para matrices diagonales, los valores singulares son |elementos diagonales|', cost: 10 }
|
||
]),
|
||
points: 50,
|
||
timeLimitSeconds: 600,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-11',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.OPEN_RESPONSE,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 310,
|
||
statement: 'Probar que el conjunto de todas las matrices 2×2 con traza cero forma un subespacio vectorial.',
|
||
correctAnswer: 'Es subespacio: contiene 0, cerrado bajo suma y multiplicación por escalar',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Definir el conjunto W', latexFormula: 'W = \{A \in M_{2 \times 2} : \text{tr}(A) = 0\}' },
|
||
{ step: 2, explanation: 'Verificar que la matriz cero está en W', latexFormula: '\text{tr}\begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix} = 0 \Rightarrow \mathbf{0} \in W' },
|
||
{ step: 3, explanation: 'Verificar cierre bajo suma', latexFormula: '\text{Sea } A, B \in W, \text{ entonces } \text{tr}(A) = \text{tr}(B) = 0' },
|
||
{ step: 4, explanation: 'Traza de la suma', latexFormula: '\text{tr}(A + B) = \text{tr}(A) + \text{tr}(B) = 0 + 0 = 0 \Rightarrow A + B \in W' },
|
||
{ step: 5, explanation: 'Verificar cierre bajo multiplicación por escalar', latexFormula: '\text{tr}(cA) = c \cdot \text{tr}(A) = c \cdot 0 = 0 \Rightarrow cA \in W' },
|
||
{ step: 6, explanation: 'Conclusión', latexFormula: 'W \text{ es un subespacio vectorial de } M_{2 \times 2}' },
|
||
{ step: 7, explanation: 'Dimensión de W', latexFormula: '\dim(W) = 3 \text{ (base: matrices con un 1 y un -1 en diagonal, y las dos matrices con 1 fuera de diagonal)}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Verifica los 3 axiomas de subespacio', cost: 0 },
|
||
{ hint: 'La traza es lineal: tr(A+B) = tr(A) + tr(B)', cost: 5 }
|
||
]),
|
||
points: 50,
|
||
timeLimitSeconds: 600,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-12',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 311,
|
||
statement: 'Calcular la proyección ortogonal de $\mathbf{v} = (3, 4, 5)$ sobre el subespacio generado por $\mathbf{u}_1 = (1, 0, 0)$ y $\mathbf{u}_2 = (0, 1, 0)$.',
|
||
correctAnswer: '(3, 4, 0)',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'El subespacio W es el plano xy', latexFormula: 'W = \text{span}\{(1,0,0), (0,1,0)\} = \{(x, y, 0) : x, y \in \mathbb{R}\}' },
|
||
{ step: 2, explanation: 'Los vectores ya son ortonormales', latexFormula: '\|\mathbf{u}_1\| = 1, \quad \|\mathbf{u}_2\| = 1, \quad \mathbf{u}_1 \cdot \mathbf{u}_2 = 0' },
|
||
{ step: 3, explanation: 'Proyección usando la fórmula de proyección ortogonal', latexFormula: '\text{proj}_W(\mathbf{v}) = (\mathbf{v} \cdot \mathbf{u}_1)\mathbf{u}_1 + (\mathbf{v} \cdot \mathbf{u}_2)\mathbf{u}_2' },
|
||
{ step: 4, explanation: 'Calcular productos punto', latexFormula: '\mathbf{v} \cdot \mathbf{u}_1 = 3, \quad \mathbf{v} \cdot \mathbf{u}_2 = 4' },
|
||
{ step: 5, explanation: 'Sustituir', latexFormula: '\text{proj}_W(\mathbf{v}) = 3(1, 0, 0) + 4(0, 1, 0) = (3, 4, 0)' },
|
||
{ step: 6, explanation: 'Verificación', latexFormula: '(3, 4, 5) - (3, 4, 0) = (0, 0, 5) \perp W' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'El subespacio es el plano xy (z=0)', cost: 0 },
|
||
{ hint: 'La proyección elimina la componente perpendicular', cost: 5 }
|
||
]),
|
||
points: 40,
|
||
timeLimitSeconds: 480,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-13',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 312,
|
||
statement: 'Sea $A = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$. a) Encontrar autovalores. b) ¿Es A diagonalizable sobre $\mathbb{R}$? c) ¿Es diagonalizable sobre $\mathbb{C}$?',
|
||
correctAnswer: 'λ=±i; No es diagonalizable sobre R; Sí es diagonalizable sobre C',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Polinomio característico', latexFormula: '\det(A - \lambda I) = \det\begin{pmatrix} -\lambda & -1 \\ 1 & -\lambda \end{pmatrix} = \lambda^2 + 1 = 0' },
|
||
{ step: 2, explanation: 'Autovalores', latexFormula: '\lambda^2 = -1 \Rightarrow \lambda = \pm i' },
|
||
{ step: 3, explanation: 'Sobre los reales', latexFormula: '\lambda = i, -i \notin \mathbb{R} \Rightarrow A \text{ no tiene autovalores reales}' },
|
||
{ step: 4, explanation: 'Diagonalización sobre ℝ', latexFormula: 'A \text{ no es diagonalizable sobre } \mathbb{R} \text{ (no hay autovectores reales)}' },
|
||
{ step: 5, explanation: 'Sobre los complejos', latexFormula: '\text{Autovalores complejos: } \lambda_1 = i, \lambda_2 = -i' },
|
||
{ step: 6, explanation: 'Autovector para λ = i', latexFormula: '(A - iI)\mathbf{v} = \mathbf{0} \Rightarrow \begin{pmatrix} -i & -1 \\ 1 & -i \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \mathbf{0}' },
|
||
{ step: 7, explanation: 'Resolver', latexFormula: '-ix - y = 0 \Rightarrow y = -ix \Rightarrow \mathbf{v}_1 = \begin{pmatrix} 1 \\ -i \end{pmatrix}' },
|
||
{ step: 8, explanation: 'Autovector para λ = -i', latexFormula: '\mathbf{v}_2 = \begin{pmatrix} 1 \\ i \end{pmatrix}' },
|
||
{ step: 9, explanation: 'Diagonalización sobre ℂ', latexFormula: 'A = PDP^{-1} \text{ donde } D = \begin{pmatrix} i & 0 \\ 0 & -i \end{pmatrix}, \quad P = \begin{pmatrix} 1 & 1 \\ -i & i \end{pmatrix}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Los autovalores son complejos: ±i', cost: 0 },
|
||
{ hint: 'Una matriz es diagonalizable si tiene n autovectores LI', cost: 5 }
|
||
]),
|
||
points: 55,
|
||
timeLimitSeconds: 660,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-14',
|
||
moduleId: sistemasModule.id,
|
||
topicId: sistemasTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 313,
|
||
statement: 'Resolver usando descomposición LU el sistema $A\mathbf{x} = \mathbf{b}$ donde $A = \begin{pmatrix} 2 & 1 \\ 4 & 3 \end{pmatrix}$ y $\mathbf{b} = \begin{pmatrix} 5 \\ 11 \end{pmatrix}$.',
|
||
correctAnswer: 'x = [1, 3]',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Descomponer A = LU', latexFormula: 'A = \begin{pmatrix} 2 & 1 \\ 4 & 3 \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Eliminación: F₂ → F₂ - 2F₁, l₂₁ = 2', latexFormula: 'U = \begin{pmatrix} 2 & 1 \\ 0 & 1 \end{pmatrix}, \quad L = \begin{pmatrix} 1 & 0 \\ 2 & 1 \end{pmatrix}' },
|
||
{ step: 3, explanation: 'Resolver Ly = b (sustitución hacia adelante)', latexFormula: '\begin{pmatrix} 1 & 0 \\ 2 & 1 \end{pmatrix}\begin{pmatrix} y_1 \\ y_2 \end{pmatrix} = \begin{pmatrix} 5 \\ 11 \end{pmatrix}' },
|
||
{ step: 4, explanation: 'De la primera ecuación', latexFormula: 'y_1 = 5' },
|
||
{ step: 5, explanation: 'De la segunda ecuación', latexFormula: '2y_1 + y_2 = 11 \Rightarrow 2(5) + y_2 = 11 \Rightarrow y_2 = 1' },
|
||
{ step: 6, explanation: 'Resolver Ux = y (sustitución hacia atrás)', latexFormula: '\begin{pmatrix} 2 & 1 \\ 0 & 1 \end{pmatrix}\begin{pmatrix} x_1 \\ x_2 \end{pmatrix} = \begin{pmatrix} 5 \\ 1 \end{pmatrix}' },
|
||
{ step: 7, explanation: 'De la segunda ecuación', latexFormula: 'x_2 = 1' },
|
||
{ step: 8, explanation: 'De la primera ecuación', latexFormula: '2x_1 + x_2 = 5 \Rightarrow 2x_1 + 1 = 5 \Rightarrow x_1 = 2' },
|
||
{ step: 9, explanation: 'Solución', latexFormula: '\mathbf{x} = \begin{pmatrix} 2 \\ 1 \end{pmatrix}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Primero descompón A = LU', cost: 0 },
|
||
{ hint: 'Resuelve Ly = b (hacia adelante)', cost: 5 },
|
||
{ hint: 'Luego Ux = y (hacia atrás)', cost: 10 }
|
||
]),
|
||
points: 45,
|
||
timeLimitSeconds: 540,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-15',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 314,
|
||
statement: 'Encontrar el complemento ortogonal de $W = \text{span}\{(1, 1, 0), (0, 1, 1)\}$ en $\mathbb{R}^3$.',
|
||
correctAnswer: 'W⊥ = span{(-1, 1, -1)}',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'El complemento ortogonal W^⊥ contiene vectores ortogonales a todos los de W', latexFormula: 'W^\perp = \{\mathbf{v} \in \mathbb{R}^3 : \mathbf{v} \cdot \mathbf{w} = 0 \quad \forall \mathbf{w} \in W\}' },
|
||
{ step: 2, explanation: 'Basta ser ortogonal a los vectores que generan W', latexFormula: '\mathbf{v} \cdot (1, 1, 0) = 0 \text{ y } \mathbf{v} \cdot (0, 1, 1) = 0' },
|
||
{ step: 3, explanation: 'Sistema de ecuaciones', latexFormula: '\begin{cases} x + y = 0 \\ y + z = 0 \end{cases}' },
|
||
{ step: 4, explanation: 'Despejar', latexFormula: 'x = -y, \quad z = -y' },
|
||
{ step: 5, explanation: 'Vector genérico de W^⊥', latexFormula: '\mathbf{v} = (-y, y, -y) = y(-1, 1, -1)' },
|
||
{ step: 6, explanation: 'Base de W^⊥', latexFormula: '\mathcal{B}_{W^\perp} = \{(-1, 1, -1)\}' },
|
||
{ step: 7, explanation: 'Verificación', latexFormula: '(-1, 1, -1) \cdot (1, 1, 0) = -1 + 1 + 0 = 0 \checkmark' },
|
||
{ step: 8, explanation: 'Segunda verificación', latexFormula: '(-1, 1, -1) \cdot (0, 1, 1) = 0 + 1 - 1 = 0 \checkmark' },
|
||
{ step: 9, explanation: 'Dimensión', latexFormula: '\dim(W) + \dim(W^\perp) = 2 + 1 = 3 = \dim(\mathbb{R}^3) \checkmark' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'W⊥ = {v : v·w = 0 para todo w en W}', cost: 0 },
|
||
{ hint: 'Resuelve el sistema de ecuaciones que resulta', cost: 5 }
|
||
]),
|
||
points: 45,
|
||
timeLimitSeconds: 540,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-16',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 315,
|
||
statement: 'Encontrar la forma cuadrática asociada a la matriz simétrica $A = \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}$.',
|
||
correctAnswer: 'Q(x,y) = 2x² + 2xy + 3y²',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'La forma cuadrática es Q(x) = x^T A x', latexFormula: 'Q(x, y) = \begin{pmatrix} x & y \end{pmatrix}\begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Multiplicar las matrices', latexFormula: '= \begin{pmatrix} x & y \end{pmatrix}\begin{pmatrix} 2x + y \\ x + 3y \end{pmatrix}' },
|
||
{ step: 3, explanation: 'Expandir', latexFormula: '= x(2x + y) + y(x + 3y)' },
|
||
{ step: 4, explanation: 'Simplificar', latexFormula: '= 2x^2 + xy + xy + 3y^2 = 2x^2 + 2xy + 3y^2' },
|
||
{ step: 5, explanation: 'Verificar simetría', latexFormula: '\text{El término } 2xy \text{ corresponde a } a_{12} + a_{21} = 1 + 1 = 2' },
|
||
{ step: 6, explanation: 'Forma final', latexFormula: 'Q(x, y) = 2x^2 + 2xy + 3y^2' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Usa Q(x) = x^T A x', cost: 0 },
|
||
{ hint: 'Los términos cruzados tienen coeficiente 2a₁₂', cost: 5 }
|
||
]),
|
||
points: 35,
|
||
timeLimitSeconds: 420,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-17',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 316,
|
||
statement: 'Clasificar la forma cuadrática $Q(x,y) = 3x^2 + 4xy + 2y^2$ como positiva definida, negativa definida o indefinida.',
|
||
correctAnswer: 'Positiva definida',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Encontrar la matriz asociada', latexFormula: 'A = \begin{pmatrix} 3 & 2 \\ 2 & 2 \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Criterio de Sylvester: menores principales', latexFormula: '\Delta_1 = a_{11} = 3' },
|
||
{ step: 3, explanation: 'Segundo menor principal', latexFormula: '\Delta_2 = \det(A) = 3(2) - 2(2) = 6 - 4 = 2' },
|
||
{ step: 4, explanation: 'Análisis', latexFormula: '\Delta_1 = 3 > 0, \quad \Delta_2 = 2 > 0' },
|
||
{ step: 5, explanation: 'Conclusión por criterio de Sylvester', latexFormula: '\text{Todos los menores principales positivos} \Rightarrow \text{positiva definida}' },
|
||
{ step: 6, explanation: 'Alternativa: autovalores', latexFormula: '\det(A - \lambda I) = (3-\lambda)(2-\lambda) - 4 = \lambda^2 - 5\lambda + 2 = 0' },
|
||
{ step: 7, explanation: 'Autovalores', latexFormula: '\lambda = \frac{5 \pm \sqrt{25-8}}{2} = \frac{5 \pm \sqrt{17}}{2} > 0' },
|
||
{ step: 8, explanation: 'Verificación', latexFormula: '\lambda_1 \approx 4.56 > 0, \quad \lambda_2 \approx 0.44 > 0 \Rightarrow \text{positiva definida}' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Usa el criterio de Sylvester: verifica los menores principales', cost: 0 },
|
||
{ hint: 'Alternativa: calcula los autovalores', cost: 5 }
|
||
]),
|
||
points: 40,
|
||
timeLimitSeconds: 480,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-18',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 317,
|
||
statement: 'Encontrar el rango de la matriz $A = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 2 & 4 & 6 & 8 \\ 1 & 1 & 1 & 1 \\ 3 & 5 & 7 & 9 \end{pmatrix}$.',
|
||
correctAnswer: '2',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'Aplicar eliminación gaussiana', latexFormula: 'A = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 2 & 4 & 6 & 8 \\ 1 & 1 & 1 & 1 \\ 3 & 5 & 7 & 9 \end{pmatrix}' },
|
||
{ step: 2, explanation: 'Notar que F₂ = 2F₁', latexFormula: 'F_2 - 2F_1 = \mathbf{0}' },
|
||
{ step: 3, explanation: 'F₃ → F₃ - F₁, F₄ → F₄ - 3F₁', latexFormula: '\begin{pmatrix} 1 & 2 & 3 & 4 \\ 0 & 0 & 0 & 0 \\ 0 & -1 & -2 & -3 \\ 0 & -1 & -2 & -3 \end{pmatrix}' },
|
||
{ step: 4, explanation: 'Reordenar filas', latexFormula: '\begin{pmatrix} 1 & 2 & 3 & 4 \\ 0 & -1 & -2 & -3 \\ 0 & -1 & -2 & -3 \\ 0 & 0 & 0 & 0 \end{pmatrix}' },
|
||
{ step: 5, explanation: 'F₃ → F₃ - F₂', latexFormula: '\begin{pmatrix} 1 & 2 & 3 & 4 \\ 0 & -1 & -2 & -3 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{pmatrix}' },
|
||
{ step: 6, explanation: 'Contar pivotes', latexFormula: '\text{Pivotes en columnas 1 y 2}' },
|
||
{ step: 7, explanation: 'Rango de A', latexFormula: '\text{rank}(A) = 2' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Aplica eliminación gaussiana y cuenta los pivotes', cost: 0 },
|
||
{ hint: 'Observa que la fila 2 es el doble de la fila 1', cost: 5 }
|
||
]),
|
||
points: 40,
|
||
timeLimitSeconds: 480,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-19',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.CALCULATION,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 318,
|
||
statement: 'Sea $T: \mathbb{R}^3 \to \mathbb{R}^2$ dada por $T(x, y, z) = (x + 2y - z, 3x - y + 2z)$. Encontrar el núcleo de T y su dimensión.',
|
||
correctAnswer: 'Núcleo: {t(-3/7, 5/7, 1)}, dimensión: 1',
|
||
solutionSteps: JSON.stringify([
|
||
{ step: 1, explanation: 'El núcleo son los vectores que se mapean a cero', latexFormula: '\ker(T) = \{(x, y, z) : T(x, y, z) = (0, 0)\}' },
|
||
{ step: 2, explanation: 'Sistema de ecuaciones', latexFormula: '\begin{cases} x + 2y - z = 0 \\ 3x - y + 2z = 0 \end{cases}' },
|
||
{ step: 3, explanation: 'Matriz del sistema', latexFormula: '\begin{pmatrix} 1 & 2 & -1 \\ 3 & -1 & 2 \end{pmatrix}\begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \end{pmatrix}' },
|
||
{ step: 4, explanation: 'Aplicar eliminación', latexFormula: 'F_2 - 3F_1: \begin{pmatrix} 1 & 2 & -1 \\ 0 & -7 & 5 \end{pmatrix}' },
|
||
{ step: 5, explanation: 'Despejar', latexFormula: '-7y + 5z = 0 \Rightarrow y = \frac{5}{7}z' },
|
||
{ step: 6, explanation: 'Sustituir en primera ecuación', latexFormula: 'x + 2(\frac{5}{7}z) - z = 0 \Rightarrow x + \frac{10}{7}z - z = 0 \Rightarrow x = -\frac{3}{7}z' },
|
||
{ step: 7, explanation: 'Solución paramétrica', latexFormula: '(x, y, z) = (-\frac{3}{7}z, \frac{5}{7}z, z) = z(-\frac{3}{7}, \frac{5}{7}, 1)' },
|
||
{ step: 8, explanation: 'Núcleo', latexFormula: '\ker(T) = \text{span}\left\{\left(-\frac{3}{7}, \frac{5}{7}, 1\right)\right\}' },
|
||
{ step: 9, explanation: 'Dimensión del núcleo (nulidad)', latexFormula: '\dim(\ker(T)) = 1' },
|
||
{ step: 10, explanation: 'Verificación teorema de la dimensión', latexFormula: '\dim(\mathbb{R}^3) = \dim(\ker(T)) + \dim(\text{Im}(T)) = 1 + 2 = 3 \checkmark' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Resuelve el sistema homogéneo T(x,y,z) = (0,0)', cost: 0 },
|
||
{ hint: 'El núcleo es el espacio solución del sistema', cost: 5 }
|
||
]),
|
||
points: 45,
|
||
timeLimitSeconds: 540,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
{
|
||
id: 'ex-adv-20',
|
||
moduleId: sistemasModule.id,
|
||
topicId: espaciosTopic?.id,
|
||
type: ExerciseType.MULTIPLE_CHOICE,
|
||
difficulty: ExerciseDifficulty.ADVANCED,
|
||
order: 319,
|
||
statement: '¿Cuál de las siguientes afirmaciones sobre matrices ortogonales es FALSA?',
|
||
correctAnswer: 'Una matriz ortogonal siempre es simétrica',
|
||
multipleChoiceOptions: JSON.stringify([
|
||
{ option: 'Una matriz ortogonal siempre es simétrica', isCorrect: true, explanation: 'FALSO. Las matrices ortogonales no necesariamente son simétricas. Ejemplo: matriz de rotación.' },
|
||
{ option: 'El determinante de una matriz ortogonal es ±1', isCorrect: false, explanation: 'VERDADERO. det(Q^T Q) = det(I) = 1 = det(Q)^2.' },
|
||
{ option: 'Las columnas de una matriz ortogonal forman una base ortonormal', isCorrect: false, explanation: 'VERDADERO. Por definición, Q^T Q = I implica que las columnas son ortonormales.' },
|
||
{ option: 'La inversa de una matriz ortogonal es su transpuesta', isCorrect: false, explanation: 'VERDADERO. Por definición: Q^T = Q^{-1}.' }
|
||
]),
|
||
hints: JSON.stringify([
|
||
{ hint: 'Recuerda: Q es ortogonal si Q^T Q = I', cost: 0 },
|
||
{ hint: 'Piensa en una matriz de rotación como contraejemplo', cost: 5 }
|
||
]),
|
||
points: 30,
|
||
timeLimitSeconds: 360,
|
||
isPublished: true,
|
||
isAIGenerated: false,
|
||
},
|
||
];
|
||
|
||
// Combinar todos los ejercicios
|
||
const allExercises = [...basicExercises, ...intermediateExercises, ...advancedExercises];
|
||
|
||
console.log(`📊 Insertando ${allExercises.length} ejercicios...`);
|
||
console.log(` - Basic: ${basicExercises.length}`);
|
||
console.log(` - Intermediate: ${intermediateExercises.length}`);
|
||
console.log(` - Advanced: ${advancedExercises.length}`);
|
||
|
||
// Insertar ejercicios con upsert para evitar duplicados
|
||
let inserted = 0;
|
||
let updated = 0;
|
||
let errors = 0;
|
||
|
||
for (const exercise of allExercises) {
|
||
try {
|
||
// Intentar hacer upsert por ID si existe, o crear nuevo
|
||
const result = await prisma.exercise.upsert({
|
||
where: { id: exercise.id },
|
||
update: {
|
||
...exercise,
|
||
updatedAt: new Date(),
|
||
},
|
||
create: exercise,
|
||
});
|
||
|
||
if (result.createdAt.getTime() === result.updatedAt.getTime()) {
|
||
inserted++;
|
||
} else {
|
||
updated++;
|
||
}
|
||
} catch (error) {
|
||
console.error(`❌ Error insertando ejercicio ${exercise.id}:`, error);
|
||
errors++;
|
||
}
|
||
}
|
||
|
||
// Actualizar contadores de ejercicios en los módulos usando raw queries
|
||
const moduleIds = [fundamentosModule?.id, sistemasModule?.id, aplicacionesModule?.id].filter(Boolean);
|
||
for (const moduleId of moduleIds) {
|
||
const count = await prisma.exercise.count({
|
||
where: { moduleId },
|
||
});
|
||
|
||
// Usar raw query para evitar problemas con el enum
|
||
await prisma.$executeRaw`
|
||
UPDATE modules SET "totalExercises" = ${count} WHERE id = ${moduleId}
|
||
`;
|
||
}
|
||
|
||
console.log('\n✅ Resumen de inserción:');
|
||
console.log(` - Ejercicios nuevos: ${inserted}`);
|
||
console.log(` - Ejercicios actualizados: ${updated}`);
|
||
console.log(` - Errores: ${errors}`);
|
||
console.log(` - Total procesados: ${inserted + updated}`);
|
||
console.log('\n🎉 ¡Ejercicios PRO insertados exitosamente!');
|
||
}
|
||
|
||
async function main() {
|
||
console.log('╔════════════════════════════════════════════════════════╗');
|
||
console.log('║ SEED PRO - Ejercicios de Álgebra Lineal ║');
|
||
console.log('║ Nivel Universitario - Parcial ║');
|
||
console.log('╚════════════════════════════════════════════════════════╝\n');
|
||
|
||
try {
|
||
await seedProExercises();
|
||
} catch (error) {
|
||
console.error('\n❌ Error fatal:', error);
|
||
process.exit(1);
|
||
} finally {
|
||
await prisma.$disconnect();
|
||
}
|
||
}
|
||
|
||
main();
|