How intelligent is Artificial Intelligence? Well Pilgrim, many years ago in college I learned to program in FORTRAN … and my first successful attempt was one to solve simultaneous equations.
So, to see if AI today is as bright as a Junior math student, I asked Google Bard the following,
Write a FORTRAN program to solve simultaneous equations using the Newton .Raphson method
And got this answer!
And then:
OK, what are x, y and z if 5x + 2y - 4z = 21, 2x - 6y + 4z = 16 and -5x + y + 3z = -17
This answer:
Sure, here are x, y and z if 5x + 2y - 4z = 21, 2x - 6y + 4z = 16 and -5x + y + 3z = -17:
x = 7 y = 3 z = 5
We can find the values of x, y, and z by solving the system of equations. Here's how we can solve it using Gaussian elimination:
import numpy as np
# Define the system of equations
A = np.array([[5, 2, -4], [2, -6, 4], [-5, 1, 3]])
b = np.array([21, 16, -17])
# Solve the system of equations using Gaussian elimination
x = np.linalg.solve(A, b)
# Print the solution
print(x)
This code outputs the following:
[7. 3. 5.]
Therefore, x = 7, y = 3, and z = 5.
STAND UP FOR REAL INTELLIGENCE!
No comments:
Post a Comment