CoCalc Public Files4 / 4_1_new.sagews
Author: Georgy Lazarev
Views : 25
Compute Environment: Ubuntu 18.04 (Deprecated)
def solve_s(s1,s2):
a=s1[0]+s2[0]*(-(s1[1])/(s2[1]))
b=s1[2]+s2[2]*(-(s1[1])/(s2[1]))
g=b/a
h=((s2[2]-s2[0]*g)/(s2[1])).n()
return [g,h]
def my_det(l1,l2):
return l1[0]*l2[1]-l2[0]*l1[1]

def func1(x,y):
return cos(x+0.5)+y-0.8
def func2(x,y):
return sin(y)-2*x-1.6
def dfunc1_x(x,y):
return -sin(x+0.5)
def dfunc1_y(x,y):
return int(1)
def dfunc2_x(x,y):
return -2
def dfunc2_y(x,y):
return cos(y)

eps=10^(-6)
k=0
x=-1
y=-0.5
k=0
while (1):
k+=1
k
a=dfunc1_x(x,y)
b=dfunc1_y(x,y)
e=-func1(x,y)
c=dfunc2_x(x,y)
d=dfunc2_y(x,y)
f=func2(x,y)
l1=[a,b]
l2=[c,d]
l3=[-e,b]
l4=[f,d]
l5=[a,-e]
l6=[c,f]
d=my_det(l1,l2)
d_x=my_det(l3,l4)
d_y=my_det(l5,l6)
g,h=(d_x)/d,(d_y)/d
x1=x-g
x1
y1=y-h
y1
if abs(g)<eps and abs(h)<eps:
break
x=x1
y=y1
x
y

1 -0.879672669800883 -0.135270556979890 2 -0.866614264952472 -0.133625659197635 3 -0.866580807873687 -0.133558326501273 4 -0.866580807525610 -0.133558326103536 -0.866580807873687 -0.133558326501273


plot(0.8-cos(x+0.5), (x,-2,2))+plot(arcsin(2*x+1.6),(x,-3,3))

verbose 0 (2733: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 167 points. verbose 0 (2733: plot.py, generate_plot_points) Last error message: ''