Skip to content

Instantly share code, notes, and snippets.

@SeqviriouM
Created November 29, 2012 13:27
Show Gist options
  • Save SeqviriouM/4169062 to your computer and use it in GitHub Desktop.
Save SeqviriouM/4169062 to your computer and use it in GitHub Desktop.
AnalyzShemy
<html>
<title>Laba3</title>
<script type="text/javascript" src="raphael.js"></script>
<script>
//var paper = Raphael(0, 0 , 1500, 800);
var activate = function(j)
{
var paper = Raphael(0, 0 , 1500, 800);
var text = paper.text(100,50,"Исходная схема").attr({"font-size":20,"fill":"black"})
var im1 = paper.image("Zadanie.png",200,10,300,150)
var vvod = paper.set() // second button
vvod.push(
paper.rect(550,50,200,70).attr({"fill":"silver"}),
paper.text(650,80,"Исходные данные").attr({"font-size":20,"fill":"black"})
)
var text1 = paper.text(650,200,"Анализ схемы в различных алфавитах").attr({"font-size":20,"fill":"black"})
var st1 = paper.set() // second button
st1.push(
paper.rect(100,250,250,100).attr({"fill":"silver"}),
paper.text(220,300,"2-х значный алфавит").attr({"font-size":20,"fill":"black"})
)
var st2 = paper.set() // second button
st2.push(
paper.rect(500,250,250,100).attr({"fill":"silver"}),
paper.text(620,300,"3-х значный алфавит").attr({"font-size":20,"fill":"black"})
)
var st3 = paper.set()
st3.push(
paper.rect(900,250,250,100).attr({"fill":"silver"}),
paper.text(1020,300,"5-ти значный алфавит").attr({"font-size":20,"fill":"black"})
)
var text2 = paper.text(650,400,"Анализ схемы по следующему методу:").attr({"font-size":20,"fill":"black"})
var st4 = paper.set()
st4.push(
paper.rect(500,450,250,100).attr({"fill":"silver"}),
paper.text(620,500,"Зейдель").attr({"font-size":20,"fill":"black"})
)
st1.mouseover(function()
{
st1.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st2.mouseover(function()
{
st2.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st3.mouseover(function()
{
st3.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st4.mouseover(function()
{
st4.animate({"transform" : "s1.3","opacity": 0.5},150)
})
vvod.mouseover(function()
{
vvod.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st1.mouseout(function()
{
st1.animate({"transform" : "s1","opacity": 1},150)
})
st2.mouseout(function()
{
st2.animate({"transform" : "s1","opacity": 1},150)
})
st3.mouseout(function()
{
st3.animate({"transform" : "s1","opacity": 1},150)
})
st4.mouseout(function()
{
st4.animate({"transform" : "s1","opacity": 1},150)
})
vvod.mouseout(function()
{
if (j === 0)
vvod.animate({"transform" : "s1","opacity": 0.3},150)
else
vvod.animate({"transform" : "s1","opacity": 1},150)
})
st1.click(function()
{
if (j === 0)
vvod.animate({"fill":"red","opacity":0.3},500)
else
{
paper.remove();
main(2);
}
})
st2.click(function()
{
if (j === 0)
vvod.animate({"fill":"red","opacity":0.3},500)
else
{
paper.remove();
main(3);
}
})
st3.click(function()
{
if (j === 0)
vvod.animate({"fill":"red","opacity":0.3},500)
else
{
paper.remove();
main(5);
}
})
st4.click(function()
{
if (j === 0)
vvod.animate({"fill":"red","opacity":0.3},500)
else
{
paper.remove();
main(4);
}
})
vvod.click(function()
{
paper.remove();
//document.location = "Input.html"
main(1);
})
}
var umnog= function(a,b,l)
{
var tabltwo = [[0,0],[0,1]]
var tablthree = [[0,0,0],[0,1,2],[0,2,2]]
var tablfive = [[0,0,0,0],[0,1,2,3,4],[0,2,2,2,2],[0,3,2,3,2],[0,4,2,2,4]]
if (l === 2)
return tabltwo[a][b];
if (l === 3)
return tablthree[a][b];
if (l === 5)
return tablfive[a][b];
};
var sum = function(a,b,l)
{
var tabltwo = [[0,1],[1,1]]
var tablthree = [[0,1,2],[1,1,1],[2,1,2]]
var tablfive = [[0,1,2,3,4],[1,1,1,1,1],[2,1,2,2,2],[3,1,2,3,2],[4,1,2,2,4]]
if (l === 2)
return tabltwo[a][b];
if (l === 3)
return tablthree[a][b];
if (l === 5)
return tablfive[a][b];
};
var otr = function(a,l)
{
var tabltwo = [1,0]
var tablthree = [1,0,2]
var tablfive = [1,0,2,4,3]
if (l === 2)
return tabltwo[a];
if (l === 3)
return tablthree[a];
if (l === 5)
return tablfive[a];
};
var midthree = function(a)
{
if (a[0] != a[1])
{
a[2] = a[1];
a[1] = 2;
}
else
{
a[2] = a[1];
a[1] = a[0];
}
return a;
}
var midfive = function(a)
{
if (a[0] != a[1])
{
if (a[0] === 0)
{
a[2] = a[1];
a[1] = 3;
}
else
{
a[2] = a[1];
a[1] = 4;
}
}
else
{
a[2] = a[1];
a[1] = a[0];
}
return a;
}
var statproverka = function(a)
{
if ((a === [0,2,0].toString()) || (a === [1,2,1].toString()))
return false;
else
return true;
}
var dinamikproverka = function(a)
{
if ((a === [0,2,1].toString()) || (a === [1,2,0].toString()))
return false;
else
return true;
}
var two = function(a,b,c,d)
{
var e = new Array();
var f = new Array();
var g = new Array();
var h = new Array();
var r = new Array();
var q = new Array();
var paper1 = Raphael(0, 0 , 700, 500)
e[0] = umnog(a[0],c[0],2);
e[1] = umnog(a[1],c[1],2);
f[0] = umnog(b[0],c[0],2);
f[1] = umnog(b[1],c[1],2);
g[0] = sum(e[0],f[0],2);
g[1] = sum(e[1],f[1],2);
h[0] = otr(umnog(g[0],c[0],2),2);
h[1] = otr(umnog(g[1],c[1],2),2);
r[0] = umnog(h[0],d[0],2);
r[1] = umnog(h[1],d[1],2);
q[0] = sum(g[0],r[0],2);
q[1] = sum(g[1],r[1],2);
var texttwo = new Array();
texttwo[0]=paper1.text(150,10,"Двухзначный алфавит: ").attr({"font-size":20,"fill":"black","font-family":"cursive","font-weight":900})
texttwo[1]=paper1.text(100,50,"a: "+a[0]+" -> "+a[1]).attr({"font-size":15,"fill":"black"})
texttwo[2]=paper1.text(100,70,"b: "+b[0]+" -> "+b[1]).attr({"font-size":15,"fill":"black"})
texttwo[3]=paper1.text(100,90,"c: "+c[0]+" -> "+c[1]).attr({"font-size":15,"fill":"black"})
texttwo[4]=paper1.text(100,110,"d: "+d[0]+" -> "+d[1]).attr({"font-size":15,"fill":"black"})
texttwo[5]=paper1.text(100,130,"e: "+e[0]+" -> "+e[1]).attr({"font-size":15,"fill":"black"})
texttwo[6]=paper1.text(100,150,"f: "+f[0]+" -> "+f[1]).attr({"font-size":15,"fill":"black"})
texttwo[7]=paper1.text(100,170,"g: "+g[0]+" -> "+g[1]).attr({"font-size":15,"fill":"black"})
texttwo[8]=paper1.text(100,190,"h: "+h[0]+" -> "+h[1]).attr({"font-size":15,"fill":"black"})
texttwo[9]=paper1.text(100,210,"r: "+r[0]+" -> "+r[1]).attr({"font-size":15,"fill":"black"})
texttwo[10]=paper1.text(100,230,"q: "+q[0]+" -> "+q[1]).attr({"font-size":15,"fill":"black"})
for (x in texttwo)
texttwo[x];
st = paper1.set()
st.push(
paper1.rect(50, 250, 150, 50).attr({"fill":"silver"}),
paper1.text(125,275,"Назад").attr({"font-size":25})
)
st.mouseover(function()
{
st.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st.mouseout(function()
{
st.animate({"transform" : "s1","opacity": 1},150)
})
st.click(function()
{
paper1.remove();
activate();
})
/*document.write("<br>")
document.write("a: "+a[0]+" -> "+a[1])
document.write("<br>")
document.write("b: "+b[0]+" -> "+b[1])
document.write("<br>")
document.write("c: "+c[0]+" -> "+c[1])
document.write("<br>")
document.write("d: "+d[0]+" -> "+d[1])
document.write("<br>")
document.write("e: "+e[0]+" -> "+e[1])
document.write("<br>")
document.write("f: "+f[0]+" -> "+f[1])
document.write("<br>")
document.write("g: "+g[0]+" -> "+g[1])
document.write("<br>")
document.write("h: "+h[0]+" -> "+h[1])
document.write("<br>")
document.write("r: "+r[0]+" -> "+r[1])
document.write("<br>")
document.write("q: "+q[0]+" -> "+q[1])
*/
}
var three = function(a,b,c,d)
{
var e = new Array();
var f = new Array();
var g = new Array();
var h = new Array();
var r = new Array();
var q = new Array();
var paper1 = Raphael(0,0,1000,700)
var a = midthree(a);
var b = midthree(b);
var c = midthree(c);
var d = midthree(d);
e[0] = umnog(a[0],c[0],3);
e[1] = umnog(a[1],c[1],3);
e[2] = umnog(a[2],c[2],3);
f[0] = umnog(b[0],c[0],3);
f[1] = umnog(b[1],c[1],3);
f[2] = umnog(b[2],c[2],3);
g[0] = sum(e[0],f[0],3);
g[1] = sum(e[1],f[1],3);
g[2] = sum(e[2],f[2],3);
h[0] = otr(umnog(g[0],c[0],3),3);
h[1] = otr(umnog(g[1],c[1],3),3);
h[2] = otr(umnog(g[2],c[2],3),3);
r[0] = umnog(h[0],d[0],3);
r[1] = umnog(h[1],d[1],3);
r[2] = umnog(h[2],d[2],3);
q[0] = sum(g[0],r[0],3);
q[1] = sum(g[1],r[1],3);
q[2] = sum(g[2],r[2],3);
var texttwo = new Array();
texttwo[0]=paper1.text(150,10,"Трёхзначный алфавит: ").attr({"font-size":20,"fill":"black","font-family":"cursive","font-weight":900})
texttwo[1]=paper1.text(100,50,"a: "+a[0]+" -> "+a[1]+" -> "+a[2]).attr({"font-size":15,"fill":"black"})
texttwo[2]=paper1.text(100,70,"b: "+b[0]+" -> "+b[1]+" -> "+b[2]).attr({"font-size":15,"fill":"black"})
texttwo[3]=paper1.text(100,90,"c: "+c[0]+" -> "+c[1]+" -> "+c[2]).attr({"font-size":15,"fill":"black"})
texttwo[4]=paper1.text(100,110,"d: "+d[0]+" -> "+d[1]+" -> "+d[2]).attr({"font-size":15,"fill":"black"})
texttwo[5]=paper1.text(100,130,"e: "+e[0]+" -> "+e[1]+" -> "+e[2]).attr({"font-size":15,"fill":"black"})
texttwo[6]=paper1.text(100,150,"f: "+f[0]+" -> "+f[1]+" -> "+f[2]).attr({"font-size":15,"fill":"black"})
texttwo[7]=paper1.text(100,170,"g: "+g[0]+" -> "+g[1]+" -> "+g[2]).attr({"font-size":15,"fill":"black"})
texttwo[8]=paper1.text(100,190,"h: "+h[0]+" -> "+h[1]+" -> "+h[2]).attr({"font-size":15,"fill":"black"})
texttwo[9]=paper1.text(100,210,"r: "+r[0]+" -> "+r[1]+" -> "+r[2]).attr({"font-size":15,"fill":"black"})
texttwo[10]=paper1.text(100,230,"q: "+q[0]+" -> "+q[1]+" -> "+q[2]).attr({"font-size":15,"fill":"black"})
for (x in texttwo)
texttwo[x];
st = paper1.set()
st.push(
paper1.rect(50, 250, 250, 50).attr({"fill":"silver"}),
paper1.text(175,275,"Статическая ошибка").attr({"font-size":25})
)
st1 = paper1.set()
st1.push(
paper1.rect(50, 350, 150, 50).attr({"fill":"silver"}),
paper1.text(125,375,"Назад").attr({"font-size":25})
)
st.mouseover(function()
{
st.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st.mouseout(function()
{
st.animate({"transform" : "s1","opacity": 1},150)
})
st.click(function()
{
if (statproverka(e.toString()) === false)
texttwo[5].animate({"fill":"red"},300)
if (statproverka(f.toString()) === false)
texttwo[6].animate({"fill":"red"},300)
if (statproverka(g.toString()) === false)
texttwo[7].animate({"fill":"red"},300)
if (statproverka(h.toString()) === false)
texttwo[8].animate({"fill":"red"},300)
if (statproverka(r.toString()) === false)
texttwo[9].animate({"fill":"red"},300)
if (statproverka(q.toString()) === false)
texttwo[10].animate({"fill":"red"},300)
})
st1.mouseover(function()
{
st1.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st1.mouseout(function()
{
st1.animate({"transform" : "s1","opacity": 1},150)
})
st1.click(function()
{
paper1.remove();
activate();
})
/*document.write("Трёхзначный алфавит: ")
document.write("<br>")
document.write("a "+a[0]+" -> "+a[1]+" -> "+a[2])
document.write("<br>")
document.write("b: "+b[0]+" -> "+b[1]+" -> "+b[2])
document.write("<br>")
document.write("c: "+c[0]+" -> "+c[1]+" -> "+c[2])
document.write("<br>")
document.write("d: "+d[0]+" -> "+d[1]+" -> "+d[2])
document.write("<br>")
document.write("e: "+e[0]+" -> "+e[1]+" -> "+e[2])
if (statproverka(e.toString()) === false)
document.write(" - Статическая ошибка")
document.write("<br>")
document.write("f: "+f[0]+" -> "+f[1]+" -> "+f[2])
if (statproverka(f.toString()) === false)
document.write(" - Статическая ошибка")
document.write("<br>")
document.write("g: "+g[0]+" -> "+g[1]+" -> "+g[2])
if (statproverka(g.toString()) === false)
document.write(" - Статическая ошибка")
document.write("<br>")
document.write("h: "+h[0]+" -> "+h[1]+" -> "+h[2])
if (statproverka(h.toString()) === false)
document.write(" - Статическая ошибка")
document.write("<br>")
document.write("r: "+r[0]+" -> "+r[1]+" -> "+r[2])
if (statproverka(r.toString()) === false)
document.write(" - Статическая ошибка")
document.write("<br>")
document.write("q: "+q[0]+" -> "+q[1]+" -> "+q[2])
if (statproverka(q.toString()) === false)
document.write(" - Статическая ошибка")*/
}
var five = function(a,b,c,d)
{
var e = new Array();
var f = new Array();
var g = new Array();
var h = new Array();
var r = new Array();
var q = new Array();
var paper1 = Raphael(0,0,1000,700)
a = midfive(a);
b = midfive(b);
c = midfive(c);
d = midfive(d);
e[0] = umnog(a[0],c[0],5);
e[1] = umnog(a[1],c[1],5);
e[2] = umnog(a[2],c[2],5);
f[0] = umnog(b[0],c[0],5);
f[1] = umnog(b[1],c[1],5);
f[2] = umnog(b[2],c[2],5);
g[0] = sum(e[0],f[0],5);
g[1] = sum(e[1],f[1],5);
g[2] = sum(e[2],f[2],5);
h[0] = otr(umnog(g[0],c[0],5),5);
h[1] = otr(umnog(g[1],c[1],5),5);
h[2] = otr(umnog(g[2],c[2],5),5);
r[0] = umnog(h[0],d[0],5);
r[1] = umnog(h[1],d[1],5);
r[2] = umnog(h[2],d[2],5);
q[0] = sum(g[0],r[0],5);
q[1] = sum(g[1],r[1],5);
q[2] = sum(g[2],r[2],5);
var texttwo = new Array();
texttwo[0]=paper1.text(150,10,"Пятизначный алфавит: ").attr({"font-size":20,"fill":"black","font-family":"cursive","font-weight":900})
texttwo[1]=paper1.text(100,50,"a: "+a[0]+" -> "+a[1]+" -> "+a[2]).attr({"font-size":15,"fill":"black"})
texttwo[2]=paper1.text(100,70,"b: "+b[0]+" -> "+b[1]+" -> "+b[2]).attr({"font-size":15,"fill":"black"})
texttwo[3]=paper1.text(100,90,"c: "+c[0]+" -> "+c[1]+" -> "+c[2]).attr({"font-size":15,"fill":"black"})
texttwo[4]=paper1.text(100,110,"d: "+d[0]+" -> "+d[1]+" -> "+d[2]).attr({"font-size":15,"fill":"black"})
texttwo[5]=paper1.text(100,130,"e: "+e[0]+" -> "+e[1]+" -> "+e[2]).attr({"font-size":15,"fill":"black"})
texttwo[6]=paper1.text(100,150,"f: "+f[0]+" -> "+f[1]+" -> "+f[2]).attr({"font-size":15,"fill":"black"})
texttwo[7]=paper1.text(100,170,"g: "+g[0]+" -> "+g[1]+" -> "+g[2]).attr({"font-size":15,"fill":"black"})
texttwo[8]=paper1.text(100,190,"h: "+h[0]+" -> "+h[1]+" -> "+h[2]).attr({"font-size":15,"fill":"black"})
texttwo[9]=paper1.text(100,210,"r: "+r[0]+" -> "+r[1]+" -> "+r[2]).attr({"font-size":15,"fill":"black"})
texttwo[10]=paper1.text(100,230,"q: "+q[0]+" -> "+q[1]+" -> "+q[2]).attr({"font-size":15,"fill":"black"})
for (x in texttwo)
texttwo[x];
st = paper1.set()
st.push(
paper1.rect(50, 250, 250, 50).attr({"fill":"silver"}),
paper1.text(175,275,"Статическая ошибка").attr({"font-size":25})
)
st1 = paper1.set()
st1.push(
paper1.rect(50, 350, 270, 50).attr({"fill":"silver"}),
paper1.text(185,375,"Динамическая ошибка").attr({"font-size":25})
)
st2 = paper1.set()
st2.push(
paper1.rect(50, 450, 150, 50).attr({"fill":"silver"}),
paper1.text(125,475,"Назад").attr({"font-size":25})
)
st.mouseover(function()
{
st.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st.mouseout(function()
{
st.animate({"transform" : "s1","opacity": 1},150)
})
st.click(function()
{
for (x in texttwo)
texttwo[x].attr({"fill":"black"});
if (statproverka(e.toString()) === false)
texttwo[5].animate({"fill":"red"},300)
if (statproverka(f.toString()) === false)
texttwo[6].animate({"fill":"red"},300)
if (statproverka(g.toString()) === false)
texttwo[7].animate({"fill":"red"},300)
if (statproverka(h.toString()) === false)
texttwo[8].animate({"fill":"red"},300)
if (statproverka(r.toString()) === false)
texttwo[9].animate({"fill":"red"},300)
if (statproverka(q.toString()) === false)
texttwo[10].animate({"fill":"red"},300)
})
st1.mouseover(function()
{
st1.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st1.mouseout(function()
{
st1.animate({"transform" : "s1","opacity": 1},150)
})
st1.click(function()
{
for (x in texttwo)
texttwo[x].attr({"fill":"black"});
if (dinamikproverka(e.toString()) === false)
texttwo[5].animate({"fill":"red"},300)
if (dinamikproverka(f.toString()) === false)
texttwo[6].animate({"fill":"red"},300)
if (dinamikproverka(g.toString()) === false)
texttwo[7].animate({"fill":"red"},300)
if (dinamikproverka(h.toString()) === false)
texttwo[8].animate({"fill":"red"},300)
if (dinamikproverka(r.toString()) === false)
texttwo[9].animate({"fill":"red"},300)
if (dinamikproverka(q.toString()) === false)
texttwo[10].animate({"fill":"red"},300)
})
st2.mouseover(function()
{
st2.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st2.mouseout(function()
{
st2.animate({"transform" : "s1","opacity": 1},150)
})
st2.click(function()
{
paper1.remove();
activate();
})
/*
document.write("Пятизначный алфавит: ")
document.write("<br>")
document.write("a "+a[0]+" -> "+a[1]+" -> "+a[2])
document.write("<br>")
document.write("b: "+b[0]+" -> "+b[1]+" -> "+b[2])
document.write("<br>")
document.write("c: "+c[0]+" -> "+c[1]+" -> "+c[2])
document.write("<br>")
document.write("d: "+d[0]+" -> "+d[1]+" -> "+d[2])
document.write("<br>")
document.write("e: "+e[0]+" -> "+e[1]+" -> "+e[2])
if (statproverka(e.toString()) === false)
document.write(" - Статическая ошибка")
else if (dinamikproverka(e.toString()) === false)
document.write(" - Динамическая ошибка")
document.write("<br>")
document.write("f: "+f[0]+" -> "+f[1]+" -> "+f[2])
if (statproverka(f.toString()) === false)
document.write(" - Статическая ошибка")
else if (dinamikproverka(f.toString()) === false)
document.write(" - Динамическая ошибка")
document.write("<br>")
document.write("g: "+g[0]+" -> "+g[1]+" -> "+g[2])
if (statproverka(g.toString()) === false)
document.write(" - Статическая ошибка")
else if (dinamikproverka(g.toString()) === false)
document.write(" - Динамическая ошибка")
document.write("<br>")
document.write("h: "+h[0]+" -> "+h[1]+" -> "+h[2])
if (statproverka(h.toString()) === false)
document.write(" - Статическая ошибка")
else if (dinamikproverka(h.toString()) === false)
document.write(" - Динамическая ошибка")
document.write("<br>")
document.write("r: "+r[0]+" -> "+r[1]+" -> "+r[2])
if (statproverka(r.toString()) === false)
document.write(" - Статическая ошибка")
else if (dinamikproverka(r.toString()) === false)
document.write(" - Динамическая ошибка")
document.write("<br>")
document.write("q: "+q[0]+" -> "+q[1]+" -> "+q[2])
if (statproverka(q.toString()) === false)
document.write(" - Статическая ошибка")
else if (dinamikproverka(q.toString()) === false)
document.write(" - Динамическая ошибка")
*/
}
// Метод Зейделя
var zeydel = function(a,b,c,d)
{
var mas = [[],[]];
var k = 0;
var paper1 = Raphael(0,0,1000,700)
var h = 50;
var texttwo = new Array();
texttwo[0] = paper1.text(100,10,"Метод Зейделя:").attr({"font-size":20,"fill":"black","font-family":"cursive","font-weight":900})
for (var i=0;i<6;i++)
{
mas[0][i]=0;
}
texttwo.push(paper1.text(105,h,"E | F | G | H | R | Q").attr({"font-size":15}));
h+=20;
texttwo.push(paper1.text(100,h,"0: "+mas[0].join(" , ")).attr({"font-size":15}));
h+=20;
var i = 0;
do
{
i++;
mas[i]=mas[i-1].slice(0);
mas[i][0] = a&c; // e
mas[i][1] = b&c; // f
mas[i][2] = mas[1][0]|mas[1][1] // g
mas[i][3] = ~(mas[1][2]&c&mas[1][4])+2; // h
mas[i][4] = mas[1][3]&d; // r
mas[i][5] = mas[1][4]|mas[1][2]; // q
texttwo.push(paper1.text(100,h,i+": "+mas[i].join(" , ")).attr({"font-size":15}));
h+=20;
k++;
}
while ((mas[i-1].toString() != mas[i].toString()) && (k<25))
for (x in texttwo)
texttwo[x]
/*for (var j=0;j<=i;j++)
{
document.write(j+": "+mas[j][0]+" "+mas[j][1]+" "+mas[j][2]+" "+mas[j][3]+" "+mas[j][4]+" "+mas[j][5]+" ");
document.write("<br>");
}*/
st = paper1.set()
st.push(
paper1.rect(50, 250, 150, 50).attr({"fill":"silver"}),
paper1.text(125,275,"Анализ").attr({"font-size":25})
)
st1 = paper1.set()
st1.push(
paper1.rect(50, 350, 150, 50).attr({"fill":"silver"}),
paper1.text(125,375,"Назад").attr({"font-size":25})
)
st.mouseover(function()
{
st.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st.mouseout(function()
{
st.animate({"transform" : "s1","opacity": 1},150)
})
st1.mouseover(function()
{
st1.animate({"transform" : "s1.3","opacity": 0.5},150)
})
st1.mouseout(function()
{
st1.animate({"transform" : "s1","opacity": 1},150)
})
st.click(function()
{
alert("Данный метод сошёлся за "+ i + " итерации\nКол-во произведённых расчётов: " + (i*6));
})
st1.click(function()
{
paper1.remove();
activate();
})
}
var main = function(l)
{
var a = new Array();
var b = new Array();
var c = new Array();
var d = new Array();
/*
a = [0,1];
b = [1,1];
c = [1,0];
d = [0,1];
*/ //
// Ввод данныых
if (l === 1)
{
a[0] = prompt("Введите первоначальное значние на входе а: ")*1
a[1] = prompt("Введите конечное значние на входе а: ")*1
b[0] = prompt("Введите первоначальное значние на входе b: ")*1
b[1] = prompt("Введите конечное значние на входе b: ")*1
c[0] = prompt("Введите первоначальное значние на входе c: ")*1
c[1] = prompt("Введите конечное значние на входе c: ")*1
d[0] = prompt("Введите первоначальное значние на входе d: ")*1
d[1] = prompt("Введите конечное значние на входе d: ")*1
save = new dannye();
save.Init(a,b,c,d)
activate(1);
}
if (l === 2)
{
a = save.Reta().slice(0);
b = save.Retb().slice(0);
c = save.Retc().slice(0);
d = save.Retd().slice(0);
two(a,b,c,d);
}
if (l === 3)
{
a = save.Reta().slice(0);
b = save.Retb().slice(0);
c = save.Retc().slice(0);
d = save.Retd().slice(0);
three(a,b,c,d);
}
if (l === 5)
{
a = save.Reta().slice(0);
b = save.Retb().slice(0);
c = save.Retc().slice(0);
d = save.Retd().slice(0);
five(a,b,c,d);
}
if (l === 4)
{
a = save.Reta().slice(0);
b = save.Retb().slice(0);
c = save.Retc().slice(0);
d = save.Retd().slice(0);
zeydel(a[1],b[1],c[1],d[1]);
}
//alert(a+" "+umnog(a,b,l)+" "+b+"\n"+a+" "+sum(a,b,l)+" "+b+"\n"+a+" "+otr(a,l)+" "+b)
}
var dannye = function()
{
this.a = new Array()
this.b = new Array()
this.c = new Array()
this.d = new Array()
this.Init = function(a,b,c,d)
{
this.a = a
this.b = b
this.c = c
this.d = d
}
this.Reta = function()
{
return this.a;
}
this.Retb = function()
{
return this.b;
}
this.Retc = function()
{
return this.c;
}
this.Retd = function()
{
return this.d;
}
}
//activate();
</script>
<body onload = "activate(0)">
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment