{{ tocSubheader }}
| {{ 'ml-lesson-number-slides' | message : article.intro.bblockCount }} |
| {{ 'ml-lesson-number-exercises' | message : article.intro.exerciseCount }} |
| {{ 'ml-lesson-time-estimation' | message }} |
Karin.hedin@osteraker.se (Diskussion | bidrag) | Karin.hedin@osteraker.se (Diskussion | bidrag) | ||
Rad 19: | Rad 19: | ||
var p4 = b.point(p2.X() - xdist,0); | var p4 = b.point(p2.X() - xdist,0); | ||
//var p3 = b.point(p1.X(),0,{fixed:false}); | //var p3 = b.point(p1.X(),0,{fixed:false}); | ||
− | var graph = b.board.create('functiongraph', [function(x){ return (p1.Y() - p2.Y())*JXG.Math.pow((x-p2.X())/(p1.X() - p2.X()), 2) + p2.Y();},-3, 22],{strokeWidth:2,doAdvancedPlot:false,numberPointsLow:150,numberPointsHigh:150}); | + | |
+ | function func(x){ | ||
+ | return (p1.Y() - p2.Y())*JXG.Math.pow((x-p2.X())/(p1.X() - p2.X()), 2) + p2.Y(); | ||
+ | } | ||
+ | |||
+ | var graph = b.board.create('functiongraph', [function(x){ return (p1.Y() - p2.Y())*JXG.Math.pow((x-p2.X())/(p1.X() - p2.X()), 2) + p2.Y();},function() { | ||
+ | if(Math.abs(func(p2.X()-3)) > 12){ | ||
+ | return p2.X() - 3; | ||
+ | } | ||
+ | if(Math.abs(func(p2.X()-6)) > 12){ | ||
+ | return p2.X() - 6; | ||
+ | } | ||
+ | return -3; | ||
+ | }, function() { | ||
+ | if(Math.abs(func(p2.X()+3)) > 12){ | ||
+ | return p2.X() + 3; | ||
+ | } | ||
+ | if(Math.abs(func(p2.X()+6)) > 12){ | ||
+ | return p2.X() + 6; | ||
+ | } | ||
+ | return 22; | ||
+ | }],{strokeWidth:2,doAdvancedPlot:false,numberPointsLow:150,numberPointsHigh:150}); | ||
//graph.updateCurve(); | //graph.updateCurve(); | ||