Inverse Composition Rules: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 13: | Line 13: | ||
<tr> | <tr> | ||
<td> </td> | <td> </td> | ||
<td><input type="radio" name="f" value="sin" checked onChange="change(this)"></td> | <td><input type="radio" name="f" value="sin" checked onChange="change(f,this)"></td> | ||
<td><input type="radio" name="f" value="cos" onChange="change(this)"></td> | <td><input type="radio" name="f" value="cos" onChange="change(f,this)"></td> | ||
<td><input type="radio" name="f" value="tan" onChange="change(this)"></td> | <td><input type="radio" name="f" value="tan" onChange="change(f,this)"></td> | ||
<td><input type="radio" name="f" value="square" onChange="change(this)"></td> | <td><input type="radio" name="f" value="square" onChange="change(f,this)"></td> | ||
<td><input type="radio" name="f" value="sinh" onChange="change(this)"></td> | <td><input type="radio" name="f" value="sinh" onChange="change(f,this)"></td> | ||
<td><input type="radio" name="f" value="exp" onChange="change(this)"></td> | <td><input type="radio" name="f" value="exp" onChange="change(f,this)"></td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 31: | Line 31: | ||
<tr> | <tr> | ||
<td> </td> | <td> </td> | ||
<td><input type="radio" name="g" value="asin" checked></td> | <td><input type="radio" name="g" value="asin" checked onChange="change(g,this)"></td> | ||
<td><input type="radio" name="g" value="acos"></td> | <td><input type="radio" name="g" value="acos" onChange="change(g,this)></td> | ||
<td><input type="radio" name="g" value="atan"></td> | <td><input type="radio" name="g" value="atan" onChange="change(g,this)></td> | ||
<td><input type="radio" name="g" value="sqrt"></td> | <td><input type="radio" name="g" value="sqrt" onChange="change(g,this)></td> | ||
<td><input type="radio" name="g" value="asinh"></td> | <td><input type="radio" name="g" value="asinh" onChange="change(g,this)></td> | ||
<td><input type="radio" name="g" value="log"></td> | <td><input type="radio" name="g" value="log" onChange="change(g,this)></td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
Line 45: | Line 45: | ||
var f, g; | var f, g; | ||
var change = function(obj) { | var change = function(func,obj) { | ||
var t = obj.value; | var t = obj.value; | ||
if (t=='sin') { func = function(x) { return Math.sin(x); } | |||
else if (t=='cos') { func = function(x) { return Math.cos(x); } | |||
else if (t=='tan') { func = function(x) { return Math.tan(x); } | |||
else if (t=='square') { func = function(x) { return x*x; } | |||
else if (t=='sinh') { func = function(x) { return brd.sinh(x); } | |||
else if (t=='exp') { func = function(x) { return Math.exp(x); } | |||
else if (t=='asin') { func = function(x) { return Math.asin(x); } | |||
else if (t=='acos') { func = function(x) { return Math.acos(x); } | |||
else if (t=='atan') { func = function(x) { return Math.atan(x); } | |||
else if (t=='sqrt') { func = function(x) { return Math.sqrt(x); } | |||
else if (t=='asinh') { func = function(x) { return Math.log(x+Math.sqrt(1+x*x)); } | |||
else if (t=='log') { func = function(x) { return Math.log(x); } | |||
} | } | ||
Revision as of 13:29, 19 June 2009