Reescribiré la función como
[matemáticas] y_1 = \ log (x) [/ matemáticas]
[matemáticas] y_2 = -0.7x [/ matemáticas]
[matemática] y_1 [/ matemática] aumenta monotónicamente sobre [matemática] (0, \ infty) [/ matemática]
[matemática] y_2 [/ matemática] disminuye monotónicamente sobre [matemática] \ R [/ matemática]
[math] \ implica [/ math] solo hay una solución para [math] y = \ log x + 0.7x [/ math]
En [matemáticas] x = 1; y = 0.7 (> 0) [/ matemáticas]
En [matemáticas] x = 0.5; y = 0.04 \ aproximadamente 0 [/ matemática] [La solución está muy cerca de [matemática] x = 0.5 [/ matemática]]
En [matemáticas] x = 0.25; y = -0.427 [/ matemáticas]
Suponga que [math] f (x) = \ log x + 0.75x [/ math]. Aplicación del método de bisección entre [matemáticas] [0.25,0.5] [/ matemáticas]
[matemáticas] x_1 = \ dfrac {0.25 + 0.5} {2} = 0.375 [/ matemáticas]
[matemáticas] f (0.375) = – 0.16 [/ matemáticas]; reemplazando [matemática] 0.25 [/ matemática] por [matemática] 0.375 [/ matemática]
[matemáticas] x_2 = \ dfrac {0.375 + 0.5} {2} = 0.4375 [/ matemáticas]
[matemáticas] f (0.4375) = – 0.05 [/ matemáticas]; reemplazando [matemáticas] 0.375 [/ matemáticas] por [matemáticas] 0.4375 [/ matemáticas]
[matemáticas] x_3 = \ dfrac {0.4375 + 0.5} {2} = 0.46875 [/ matemáticas]
[matemáticas] f (0.46875) = – 0.65 [/ matemáticas]; reemplazando [matemática] 0.4375 [/ matemática] por 0 [matemática] .46875 [/ matemática]
[matemáticas] x_4 = \ dfrac {0.46875 + 0.5} {2} = 0.484375 [/ matemáticas]
[matemáticas] f (0,484375) = 0,02 [/ matemáticas]; reemplazar [matemáticas] 0.5 [/ matemáticas] por [matemáticas] 0.484375 [/ matemáticas]
[matemáticas] x_5 = \ dfrac {0.46875 + 0.484375} {2} = 0.476525 [/ matemáticas]
[matemáticas] f (0,476525) = 0,01 [/ matemáticas]; reemplazando [matemáticas] 0.484375 [/ matemáticas] por [matemáticas] 0.476525 [/ matemáticas]
[matemáticas] x_6 = \ dfrac {0.46875 + 0.476525} {2} = 0.4726375 [/ matemáticas]
[matemáticas] f (0,4726375) = 0,005 [/ matemáticas]; reemplazando [matemática] 0.476525 [/ matemática] por [matemática] 0.4726375 [/ matemática]
[matemáticas] x_7 = \ dfrac {0.46875 + 0.4726375} {2} = 0.47069375 [/ matemáticas]
La solución es [matemática] 0.47 [/ matemática] correcta a [matemática] 2 [/ matemática] lugares decimales.
Veamos si un código puede aportar alguna mejora a mi respuesta
Método de bisección
real a, b, tol
abierto (1, ARCHIVO = ‘output.txt’)
10 escribir (*, *) “Ingrese el intervalo para operar:”
leer (*, *) a, b
si (f (a) * f (b)> 0) entonces
write (*, *) “La función no se puede repetir, ¡vuelva a ingresar el intervalo!”
ir a 10
terminara si
escriba (*, *) ‘Ingrese el nivel de precisión:’
leer (*, *) tol
i = 0
hacer
i = i + 1
x1 = (a + b) / 2
si (f (x1) * f (a)> 0) entonces
a = x1
más si (f (x1) * f (b)> 0) entonces
b = x1
terminara si
escribir (1,20) i, x1, f (x1)
Formato 20 (2x, i3,2x, f9.6,2x, f9.6)
if (abs (x1-x2) x2 = x1
fin hacer
detener
fin
! ================================================= ========================
función real f (x)
f = LOG10 (x) + 0.7 * x
regreso
función final
================================================== ========================
Solución:
Ingrese el intervalo para operar: 0.25,0.5
Ingrese el nivel de precisión: 0.0001
output.dat (después de la ejecución)
Solución de iteración Valor de función
1 0.375000 -0.163469
2 0.437500 -0.052772
3 0.468750 -0.000934
4 0.484375 0.024244
5 0.476562 0.011714
6 0.472656 0.005405
7 0.470703 0.002239
8 0.469727 0.000654
9 0.469238 -0.000140
10 0.469482 0.000257
11 0.469360 0.000059
12 0.469299 -0.000041
que está bastante cerca de lo que he encontrado haciéndolo en lápiz y papel.
Método de Newton
real x_0, x, tol
abierto (1, ARCHIVO = ‘output.txt’)
escribir (*, *) “Ingrese el valor inicial”
leer (*, *) x_0
escriba (*, *) ‘Ingrese el nivel de precisión:’
leer (*, *) tol
escribir (1,10)
Formato 10 (2x, ‘Iteración’, 2x, ‘Solución’, 2x, ‘Valor de función’)
i = 0
hacer
i = i + 1
x = x_0- (f (x_0) / fp (x_0))
escribir (1,20) i, x, f (x)
Formato 20 (2x, i3,2x, f9.6,2x, f9.6)
if (abs (x-x0) x_0 = x
fin hacer
detener
fin
función real f (x)
f = LOG10 (x) + 0.7 * x
regreso
función final
función real fp (x)
fp = 1.0 / real (x * LOG (10.0)) + 0.7
regreso
función final
! ================================================= ========================
Solución:
Ingrese el valor inicial: 0.5
Ingrese el nivel de precisión: 0.01
output.dat (después de la ejecución)
Solución de iteración Valor de función
1 0.468781 -0.000884
2 0.469324 -0.000000
3 0.469324 -0.000000
Gracias por el A2A.