{{ stepNode.name }}
| {{ 'ml-lesson-number-slides' | message : article.intro.bblockCount}} |
| {{ 'ml-lesson-number-exercises' | message : article.intro.exerciseCount}} |
| {{ 'ml-lesson-time-estimation' | message }} |
Jonas (Diskussion | bidrag) | Jonas (Diskussion | bidrag) | ||
Rad 18: | Rad 18: | ||
b.xaxis(1,0,'x'); | b.xaxis(1,0,'x'); | ||
b.yaxis(1,0,'y'); | b.yaxis(1,0,'y'); | ||
− | var p = b.point(0,1.5 | + | var p = b.point(0,1.5); |
var graph = b.board.create('functiongraph', [function(x){ return p.Y()*JXG.Math.pow(1.2, x);},-10, 10],{strokeWidth:2}); | var graph = b.board.create('functiongraph', [function(x){ return p.Y()*JXG.Math.pow(1.2, x);},-10, 10],{strokeWidth:2}); | ||
var l = b.txt(2,function(){return graph.Y(2);},'y=' + p.Y() + '\\cdot 1.2^x',{flag:true}); | var l = b.txt(2,function(){return graph.Y(2);},'y=' + p.Y() + '\\cdot 1.2^x',{flag:true}); | ||
Rad 28: | Rad 28: | ||
"border":"1px solid blue" | "border":"1px solid blue" | ||
}); | }); | ||
+ | |||
+ | var ejexp = b.textA(4.5,2,'Ej exponentialfunktion!',{display:'html', cssClass:'legend-flag', visible:false}); | ||
+ | $(b.getId(ejexp)).css({ | ||
+ | "background-color":"#fa9696", | ||
+ | "border-color":"red" | ||
+ | }); | ||
+ | b.hide(ejexp); | ||
+ | |||
mlg.af('villkorgraph645.k1', function(sliderValue){ | mlg.af('villkorgraph645.k1', function(sliderValue){ | ||
− | p.moveTo([0,sliderValue]); | + | p.moveTo([0,sliderValue]); |
− | if(sliderValue=== | + | if (sliderValue===0) { |
− | + | b.changeText(l,'y=0'); | |
− | + | graph.setAttribute({strokeColor:'red'}); | |
− | + | $(b.getId(l)).css({ | |
− | } else { | + | "background-color":"#fa9696", |
− | + | "border-color":"red" | |
− | } | + | }); |
+ | b.show(ejexp); | ||
+ | } | ||
+ | else { | ||
+ | b.changeText(l,'y='+sliderValue.toFixed(2)+'\\cdot1.2^x'); | ||
+ | graph.setAttribute({strokeColor:'blue'}); | ||
+ | $(b.getId(l)).css({ | ||
+ | "background-color":"rgb(150, 150, 255)", | ||
+ | "border":"1px solid blue" | ||
+ | }); | ||
+ | b.hide(ejexp); | ||
+ | } | ||
}); | }); | ||
</jsxgpre> | </jsxgpre> | ||
Rad 43: | Rad 62: | ||
var b = mlg.board(mlg.bb.slider(-2.8,2.8),{keepaspectratio:false}); | var b = mlg.board(mlg.bb.slider(-2.8,2.8),{keepaspectratio:false}); | ||
var s = b.slider(1.5,null,null,{title:{label:'Välj ' + 'C'.italics() + '-värde'},snapWidth:-1,precision:2}); | var s = b.slider(1.5,null,null,{title:{label:'Välj ' + 'C'.italics() + '-värde'},snapWidth:-1,precision:2}); | ||
− | |||
b.translate(s.title,-0.4,0.3); | b.translate(s.title,-0.4,0.3); | ||
− | + | s.slider.on('drag',function(){ | |
+ | if(Math.abs(s.slider.Value()) < 0.07){ | ||
+ | s.slider.setAttribute({snapWidth:0.07}); | ||
+ | } | ||
+ | else{ | ||
+ | s.slider.setAttribute({snapWidth:-1}); | ||
+ | } | ||
+ | mlg.cf("villkorgraph645.k1", s.slider.Value()); | ||
+ | }); | ||
</jsxgpre> | </jsxgpre> | ||
</ebox> | </ebox> |
y=C⋅ax
Koefficienten C anger det y-värde där funktionens graf skär y-axeln, vilket också kan tolkas som funktionens startvärde. Basen a i potensen kan tolkas som en förändringsfaktor. För båda dessa konstanter finns det villkor som anger vilka värden de får anta.
Koefficienten C får inte vara noll eftersom det skulle ge en vågrät linje linje längs med y=0, vilket då inte längre skulle vara en exponentialfunktion. Multipliceras ax med 0 blir ju produkten 0 oavsett potensens värde.