Prire de m'aider c urgent !!!



voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
from tkinter import *
from math import *
from f import f
from g import g
f= Tk()
#f['bg']='grey'
f.geometry("500x250+700+400")
f.title('Analyse numerique')
 
#L1 = Label(f,text="f(x) =")
#L1.pack()
#L1.place(x=40,y=20)
#vart=StringVar()
#e1 = Entry(f,textv=vart,width=10)
#e1.pack()
#e1.place(x=100,y=20)
L2 = Label(f,text="a =")
L2.pack()
L2.place(x=40,y=60)
vart=DoubleVar()
e2 = Entry(f,textv=vart,width=10)
e2.pack()
e2.place(x=100,y=60)
L3 = Label(f,text="b =")
L3.pack()
L3.place(x=40,y=100)
vart=DoubleVar()
e3 = Entry(f,textv=vart,width=10)
e3.pack()
e3.place(x=100,y=100)
L4 = Label(f,text="epsilon =")
L4.pack()
L4.place(x=40,y=140)
vart=DoubleVar()
e4 = Entry(f,textv=vart,width=10)
e4.pack()
e4.place(x=100,y=140)
L5 = Label(f,text="x 0 =")
L5.pack()
L5.place(x=40,y=180)
vart=DoubleVar()
e5 = Entry(f,textv=vart,width=10)
e5.pack()
e5.place(x=100,y=180)
L6 = Label(f,text="n =")
L6.pack()
L6.place(x=40,y=220)
vart=DoubleVar()
e6 = Entry(f,textv=vart,width=10)
e6.pack()
e6.place(x=100,y=220)
L0 = Label(f,text="x =")
L0.pack()
L0.place(x=350,y=90)
input = []
L= Label(f,text=input)
L.pack()
L.place(x=380,y=90)
 
 
 
def dichotomie(f,a,b,n):
    for i in range(n):
        c = (a+b)/2
        if f(a)*f(c) <= 0:
            b = c
        else:
            a = c
    return a,b
 
def newton(f,g,u_0,epsilon):
 #f(u_n)=f’(u_n)*(u_n-u_{n+1})
 u=u_0 #u contient u_n
 v=u-f(u)/g(u) #v contient u_{n+1}
 while fabs(u-v)>epsilon:
   u=v
   v=u-f(u)/g(u)
 return v
 
 
def secante(f,a,b,n):
 for i in range(n):
       a = a-f(a)*(b-a)/(f(b)-f(a))
 return a 
 
 
def callback1():
    #f=e1.get()
    a=e2.get()
    b=e3.get()
    epsilon=e4.get()
    #result=(int)result
    result = dichotomie(f,a,b,epsilon)
    L.config(text=result)
 
def callback2():
    #f=e1.get()
    u_0=e5.get()
    epsilon=e4.get()
    result = newton(f,g,u_0,epsilon)
 
    L.config(text=result)
 
def callback3():
    #f=e1.get()
    a=int(e2.get())
 
    b=int(e3.get())
    n=int(e6.get())
    result = secante(f,a,b,n)
 
    L.config(text=result)
 
b1 = Button(f,text="dichotomie", command=callback1,bd=4,width=10)
b2 = Button(f,text="newton", command=callback2,bd=4,width=10)
b3 = Button(f,text="la secante", command=callback3,bd=4,width=10)
b1.pack()
b1.place(x=220,y=60)
b2.pack()
b2.place(x=220,y=90)
b3.pack()
b3.place(x=220,y=120)
f.mainloop()