# p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n]
import numpy as np
def fun():
k = np.roots(p)
for i in range(0,len(k)):
print('x',i+1," = ",k[i])
print(type(k[0])) #if roots are imaginary then ouput will be
complex
# else float as a real number
print()
p = (1,3,2)
fun();
p = (3,1,6)
fun();
p = (1,-2,-1,-2)
fun();
output:::-----
x 1 = -2.0 x 2 = -1.0 <class 'numpy.float64'> x 1 = (-0.16666666666666663+1.4043582955293932j) x 2 = (-0.16666666666666663-1.4043582955293932j) <class 'numpy.complex128'> x 1 = (2.6589670819169937+0j) x 2 = (-0.3294835409584969+0.8022545575574102j) x 3 = (-0.3294835409584969-0.8022545575574102j) <class 'numpy.complex128'>
In python. Thanks P5. Write a python program to solve the following polynomials. (Solving a polynomial...
need answer as soon as possible. thanks Consider the ring Rix) of polynomials with real coefficients, with operations polynomial addition and polynomial multiplication (you don't have to prove this is a ring). For example, for the polynomials f(x)=1+2x+3x2 and g(x)=3-5x, we have f(x)+g(x)= (1+2x+3x2)+(3-5x)-4-3x+3x2 and f(x)g(x)(1+2x+3x2)(3-5x)=3+X-X2-15x). Show that the function h: RIX-R given by h(f(x)=f(0) is a ring homomorphism. Then describe the kernel ker(h).
Excel Use Simplex method and Exel To solve the following LPPs. Maximize Maximize P-3x + x2 subject to the constraints x1 + x2 = 2 2x) + 3x2 s 12 3x + = 12 x 20 x220 P = 5x1 + 7x2 subject to the constraints 2xy + 3x2 = 12 3x + x2 = 12 x 20 *2 2 0 Maximize Maximize P = 2x2 + 4x2 + x3 subject to the constraints -*1 + 2x2 + 3x3 5...
Write the polynomial f(x) as a product of irreducible polynomials in the given ring. Explain in each case how you know the factors are irreducible. 1) f(x) -x* + 2x2 +2x 2 in Z3[x]. 2) f(x)4 + 2x3 + 2x2 +x + 1 in Z3[x]. 3) f(x) 2x3-x2 + 3x + 2 in Q[x] 4) f(x) = 5x4-21x2 + 6x-12 in Q[x)
programing in c language Write a program, using the following functions, that reads two polynomials and prints the polynomials before and after the addition. a) polyRead - Read in a polynomial and convert it to its linked list representation. - Return a pointer to the header node of this polynomial. b) polyWrite - Output a polynomial using a form that clearly displays it. c) polyAdd - Compute c = a + b. Do not change either a or b. where,...
Write a latex solution for #2 please. 1. Use back substitution to solve each of the following systems of equations: (a) -3X2 = 2 2x2 = 6 (b) x1 +x2 +x3 = 8 2x2 + x3 = 5 3x3 = 9 (c) x1 + 2x2 + 2x3 + X4 = 3x23 2x41 4X4 = (d) X1 + X2+ X3+ X4+ X5 = 5 2x2 + X3-2x4 + X5=1 4x3 + x4-2x5 = 1 2. Write out the coefficient matrix for...
Use an algorithm that you would systematically follow to apply the technique and solve each set of systems of linear equations. For example, you may select the technique of finding the inverse of the coefficient matrix A, and then applying Theorem 1.6.2: x = A^-1 b. There are several ways that we have learned to find A^-1. Pick one of those ways to code or write as an algorithm. Or another example, you may select Cramer’s rule. Within Cramer’s rule,...
1. Solve the following LP by the simplex method. Min z = 2x2 – Xı – X3 Subject to *1 + 2x2 + x3 = 12 2x1 + x2 – x3 = 6 -X1 + 3x2 = 9 X1, X2, X3 > 0
Write the system of linear equations in the form Ax = b and solve this matrix equation for x. x1 – 2x2 + 3x3 = 24 -X1 + 3x2 - x3 = -11 2x1 – 5x2 + 5x3 = 42 X1 x2 = X3 ] 24 -11 42 [ x
Please solve it in MATLAB 6) Interpolation and plot: y=x*; x=0:5; a) Interpolate: x1= 1.5; x2=2.5; x3=3.5 b) Plot x and y and label axis. 7)- A= [1,2;3,4); B= [5,6;7,8] Using MATLAB find the following: A+B; A-B; AB, A/B, A-1,B-1, A.B, A./B 8). Using MATLAB: F(x) = y=x+- 2x2 + 3x – 4 a) find the roots of the polynomial f(x) b) find the integral of the polynomial f(x) c) find the SS(x)dx.
Please answer this MATLAB questions when able. Thanks. 4. Laboratory Problem Description In this laboratory you are required to Find the solution of the following systems of linear equation: 1) xl + x2 + x3 3 4x1 - x2 x3-2 x1 2x2 x3-2 2) 2 -1 3 A 1 3 -2. B-2 Given the following system 4x1+3x2+7x3- 3 3x1+2x2+1x3 1 2x1+3x2+4x3- 2 Using MATLAB commands solve the following system using Gaussian elimination with partial pivoting. Find P, L, and U...