Google Classroom
GeoGebraGeoGebra Classroom

non linear regression.js (study)

(under construction)

function update edit js.script loading x2, y2 from AlgebraView. (a version with transfer of the function as ggb-text to js doubles the runtime in this case!) depending on the version the sandbox of this side prevents alert() messages displayed and the js.code from being executed - all alert()s have been disabled - close run by writing to green message box - click to clear! feel free to download Applet.ggb 4 local-ggb-installations or Offline Activity (.zip) 4 stand alone run from Details page and restore alert()s. based on Salvatore Pragliola with /* Your data. Please make sure that all vectors have the same dimension */ const x1 = [55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55]; const x2 = [0.001256, 0.007716, 0.01337, 0.019026, 0.027493, 0.033133, 0.050034, 0.066534, 0.086245, 0.105553, 0.125261, 0.156229, 0.189204, 0.232631, 0.265603, 0.28812, 0.32109, 0.345216, 0.377782, 0.410752, 0.433669, 0.467039, 0.488748]; const y = [15.5113, 16.3797, 17.1882, 18.0416, 18.8204, 19.2249, 19.8249, 20.4399, 20.9205, 21.386, 21.8068, 22.3632, 22.8748, 23.4324, 23.8543, 24.1107, 24.4727, 24.7592, 25.0613, 25.4084, 25.6349, 25.9222, 26.0588]; function Ulberg(u_p, x1, x2, y) { result = []; if (!((x1.length == x2.length) || (x2.length == y.length))) { alert("I vettori hanno grandezze diverse"); } for (var i = 0; i < y.length; i++) { //Funzione completa //valore_funzione = u_p[0] * Math.exp(-(x2[i] - u_p[1]) * (x2[i] - u_p[1]) / u_p[2]) + u_p[3]; valore_funzione = (12) + ((u_p[0] + u_p[1] * x1[i]) / 1) * x2[i] + u_p[2] * Math.log10(1 + ((u_p[3] + (u_p[4] / x1[i]) + (u_p[5] / (x1[i] * x1[i]))) / 1) * x2[i]); result.push(valore_funzione); } //console.log("Sono stata eseguita"); return result; --- ggb start: {1,1,1,1,1,1} Number_ofIterations: 100000 h gradient: 0.01 f(x):=Substitute( (12) + ((r1 + r2*55)/1)*x+ s*log10(1 + ((t1 + (t2/55) + (t3/(55^2)))/1)*x) , {r1, r2, s, t1,t2,t3} = Params) --- transfer function text form inputbox function="(12)+((a[0]+a[1]*55))*x+a[2]*Math.log10(1+((a[3]+(a[4]/55)+(a[5]/(55*55))))*x)" var ggbFunction = "return (" + ggbApplet.getValueString("function") + ")" valore_funzione = new Function('x', 'a', ggbFunction); run time ~ 30 sec (double to native js.function) ggb classic 6.x alert() dont stop code - better use ggb 5.2!