How to fix inequality glitch for JSXgraph?

自闭症网瘾萝莉.ら 提交于 2019-12-11 17:04:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!