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( | <td><input type="radio" name="f" value="sin" checked onChange="change(this)"></td> | ||
<td><input type="radio" name="f" value="cos" onChange="change( | <td><input type="radio" name="f" value="cos" onChange="change(this)"></td> | ||
<td><input type="radio" name="f" value="tan" onChange="change( | <td><input type="radio" name="f" value="tan" onChange="change(this)"></td> | ||
<td><input type="radio" name="f" value="square" onChange="change( | <td><input type="radio" name="f" value="square" onChange="change(this)"></td> | ||
<td><input type="radio" name="f" value="sinh" onChange="change( | <td><input type="radio" name="f" value="sinh" onChange="change(this)"></td> | ||
<td><input type="radio" name="f" value="exp" onChange="change( | <td><input type="radio" name="f" value="exp" onChange="change(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 onChange="change( | <td><input type="radio" name="g" value="asin" checked onChange="change(this)"></td> | ||
<td><input type="radio" name="g" value="acos" onChange="change( | <td><input type="radio" name="g" value="acos" onChange="change(this)"></td> | ||
<td><input type="radio" name="g" value="atan" onChange="change( | <td><input type="radio" name="g" value="atan" onChange="change(this)"></td> | ||
<td><input type="radio" name="g" value="sqrt" onChange="change( | <td><input type="radio" name="g" value="sqrt" onChange="change(this)"></td> | ||
<td><input type="radio" name="g" value="asinh" onChange="change( | <td><input type="radio" name="g" value="asinh" onChange="change(this)"></td> | ||
<td><input type="radio" name="g" value="log" onChange="change( | <td><input type="radio" name="g" value="log" onChange="change(this)"></td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
Line 45: | Line 45: | ||
var f, g; | var f, g; | ||
var change = function( | var change = function(obj) { | ||
var t = obj.value; | var t = obj.value; | ||
if (t=='sin') { | if (t=='sin') { f = function(x) { return Math.sin(x); } | ||
} else if (t=='cos') { | } else if (t=='cos') { f = function(x) { return Math.cos(x); } | ||
} else if (t=='tan') { | } else if (t=='tan') { f = function(x) { return Math.tan(x); } | ||
} else if (t=='square') { | } else if (t=='square') { f = function(x) { return x*x; } | ||
} else if (t=='sinh') { | } else if (t=='sinh') { f = function(x) { return brd.sinh(x); } | ||
} else if (t=='exp') { | } else if (t=='exp') { f = function(x) { return Math.exp(x); } | ||
} else if (t=='asin') { | } else if (t=='asin') { g = function(x) { return Math.asin(x); } | ||
} else if (t=='acos') { | } else if (t=='acos') { g = function(x) { return Math.acos(x); } | ||
} else if (t=='atan') { | } else if (t=='atan') { g = function(x) { return Math.atan(x); } | ||
} else if (t=='sqrt') { | } else if (t=='sqrt') { g = function(x) { return Math.sqrt(x); } | ||
} else if (t=='asinh') { | } else if (t=='asinh') { g = function(x) { return Math.log(x+Math.sqrt(1+x*x)); } | ||
} else if (t=='log') { | } else if (t=='log') { g = function(x) { return Math.log(x); } | ||
} | } | ||
alert(f.toString()); | alert(f.toString()); |
Revision as of 13:38, 19 June 2009