0% found this document useful (0 votes)
7 views4 pages

Polynomial Function Analysis Tool

The document is a Python script that prompts the user to input the lowest and highest exponents for a polynomial function, as well as coefficients and limits for differentiation and integration. It calculates and displays the general form of the function, its derivative, and its integral, while handling various edge cases such as invalid inputs and special conditions. The script outputs the results of differentiation and integration, including checks for undefined or divergent cases.

Uploaded by

goodisagoodword
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Polynomial Function Analysis Tool

The document is a Python script that prompts the user to input the lowest and highest exponents for a polynomial function, as well as coefficients and limits for differentiation and integration. It calculates and displays the general form of the function, its derivative, and its integral, while handling various edge cases such as invalid inputs and special conditions. The script outputs the results of differentiation and integration, including checks for undefined or divergent cases.

Uploaded by

goodisagoodword
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

import math

import sys

b=int(input("Enter the lowest exponent of the function: "))

a=int(input("Enter the highest exponent of the function: "))

if a<b:

print("Please enter the values correctly")

[Link](1)

c,w,d,v,m,e,f,h,ix,dx,gen,l1,l2,l3,l4,t1,t2=a,a,b,b,b,97,97,0,0,0,[],[],[],[],[],True,True

print("The general form of the function is:")

while v<=a:

eq=chr(e)+"x^("+str(w)+")"

v+=1

e+=1

w-=1

[Link](eq)

print(" + ".join(gen))

print("Enter value of coefficients: ")

while m<=a:

l=float(input("Enter value of "+chr(f)+": "))

[Link](l)

f+=1

m+=1

xp=float(input("Enter the x coordinate for differentiation: "))

x1=float(input("Enter the lower limit for integration: "))

x2=float(input("Enter the upper limit for integration: "))

if x1>x2:

print("Please enter the limits correctly.")


[Link](1)

while d<=a:

if l1[h]==0:

pass

else:

if c==0: #function

j="("+str(l1[h])+")"

else:

j="("+str(l1[h])+")x^("+str(c)+")"

if c==1: #derivative

s="("+str(l1[h])+")"

ss=l1[h]

elif c==2:

s="("+str(l1[h]*c)+")x"

ss=l1[h]*c*xp

elif c==0:

s="0"

ss=0

else:

s="("+str(l1[h]*c)+")x^("+str(c-1)+")"

if xp==0 and c<=0:

ss=0

t2=False

else:

ss=l1[h]c*xp*(c-1)

if c==-1: #integral

q="("+str(l1[h])+")ln(|x|)"
if x2==0 or x1==0:

qs=0

t1=False

else:

if (x1<0 and x2>0):

qs=0

t1=False

else:

qs=l1[h]*([Link](abs(x2))-[Link](abs(x1)))

elif c==0:

q="("+str(l1[h])+")x"

qs=l1[h]*(x2-x1)

else:

q="("+str(l1[h])+"/"+str(c+1)+")x^("+str(c+1)+")"

if (x2==0 or x1==0) and c<(-1):

qs=0

t1=False

else:

qs=l1[h]/(c+1)((x2(c+1)-x1*(c+1)))

dx+=ss

ix+=qs

[Link](j)

[Link](s)

[Link](q)

d+=1

c-=1

h+=1
y=" + ".join(l2)

dy=" + ".join(l3)

iy=" + ".join(l4)+" + c"

print("The function is:")

print(y)

print("The derivative is:")

print(dy)

print("The integral is:")

print(iy)

if t2==False:

print("The differentiation at",xp,"is not defined.")

else:

print("The differentiation at",xp,"is:")

print(dx)

if t1==False:

print("The integration from",x1,"to",x2,"is divergent.")

else:

print("The integration from",x1,"to",x2,"is:")

print(ix)

You might also like