Skip to content

Update lagrange.py#100

Open
mutlukilic wants to merge 1 commit into
nyucel:masterfrom
mutlukilic:patch-1
Open

Update lagrange.py#100
mutlukilic wants to merge 1 commit into
nyucel:masterfrom
mutlukilic:patch-1

Conversation

@mutlukilic
Copy link
Copy Markdown

#!/usr/bin/python3

-- coding: utf-8 --

dosya=open("lagrange.txt")
degerler = []

for line in dosya.readlines():
line = line.rstrip('\n').split(' ')
degerler.append(line)
dosya.close()

x = int(input("hangi değerin hesaplanmasını istiyorsunuz: "))

sonuc,boyut,a,b= 0,len(degerler[0]),0,0
for i in range(boyut):
L = 1
for j in range(boyut):
if(a == j) : continue
L *= (x-int(degerler[0][j]))/(int(degerler[0][a])-int(degerler[0][j]))
if(b != boyut): L *= int(degerler[1][b])
sonuc += L
b,a = b+1,a+1

print(sonuc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant