How to send JavaScript points to Geogebra

Author:
JP MathPR

Send JavaScript points to Geogebra

////////////////////////////////////////////////// //Send JavaScript points to Geogebra individually var zr=0.2 ; zi=0.2; tmp=0.5; x=0.4 ; y=0.4; var max=ggbApplet.getValue('max'); ggbApplet.evalCommand("B=(0.1,0.1)"); ggbApplet.evalCommand("SetTrace[ B , true ] "); var n=1; for (i=1; i<max; i++) x= -1.5+0.01*i ; {for (j=1; j<max; j++) { y= -1+0.01*j ; zr=x^2-y^2 + x ; zi=2*x*y + y ; k=0; while ((zr^2+zi^2)<4 && (k<17)) { tmp=zr; zr=zr^2-zi^2 + x ; zi=2*tmp*zi + y ; k=k+1 ; ggbApplet.evalCommand("B"+n+"=("+zr+","+zi+")"); ggbApplet.evalCommand("SetColor[B"+n +","+255/j+",0,"+255/i*max+"]"); ggbApplet.evalCommand("ShowLabel(B"+n+",false)"); n++; }}} ////////////////////////////////////////////////////// //Send JavaScript points to Geogebra //as a Points List with String var zr=0.2 ; zi=0.2; tmp=0.5; x=0.4 ; y=0.4; var max=ggbApplet.getValue('max'); ggbApplet.evalCommand("B=(0.1,0.1)"); ggbApplet.evalCommand("SetTrace[ B , true ] "); var n=1; var ListP="ListP={" for (i=1; i<max; i++) x= -1.5+0.01*i ; {for (j=1; j<max; j++) { y= -1+0.01*j ; zr=x^2-y^2 + x ; zi=2*x*y + y ; k=0; while ((zr^2+zi^2)<4 && (k<17)) { tmp=zr; zr=zr^2-zi^2 + x ; zi=2*tmp*zi + y ; k=k+1 ; if(n==1){ ListP=ListP+"("+zr+","+zi+")"; }else{ ListP=ListP+",("+zr+","+zi+")"; } n++; }}} ListP=ListP+"}"; ggbApplet.evalCommand(ListP); /////////////////////////////////////////////////////////// // Send JavaScript points to Geogebra // as a Points List with setListValue var zr=0.2 ; zi=0.2; tmp=0.5; x=0.4 ; y=0.4; var max=ggbApplet.getValue('max'); max=10; ggbApplet.evalCommand("B=(0.1,0.1)"); ggbApplet.evalCommand("SetTrace[ B , true ] "); var n=1; ggbApplet.evalCommand("Lzr={}"); ggbApplet.evalCommand("Lzi={}"); for (i=1; i<max; i++) x= -1.5+0.01*i ; {for (j=1; j<max; j++) { y= -1+0.01*j ; zr=x^2-y^2 + x ; zi=2*x*y + y ; k=0; while ((zr^2+zi^2)<4 && (k<17)) { tmp=zr; zr=zr^2-zi^2 + x ; zi=2*tmp*zi + y ; k=k+1 ; ggbApplet.setListValue("Lzr",n,zr); ggbApplet.setListValue("Lzi",n,zi); n++; }}} ggbApplet.evalCommand("Sequence((Element(Lzr,i),Element(Lzi,i)),i,1,Length(Lzr),1)");