问题
I'm currently drawing the log10 function on JSXgraph, however the shading glitches. This happens to log, rational, squareRoot functions.
Screenshot
Log10 function:
var graph = board.create('functiongraph', [function (x) { return (a * ((Math.log10(b * (x - h))) / Math.log10(c)) + k); }], { id: field, strokeColor: color, highlightStrokeColor: 'yellow', strokeWidth: 2 });
graph.on('down', function (e, i) {
showMaster(this.id);
});
graphMap.set(field, graph);
//inequality(sym, field, graph, color);
var ineq_lower = board.create('inequality', [graph], { visible: false, strokeColor: color, fixed: true, dash: 2 });
var ineq_upper = board.create('inequality', [graph], { inverse: true, strokeColor: color, fixed: true, dash: 2 });
回答1:
Indeed, some function make problems. For rational functions I do not see an easy fix. For log- and sqrt-functions, you can set the defining interval slightly smaller so that it it doe not contain the critical points of the function:
sqrt-function:
var graph = board.create('functiongraph', [
function (x) { return Math.sqrt(x - a.Value()); },
function() { return a.Value()+0.00001; },
10
]);
log-function:
var graph = board.create('functiongraph', [
function (x) { return a.Value()*Math.log10(x); },
0.0001,
10
]);
As soon as there is a little time left, I will tackle this.
来源:https://stackoverflow.com/questions/57529008/how-to-fix-inequality-glitch-for-jsxgraph