Comments (12)
The errors thrown in Math show up in the JavaScript console as uncaught exceptions. Is this sufficient for your purposes or did you have something else in mind?
from mathcell.
Sometimes I get an "empty HTML frame" in the web interface http://matheclipse.org/ from a command like below, because the function name ("TestFunction" in this case) is undefined, or the Math.js lib throws an exception like 'Unsupported elliptic nome'.
For all these cases it would be nice to have at least a "status" output line with the error message.
Plot(TestFunction(x), {x, -2*Pi, 2*Pi},PlotRange->{-1,1})
from mathcell.
I've devised a way to automatically show errors in the MathCell, but it is browser dependent. For errors in the code of the cell, like undefined functions, it should work fine for all browsers because the error is local. For numerical errors coming from Math it displays a useful message in Firefox, but Chrome denies access to the full Error
object and only displays a generic 'Script error.'
for security reasons.
If you want to try it out, you'll need to use version 1.2.4 of Math and 1.7.5 of MathCell.
from mathcell.
Thanks, this is much better than showing an empty frame (in my "dynamic" use case) and let the user search in the browser console.
from mathcell.
In mathcell.js:311:23
I get this (translated) message only in the Firefox console:
"Unexpected value NaN parsing attribute y"
for this script:
<html>
<head>
<meta charset="utf-8">
<title>MathCell</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>
<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/mathcell.js"></script>
<script src="https://cdn.jsdelivr.net/gh/mathjax/[email protected]/MathJax.js?config=TeX-AMS_HTML"></script>
<p style="text-align: center; line-height: 2"><span style="font-size: 20pt">MathCell</span></p>
<div class="mathcell" style="height: 4in">
<script>
var parent = document.scripts[ document.scripts.length - 1 ].parentNode;
var id = generateId();
parent.id = id;
MathCell( id, [ { type: 'buttons', values: ['cot','tan','sin','cos'], labels: ['Cot','Tan','Sin','Cos'], name: 'f', label: 'f' }
] );
parent.update = function( id ) {
var f = getVariable(id, 'f');
function z1(x) { return (window[f]((x))); }
var p1 = plot( z1, [0, (6.283185307179586)], { } );
var data = [ p1 ];
var config = { type: 'svg' };
evaluate( id, data, config );
}
parent.update( id );
</script>
</div>
</body>
</html>
from mathcell.
I've added a check to plotting outputs to catch bad input.
Try version 1.7.6 and see if it takes care of this issue.
from mathcell.
Now it displays an error "Error: Infinity or NaN
in input data" for example above.
But why isn't the cot(x)
function not displayed?
from mathcell.
Because cot(0)=Infinity
and subsequent rounding operations lead to an indeterminant NaN
that messes up the plotting. Need to avoid the exact origin.
from mathcell.
I've discovered the trick I'm using to get a reference to the bad cell only works on the first load of the page. That may be enough for you, but I'll keep thinking about how to improve on this version.
from mathcell.
Figured out how to track active cells easily. Now if the cell initially has no error but develops one after manipulation of interacts, the error message should be displayed. Version 1.7.7 has the fix.
from mathcell.
The cot(x)
function plot isn't displayed in the example above, if I replace with version 1.7.7.
Only the error message Error: Infinity or NaN in input data
is displayed
from mathcell.
The
cot(x)
function plot isn't displayed in the example above, if I replace with version 1.7.7.Only the error message
Error: Infinity or NaN in input data
is displayed
Because there is a singularity at the origin
from mathcell.
Related Issues (20)
- Easier access to MathCell HOT 1
- Are you positive it will always be the last script? HOT 6
- Colormaps in surface HOT 7
- Enabling a transparent MathCell background
- Loading iframes faster HOT 4
- consider x3d as xml and in inline HOT 12
- Support Mathematica colormaps HOT 4
- NPM support HOT 5
- Contour and density plot any examples? HOT 1
- Automatically catch errors in plotting HOT 5
- JSON.stringify() filter out "null" values HOT 17
- Add plot legends for 3D mode
- expIntegralE - wrong values in parametric plot HOT 6
- cosIntegral - wrong values in parametric plot HOT 2
- Mouse-over information in both 2D and 3D
- Let MathCell calculate the aspect ratio HOT 4
- ComplexPlot3D(Arg(z), {z, -2 - 2*I, 2 + 2*I} ) doesn't display a graph HOT 6
- Modifying contentWindow in Safari/iOS
- "Translation" animation with step=0 HOT 1
- Setting material properties HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathcell.