Java Code Examples for com.fasterxml.jackson.databind.node.ObjectNode#toPrettyString()
The following examples show how to use
com.fasterxml.jackson.databind.node.ObjectNode#toPrettyString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 5 votes |
@Test public void testListPlot004() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("1, 2, 3, None, 3, 5, f(), 2, 1, foo, 2, 3", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 2,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{1,2,3,None,3,5,f(),2,1,foo,2,3}\",\r\n" + " \"sinput\" : \"{1,2,3,None,3,5,f(),2,1,foo,2,3}\",\r\n" + " \"latex\" : \"\\\\{1,2,3,None,3,5,f(),2,1,foo,2,3\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Histogram\",\r\n" + " \"scanner\" : \"Plotter\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"Histogram({1,2,3,None,3,5,f(),2,1,foo,2,3})\",\r\n" + " \"plotly\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>Plotly</title>\\n\\n <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>\\n</head>\\n<body>\\n<div id='plotly' ></div>\\n <script>\\n var target_plotly = document.getElementById('plotly');\\n var layout = {\\n autosize: true,\\n\\n\\n};\\n\\r\\nvar trace0 =\\n{\\nx: ["1.0","2.0","3.0","3.0","5.0","2.0","1.0","2.0","3.0"],\\nopacity: '1.0',\\nnbinsx: 0,\\nautobinx: false,\\nnbinsy: 0,\\nautobiny: false,\\n histnorm: '',\\n histfunc: 'count',\\nxaxis: 'x',\\nyaxis: 'y',\\ntype: 'histogram',\\nname: '',\\n};\\r\\n\\r\\n var data = [ trace0];\\r\\nPlotly.newPlot(target_plotly, data, layout); </script>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 2
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 5 votes |
@Test public void testQuantity() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("convert 111 cm in m", formatsHTML); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 2,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"UnitConvert(Quantity(111,cm),m)\",\r\n" + " \"sinput\" : \"UnitConvert(Quantity(111,\\\"cm\\\"),\\\"m\\\")\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Decimal form\",\r\n" + " \"scanner\" : \"Numeric\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"1.11[m]\",\r\n" + " \"sinput\" : \"N(UnitConvert(Quantity(111,\\\"cm\\\"),\\\"m\\\"))\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 3
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 5 votes |
@Test public void testPlotF() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("Plot(f(x), {x, 0, 6*Pi} )", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 2,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"Plot(f(x),{x,0,6*Pi})\",\r\n" + " \"sinput\" : \"Plot(f(x),{x,0,6*Pi})\",\r\n" + " \"latex\" : \"\\\\text{Plot}(f(x),\\\\{x,0,6\\\\cdot \\\\pi\\\\})\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Evaluated result\",\r\n" + " \"scanner\" : \"Expression\",\r\n" + " \"error\" : \"true\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"Manipulate: Cannot convert to JavaScript. Function head: f\",\r\n" + " \"sinput\" : \"Plot(f(x),{x,0,6*Pi})\",\r\n" + " \"latex\" : \"\\\\text{Plot}(f(x),\\\\{x,0,6\\\\cdot \\\\pi\\\\})\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 4
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 5 votes |
@Test public void testComplexPlot3D() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult( "ComplexPlot3D((z^2 + 1)/(z^2 - 1), {z, -2 - 2*I, 2 + 2*I}, PlotRange->{0,3})", formatsMATHML); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 2,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"ComplexPlot3D((1+z^2)/(-1+z^2),{z,-2+(-2)*I,2+I*2},PlotRange->{0,3})\",\r\n" + " \"mathml\" : \"<math xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><mrow><mi>ComplexPlot3D</mi><mo>⁡</mo><mrow><mo>(</mo><mrow><mfrac><mrow><msup><mi>z</mi><mn>2</mn></msup><mo>+</mo><mn>1</mn></mrow><mrow><msup><mi>z</mi><mn>2</mn></msup><mo>-</mo><mn>1</mn></mrow></mfrac><mo>,</mo><mrow><mo>{</mo><mrow><mi>z</mi><mo>,</mo><mrow><mrow><mrow><mo>(</mo><mn>-2</mn><mo>)</mo></mrow><mo>·</mo><mrow><mi>ⅈ</mi></mrow></mrow><mo>-</mo><mn>2</mn></mrow><mo>,</mo><mrow><mrow><mrow><mi>ⅈ</mi></mrow><mo>·</mo><mn>2</mn></mrow><mo>+</mo><mn>2</mn></mrow></mrow><mo>}</mo></mrow><mo>,</mo><mrow><mi>PlotRange</mi><mo>-></mo><mrow><mo>{</mo><mrow><mn>0</mn><mo>,</mo><mn>3</mn></mrow><mo>}</mo></mrow></mrow></mrow><mo>)</mo></mrow></mrow></math>\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Function\",\r\n" + " \"scanner\" : \"Plotter\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"ComplexPlot3D((1+z^2)/(-1+z^2),{z,-2+(-2)*I,2+I*2},PlotRange->{0,3})\",\r\n" + " \"mathcell\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>MathCell</title>\\n</head>\\n\\n<body style="width: 100%; height: 100%; margin: 0; padding: 0">\\n\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/mathcell.js"></script>\\n<script src="https://cdn.jsdelivr.net/gh/mathjax/[email protected]/MathJax.js?config=TeX-AMS_HTML"></script>\\n<div class="mathcell" style="display: flex; width: 100%; height: 100%; margin: 0; padding: .25in .5in .5in .5in; flex-direction: column; overflow: hidden">\\n<script>\\n\\nvar parent = document.scripts[ document.scripts.length - 1 ].parentNode;\\n\\nvar id = generateId();\\nparent.id = id;\\n\\nMathCell( id, [ ] );\\n\\nparent.update = function( id ) {\\n\\n\\nfunction z1(z) { return mul(add(1,pow(z,2)),inv(add(-1,pow(z,2)))); }\\n\\nvar p1 = parametric( (re,im) => [ re, im, z1(complex(re,im)) ], [-2.0, 2.0], [-2.0, 2.0], { complexFunction: 'abs', colormap: 'complexArgument' } );\\n\\n var config = { type: 'threejs', zMin: 0, zMax: 3 };\\n var data = [p1];\\nevaluate( id, data, config );\\n\\n}\\n\\nparent.update( id );\\n\\n</script>\\n</div>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 5
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testNormalDistribution() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("NormalDistribution(a,b)", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 4,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"NormalDistribution(a,b)\",\r\n" + " \"sinput\" : \"NormalDistribution(a,b)\",\r\n" + " \"latex\" : \"\\\\text{NormalDistribution}(a,b)\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Statistical properties\",\r\n" + " \"scanner\" : \"Statistics\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"html\" : \"<table style=\\\"border:solid 1px;\\\"><tbody><tr><td>mean</td><td>a</td><tr><tr><td>standard deviation</td><td>b</td><tr><tr><td>variance</td><td>b^2</td><tr><tr><td>skewness</td><td>0</td><tr></tbody></table>\",\r\n" + " \"sinput\" : \"{}\",\r\n" + " \"latex\" : \"\\\\{\\\\text{Mean}(\\\\text{NormalDistribution}(a,b)),\\\\text{StandardDeviation}(\\\\text{NormalDistribution}(a,b)),\\\\text{Variance}(\\\\text{NormalDistribution}(a,b)),\\\\text{Skewness}(\\\\text{NormalDistribution}(a,b))\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Probability density function (PDF)\",\r\n" + " \"scanner\" : \"Statistics\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"1/(b*E^((-a+x)^2/(2*b^2))*Sqrt(2*Pi))\",\r\n" + " \"sinput\" : \"PDF(NormalDistribution(a,b),x)\",\r\n" + " \"latex\" : \"\\\\frac{1}{b\\\\,{e}^{\\\\frac{{\\\\left( - a+x\\\\right) }^{2}}{2\\\\cdot {b}^{2}}}\\\\,\\\\sqrt{\\\\left( 2\\\\cdot \\\\pi\\\\right) }}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Cumulative distribution function (CDF)\",\r\n" + " \"scanner\" : \"Statistics\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"Erfc((a-x)/(Sqrt(2)*b))/2\",\r\n" + " \"sinput\" : \"CDF(NormalDistribution(a,b),x)\",\r\n" + " \"latex\" : \"\\\\frac{\\\\text{Erfc}(\\\\frac{a - x}{\\\\sqrt{2}\\\\,b})}{2}\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 6
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testCoshIntegral001() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult(// "CoshIntegral", // formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 2,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"CoshIntegral\",\r\n" + " \"sinput\" : \"CoshIntegral\",\r\n" + " \"latex\" : \"CoshIntegral\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Plot\",\r\n" + " \"scanner\" : \"Plotter\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"Manipulate(Plot({Re(CoshIntegral(a*x)),Im(CoshIntegral(a*x))},{x,-2.0,2.0},PlotRange->{-5.0,5.0}),{a,1,10})\",\r\n" + " \"jsxgraph\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>JSXGraph</title>\\n\\n<body style="width: 100%; height: 100%; margin: 0; padding: 0">\\n\\n<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.css" />\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.js"\\n type="text/javascript"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/geonext.min.js"\\n type="text/javascript"></script>\\n\\n<div id="jxgbox" class="jxgbox" style="display: flex; width:99%; height:99%; margin: 0; flex-direction: column; overflow: hidden">\\n<script>\\nvar board = JXG.JSXGraph.initBoard('jxgbox', {axis:true,boundingbox:[-2.75,6.05,2.75,-6.05]});\\nboard.suspendUpdate();\\nvar a = board.create('slider',[[-2.2,4.84],[2.2,4.84],[1,1,10]],{name:'a'});\\n\\nfunction z1(x) { return re(coshIntegral(mul(a.Value(),x))); }\\nfunction z2(x) { return im(coshIntegral(mul(a.Value(),x))); }\\nvar p1 = board.create('functiongraph',[z1, -2.0, 2.0]);\\nvar p2 = board.create('functiongraph',[z2, -2.0, 2.0]);\\nvar data = [ p1, p2 ];\\n\\n\\nboard.unsuspendUpdate();\\n\\n</script>\\n</div>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Documentation\",\r\n" + " \"scanner\" : \"help\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"markdown\" : \"## CoshIntegral\\n\\n```\\nCoshIntegral(expr)\\n```\\n\\n> returns the hyperbolic cosine integral of `expr`.\\n \\nSee\\n* [Wikipedia - Trigonometric integral](https://en.wikipedia.org/wiki/Trigonometric_integral)\\n\\n### Examples\\n\\n```\\n>> CoshIntegral(0)\\n-Infinity\\n```\\n \\n\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 7
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testSolve002() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("x^2+1=0", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) {// assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 4,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"1+x^2==0\",\r\n" + " \"sinput\" : \"1+x^2==0\",\r\n" + " \"latex\" : \"1+{x}^{2} == 0\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Function\",\r\n" + " \"scanner\" : \"Plotter\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"Plot({x^2,-1},{x,-20.0,20.0})\",\r\n" + " \"jsxgraph\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>JSXGraph</title>\\n\\n<body style="width: 100%; height: 100%; margin: 0; padding: 0">\\n\\n<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.css" />\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.js"\\n type="text/javascript"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/geonext.min.js"\\n type="text/javascript"></script>\\n\\n<div id="jxgbox" class="jxgbox" style="display: flex; width:99%; height:99%; margin: 0; flex-direction: column; overflow: hidden">\\n<script>\\nvar board = JXG.JSXGraph.initBoard('jxgbox', {axis:true,boundingbox:[-22.55,5.275,22.55,-0.775]});\\nboard.suspendUpdate();\\n\\nfunction z1(x) { return pow(x,2); }\\nfunction z2(x) { return -1; }\\nvar p1 = board.create('functiongraph',[z1, -20.0, 20.0]);\\nvar p2 = board.create('functiongraph',[z2, -20.0, 20.0]);\\nvar data = [ p1, p2 ];\\n\\n\\nboard.unsuspendUpdate();\\n\\n</script>\\n</div>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Alternate form\",\r\n" + " \"scanner\" : \"Simplification\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"1+x^2==0\",\r\n" + " \"sinput\" : \"1+x^2==0\",\r\n" + " \"latex\" : \"1+{x}^{2} == 0\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Solution\",\r\n" + " \"scanner\" : \"Reduce\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{{x->-I},{x->I}}\",\r\n" + " \"sinput\" : \"Solve(x^2==-1,{x})\",\r\n" + " \"latex\" : \"\\\\{\\\\{x\\\\to - i \\\\},\\\\{x\\\\to i \\\\}\\\\}\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 8
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testSolve001() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("3+x=10", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 4,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"3+x==10\",\r\n" + " \"sinput\" : \"3+x==10\",\r\n" + " \"latex\" : \"3+x == 10\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Function\",\r\n" + " \"scanner\" : \"Plotter\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"Plot({x,7},{x,-20.0,20.0})\",\r\n" + " \"jsxgraph\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>JSXGraph</title>\\n\\n<body style="width: 100%; height: 100%; margin: 0; padding: 0">\\n\\n<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.css" />\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.js"\\n type="text/javascript"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/geonext.min.js"\\n type="text/javascript"></script>\\n\\n<div id="jxgbox" class="jxgbox" style="display: flex; width:99%; height:99%; margin: 0; flex-direction: column; overflow: hidden">\\n<script>\\nvar board = JXG.JSXGraph.initBoard('jxgbox', {axis:true,boundingbox:[-22.55,5.5,22.55,-5.5]});\\nboard.suspendUpdate();\\n\\nfunction z1(x) { return x; }\\nfunction z2(x) { return 7; }\\nvar p1 = board.create('functiongraph',[z1, -20.0, 20.0]);\\nvar p2 = board.create('functiongraph',[z2, -20.0, 20.0]);\\nvar data = [ p1, p2 ];\\n\\n\\nboard.unsuspendUpdate();\\n\\n</script>\\n</div>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Alternate form\",\r\n" + " \"scanner\" : \"Simplification\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"-7+x==0\",\r\n" + " \"sinput\" : \"-7+x==0\",\r\n" + " \"latex\" : \"-7+x == 0\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Solution\",\r\n" + " \"scanner\" : \"Reduce\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{{x->7}}\",\r\n" + " \"sinput\" : \"Solve(x==7,{x})\",\r\n" + " \"latex\" : \"\\\\{\\\\{x\\\\to 7\\\\}\\\\}\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 9
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testMatrix002() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("1,3\n3,4", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 5,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{{1,3},{3,4}}\",\r\n" + " \"sinput\" : \"{{1,3},{3,4}}\",\r\n" + " \"latex\" : \"\\\\{\\\\{1,3\\\\},\\\\{3,4\\\\}\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Properties\",\r\n" + " \"scanner\" : \"Matrix\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"The matrix is symmetric.\",\r\n" + " \"sinput\" : \"SymmetricMatrixQ({{1,3}, {3,4}})\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Properties\",\r\n" + " \"scanner\" : \"Matrix\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"The determinant of the matrix is -5\",\r\n" + " \"sinput\" : \"Det({{1,3}, {3,4}})\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Inverse of matrix\",\r\n" + " \"scanner\" : \"Matrix\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{{-4/5,3/5},\\n {3/5,-1/5}}\",\r\n" + " \"sinput\" : \"Inverse({{1,3}, {3,4}})\",\r\n" + " \"latex\" : \"\\\\left(\\n\\\\begin{array}{cc}\\n\\\\frac{-4}{5} & \\\\frac{3}{5} \\\\\\\\\\n\\\\frac{3}{5} & \\\\frac{-1}{5} \\\\\\n\\\\\\\\\\n\\\\end{array}\\n\\\\right) \"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Plot points\",\r\n" + " \"scanner\" : \"Plotter\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"ListPlot({{1.0,3.0},\\n {3.0,4.0}})\",\r\n" + " \"jsxgraph\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>JSXGraph</title>\\n\\n<body style="width: 100%; height: 100%; margin: 0; padding: 0">\\n\\n<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.css" />\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.js"\\n type="text/javascript"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/geonext.min.js"\\n type="text/javascript"></script>\\n\\n<div id="jxgbox" class="jxgbox" style="display: flex; width:99%; height:99%; margin: 0; flex-direction: column; overflow: hidden">\\n<script>\\nvar board = JXG.JSXGraph.initBoard('jxgbox', {axis:true,boundingbox:[0.35,4.6,3.65,2.4]});\\nboard.suspendUpdate();\\n\\nboard.create('point', [function() {return 1.0;},function() {return 3.0;}], {name:'', face:'o', size: 2 } );\\nboard.create('point', [function() {return 3.0;},function() {return 4.0;}], {name:'', face:'o', size: 2 } );\\n\\n\\nboard.unsuspendUpdate();\\n\\n</script>\\n</div>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 10
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testMatrix001() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("1, 17 + 4*I\n17 - 4*I, 10", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 3,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{{1,17+I*4},{17+(-4)*I,10}}\",\r\n" + " \"sinput\" : \"{{1,17+I*4},{17+(-4)*I,10}}\",\r\n" + " \"latex\" : \"\\\\{\\\\{1,17 + i \\\\cdot 4\\\\},\\\\{17 - 4\\\\cdot i ,10\\\\}\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Properties\",\r\n" + " \"scanner\" : \"Matrix\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"The matrix is hermitian (self-adjoint).\",\r\n" + " \"sinput\" : \"HermitianMatrixQ({{1,17+I*4}, {17-I*4,10}})\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Result\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{{1,17+I*4},\\n {17-I*4,10}}\",\r\n" + " \"sinput\" : \"{{1,17+I*4},{17+(-4)*I,10}}\",\r\n" + " \"latex\" : \"\\\\left(\\n\\\\begin{array}{cc}\\n1 & 17 + 4\\\\,i \\\\\\\\\\n17 - 4\\\\,i & 10 \\\\\\n\\\\\\\\\\n\\\\end{array}\\n\\\\right) \"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 11
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testListPlot003() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("plot ([x,x**2,x**3,x**4])", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 5,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"Plot({x,x^2,x^3,x^4})\",\r\n" + " \"sinput\" : \"Plot({x,x^2,x^3,x^4})\",\r\n" + " \"latex\" : \"\\\\text{Plot}(\\\\{x,{x}^{2},{x}^{3},{x}^{4}\\\\})\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Result\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{x,x^2,x^3,x^4}\",\r\n" + " \"sinput\" : \"Plot({x,x^2,x^3,x^4})\",\r\n" + " \"latex\" : \"\\\\{x,{x}^{2},{x}^{3},{x}^{4}\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Function\",\r\n" + " \"scanner\" : \"Plotter\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"Plot({x,x^2,x^3,x^4},{x,-7.0,7.0})\",\r\n" + " \"jsxgraph\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>JSXGraph</title>\\n\\n<body style="width: 100%; height: 100%; margin: 0; padding: 0">\\n\\n<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.css" />\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.js"\\n type="text/javascript"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/geonext.min.js"\\n type="text/javascript"></script>\\n\\n<div id="jxgbox" class="jxgbox" style="display: flex; width:99%; height:99%; margin: 0; flex-direction: column; overflow: hidden">\\n<script>\\nvar board = JXG.JSXGraph.initBoard('jxgbox', {axis:true,boundingbox:[-8.25,5.275,8.25,-0.775]});\\nboard.suspendUpdate();\\n\\nfunction z1(x) { return x; }\\nfunction z2(x) { return pow(x,2); }\\nfunction z3(x) { return pow(x,3); }\\nfunction z4(x) { return pow(x,4); }\\nvar p1 = board.create('functiongraph',[z1, -7.0, 7.0]);\\nvar p2 = board.create('functiongraph',[z2, -7.0, 7.0]);\\nvar p3 = board.create('functiongraph',[z3, -7.0, 7.0]);\\nvar p4 = board.create('functiongraph',[z4, -7.0, 7.0]);\\nvar data = [ p1, p2, p3, p4 ];\\n\\n\\nboard.unsuspendUpdate();\\n\\n</script>\\n</div>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Derivative\",\r\n" + " \"scanner\" : \"Derivative\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{1,2*x,3*x^2,4*x^3}\",\r\n" + " \"sinput\" : \"D({x,x^2,x^3,x^4},x)\",\r\n" + " \"latex\" : \"\\\\{1,2\\\\cdot x,3\\\\cdot {x}^{2},4\\\\cdot {x}^{3}\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Indefinite integral\",\r\n" + " \"scanner\" : \"Integral\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{x^2/2,x^3/3,x^4/4,x^5/5}\",\r\n" + " \"sinput\" : \"Integrate({x,x^2,x^3,x^4},x)\",\r\n" + " \"latex\" : \"\\\\{\\\\frac{{x}^{2}}{2},\\\\frac{{x}^{3}}{3},\\\\frac{{x}^{4}}{4},\\\\frac{{x}^{5}}{5}\\\\}\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 12
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testHornerForm() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("HornerForm(x^2+x^3+2*x^14)", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 7,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"HornerForm(x^2+x^3+2*x^14)\",\r\n" + " \"sinput\" : \"HornerForm(x^2+x^3+2*x^14)\",\r\n" + " \"latex\" : \"\\\\text{HornerForm}({x}^{2}+{x}^{3} + 2\\\\cdot {x}^{14})\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Result\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"x^2*(1+x*(1+2*x^11))\",\r\n" + " \"sinput\" : \"HornerForm(x^2+x^3+2*x^14)\",\r\n" + " \"latex\" : \"{x}^{2}\\\\,\\\\left( 1 + x\\\\,\\\\left( 1 + 2\\\\cdot {x}^{11}\\\\right) \\\\right) \"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Function\",\r\n" + " \"scanner\" : \"Plotter\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"Plot(x^2*(1+x*(1+2*x^11)),{x,-7.0,7.0})\",\r\n" + " \"jsxgraph\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>JSXGraph</title>\\n\\n<body style="width: 100%; height: 100%; margin: 0; padding: 0">\\n\\n<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.css" />\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.js"\\n type="text/javascript"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/geonext.min.js"\\n type="text/javascript"></script>\\n\\n<div id="jxgbox" class="jxgbox" style="display: flex; width:99%; height:99%; margin: 0; flex-direction: column; overflow: hidden">\\n<script>\\nvar board = JXG.JSXGraph.initBoard('jxgbox', {axis:true,boundingbox:[-8.25,5.275,8.25,-0.775]});\\nboard.suspendUpdate();\\n\\nfunction z1(x) { return mul(pow(x,2),add(1,mul(x,add(1,mul(2,pow(x,11)))))); }\\nvar p1 = board.create('functiongraph',[z1, -7.0, 7.0]);\\nvar data = [ p1 ];\\n\\n\\nboard.unsuspendUpdate();\\n\\n</script>\\n</div>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Factor\",\r\n" + " \"scanner\" : \"Polynomial\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"x^2*(1+x+2*x^12)\",\r\n" + " \"sinput\" : \"Factor(x^2*(1+x*(1+2*x^11)))\",\r\n" + " \"latex\" : \"{x}^{2}\\\\,\\\\left( 1+x + 2\\\\cdot {x}^{12}\\\\right) \"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"GlobalExtrema\",\r\n" + " \"scanner\" : \"GlobalMinimum\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"min{x^2*(1+x*(1+2*x^11))} = 0 at x = 0\",\r\n" + " \"sinput\" : \"Minimize(x^2*(1+x*(1+2*x^11)),x)\",\r\n" + " \"latex\" : \"\\\\{0,\\\\{x\\\\to 0\\\\}\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Derivative\",\r\n" + " \"scanner\" : \"Derivative\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"x^2*(1+24*x^11)+2*x*(1+x*(1+2*x^11))\",\r\n" + " \"sinput\" : \"D(x^2*(1+x*(1+2*x^11)),x)\",\r\n" + " \"latex\" : \"{x}^{2}\\\\,\\\\left( 1 + 24\\\\cdot {x}^{11}\\\\right) + 2\\\\cdot x\\\\cdot \\\\left( 1 + x\\\\,\\\\left( 1 + 2\\\\cdot {x}^{11}\\\\right) \\\\right) \"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Indefinite integral\",\r\n" + " \"scanner\" : \"Integral\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"x^3/3+x^4/4+2/15*x^15\",\r\n" + " \"sinput\" : \"Integrate(x^2*(1+x*(1+2*x^11)),x)\",\r\n" + " \"latex\" : \"\\\\frac{{x}^{3}}{3}+\\\\frac{{x}^{4}}{4}+\\\\frac{2\\\\cdot {x}^{15}}{15}\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 13
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testSinXY() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("Sin(x*y)", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 3,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"Sin(x*y)\",\r\n" + " \"sinput\" : \"Sin(x*y)\",\r\n" + " \"latex\" : \"\\\\sin (x\\\\,y)\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"3D plot\",\r\n" + " \"scanner\" : \"Plot\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"Plot3D(Sin(x*y),{x,-3.5,3.5},{y,-3.5,3.5})\",\r\n" + " \"mathcell\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>MathCell</title>\\n</head>\\n\\n<body style="width: 100%; height: 100%; margin: 0; padding: 0">\\n\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/mathcell.js"></script>\\n<script src="https://cdn.jsdelivr.net/gh/mathjax/[email protected]/MathJax.js?config=TeX-AMS_HTML"></script>\\n<div class="mathcell" style="display: flex; width: 100%; height: 100%; margin: 0; padding: .25in .5in .5in .5in; flex-direction: column; overflow: hidden">\\n<script>\\n\\nvar parent = document.scripts[ document.scripts.length - 1 ].parentNode;\\n\\nvar id = generateId();\\nparent.id = id;\\n\\nMathCell( id, [ ] );\\n\\nparent.update = function( id ) {\\n\\n\\nfunction z1(x,y) { return [ x, y, sin(mul(x,y)) ]; }\\n\\nvar p1 = parametric( z1, [-3.5, 3.5], [-3.5, 3.5], { colormap: 'hot' } );\\n\\n var config = { type: 'threejs' };\\n var data = [p1];\\nevaluate( id, data, config );\\n\\n}\\n\\nparent.update( id );\\n\\n</script>\\n</div>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Alternate form\",\r\n" + " \"scanner\" : \"Simplification\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"(I*1/2)/E^(I*x*y)-I*1/2*E^(I*x*y)\",\r\n" + " \"sinput\" : \"TrigToExp(Sin(x*y))\",\r\n" + " \"latex\" : \"\\\\frac{\\\\frac{1}{2}\\\\,i }{{e}^{i \\\\cdot x\\\\cdot y}} + \\\\left( \\\\frac{-1}{2}\\\\,i \\\\right) \\\\cdot {e}^{i \\\\cdot x\\\\cdot y}\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 14
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testPolynomialQuotientRemainder() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult(" x**2-4,x-2", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 5,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{-4+x^2,-2+x}\",\r\n" + " \"sinput\" : \"{-4+x^2,-2+x}\",\r\n" + " \"latex\" : \"\\\\{-4+{x}^{2},-2+x\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Polynomial quotient and remainder\",\r\n" + " \"scanner\" : \"Polynomial\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{2+x,0}\",\r\n" + " \"sinput\" : \"PolynomialQuotientRemainder(-4+x^2,-2+x,x)\",\r\n" + " \"latex\" : \"\\\\{2+x,0\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Function\",\r\n" + " \"scanner\" : \"Plotter\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"Plot({-4+x^2,-2+x},{x,-7.0,7.0})\",\r\n" + " \"jsxgraph\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>JSXGraph</title>\\n\\n<body style="width: 100%; height: 100%; margin: 0; padding: 0">\\n\\n<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.css" />\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.js"\\n type="text/javascript"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/geonext.min.js"\\n type="text/javascript"></script>\\n\\n<div id="jxgbox" class="jxgbox" style="display: flex; width:99%; height:99%; margin: 0; flex-direction: column; overflow: hidden">\\n<script>\\nvar board = JXG.JSXGraph.initBoard('jxgbox', {axis:true,boundingbox:[-8.25,5.475,8.25,-4.975]});\\nboard.suspendUpdate();\\n\\nfunction z1(x) { return add(-4,pow(x,2)); }\\nfunction z2(x) { return add(-2,x); }\\nvar p1 = board.create('functiongraph',[z1, -7.0, 7.0]);\\nvar p2 = board.create('functiongraph',[z2, -7.0, 7.0]);\\nvar data = [ p1, p2 ];\\n\\n\\nboard.unsuspendUpdate();\\n\\n</script>\\n</div>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Derivative\",\r\n" + " \"scanner\" : \"Derivative\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{2*x,1}\",\r\n" + " \"sinput\" : \"D({-4+x^2,-2+x},x)\",\r\n" + " \"latex\" : \"\\\\{2\\\\cdot x,1\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Indefinite integral\",\r\n" + " \"scanner\" : \"Integral\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"{-4*x+x^3/3,-2*x+x^2/2}\",\r\n" + " \"sinput\" : \"Integrate({-4+x^2,-2+x},x)\",\r\n" + " \"latex\" : \"\\\\{\\\\left( -4\\\\right) \\\\cdot x+\\\\frac{{x}^{3}}{3},\\\\left( -2\\\\right) \\\\cdot x+\\\\frac{{x}^{2}}{2}\\\\}\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 15
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testGraph001() { String s = System.getProperty("os.name"); // ObjectNode messageJSON = Pods.createResult("TreeForm(a+(b*q*s)^(2*y)+Sin(c)^(3-z))", formatsTEX); ObjectNode messageJSON = Pods.createResult(// "Graph({DirectedEdge(1, 2), DirectedEdge(2, 3), DirectedEdge(3, 1), DirectedEdge(3, 4), DirectedEdge(4, 5), DirectedEdge(5, 3)})", // formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 2,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"Graph({1->2,2->3,3->1,3->4,4->5,5->3})\",\r\n" + " \"sinput\" : \"Graph({1->2,2->3,3->1,3->4,4->5,5->3})\",\r\n" + " \"latex\" : \"\\\\text{Graph}(\\\\{1\\\\to 2,2\\\\to 3,3\\\\to 1,3\\\\to 4,4\\\\to 5,5\\\\to 3\\\\})\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Graph data\",\r\n" + " \"scanner\" : \"Graph\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"visjs\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>VIS-NetWork</title>\\n\\n <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vis-network.min.js"></script>\\n</head>\\n<body>\\n\\n<div id="vis" style="width: 600px; height: 400px; margin: 0; padding: .25in .5in .5in .5in; flex-direction: column; overflow: hidden">\\n<script type="text/javascript">\\n<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>VIS-NetWork</title>\\n\\n <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vis-network.min.js"></script>\\n</head>\\n<body>\\n\\n<div id="vis" style="width: 600px; height: 400px; margin: 0; padding: .25in .5in .5in .5in; flex-direction: column; overflow: hidden">\\n<script type="text/javascript">\\nvar nodes = new vis.DataSet([\\n {id: 1, label: '1'}\\n, {id: 2, label: '2'}\\n, {id: 3, label: '3'}\\n, {id: 4, label: '4'}\\n, {id: 5, label: '5'}\\n]);\\nvar edges = new vis.DataSet([\\n {from: 1, to: 2 , arrows: { to: { enabled: true, type: 'arrow'}}}\\n, {from: 2, to: 3 , arrows: { to: { enabled: true, type: 'arrow'}}}\\n, {from: 3, to: 1 , arrows: { to: { enabled: true, type: 'arrow'}}}\\n, {from: 3, to: 4 , arrows: { to: { enabled: true, type: 'arrow'}}}\\n, {from: 4, to: 5 , arrows: { to: { enabled: true, type: 'arrow'}}}\\n, {from: 5, to: 3 , arrows: { to: { enabled: true, type: 'arrow'}}}\\n]);\\n\\n var container = document.getElementById('vis');\\n var data = {\\n nodes: nodes,\\n edges: edges\\n };\\n var options = { };\\n\\n var network = new vis.Network(container, data, options);\\n</script>\\n</div>\\n</body>\\n</html>\\n var container = document.getElementById('vis');\\n var data = {\\n nodes: nodes,\\n edges: edges\\n };\\n var options = {\\n\\t\\t edges: {\\n smooth: {\\n type: 'cubicBezier',\\n forceDirection: 'vertical',\\n roundness: 0.4\\n }\\n },\\n layout: {\\n hierarchical: {\\n direction: "UD"\\n }\\n },\\n nodes: {\\n shape: 'box'\\n },\\n physics:false\\n }; \\n var network = new vis.Network(container, data, options);\\n</script>\\n</div>\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 16
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testPolynomial001() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("-x^2 + 4*x + 4", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 6,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"4+4*x-x^2\",\r\n" + " \"sinput\" : \"4+4*x-x^2\",\r\n" + " \"latex\" : \"4 + 4\\\\cdot x - {x}^{2}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Function\",\r\n" + " \"scanner\" : \"Plotter\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"sinput\" : \"Plot(4+4*x-x^2,{x,-7.0,7.0})\",\r\n" + " \"jsxgraph\" : \"<iframe srcdoc=\\\"<?xml version="1.0" encoding="UTF-8"?>\\n\\n<!DOCTYPE html PUBLIC\\n "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"\\n "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">\\n\\n<html xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; margin: 0; padding: 0">\\n<head>\\n<meta charset="utf-8">\\n<title>JSXGraph</title>\\n\\n<body style="width: 100%; height: 100%; margin: 0; padding: 0">\\n\\n<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.css" />\\n<script src="https://cdn.jsdelivr.net/gh/paulmasson/[email protected]/build/math.js"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/jsxgraphcore.js"\\n type="text/javascript"></script>\\n<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.7/geonext.min.js"\\n type="text/javascript"></script>\\n\\n<div id="jxgbox" class="jxgbox" style="display: flex; width:99%; height:99%; margin: 0; flex-direction: column; overflow: hidden">\\n<script>\\nvar board = JXG.JSXGraph.initBoard('jxgbox', {axis:true,boundingbox:[-8.25,9.175,8.25,-5.675]});\\nboard.suspendUpdate();\\n\\nfunction z1(x) { return add(add(4,mul(4,x)),mul(-1,pow(x,2))); }\\nvar p1 = board.create('functiongraph',[z1, -7.0, 7.0]);\\nvar data = [ p1 ];\\n\\n\\nboard.unsuspendUpdate();\\n\\n</script>\\n</div>\\n\\n</body>\\n</html>\\\" style=\\\"display: block; width: 100%; height: 100%; border: none;\\\" ></iframe>\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Factor\",\r\n" + " \"scanner\" : \"Polynomial\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"4+4*x-x^2\",\r\n" + " \"sinput\" : \"Factor(4+4*x-x^2)\",\r\n" + " \"latex\" : \"4 + 4\\\\cdot x - {x}^{2}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"GlobalExtrema\",\r\n" + " \"scanner\" : \"GlobalMaximum\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"max{4+4*x-x^2} = 8 at x = 2\",\r\n" + " \"sinput\" : \"Maximize(4+4*x-x^2,x)\",\r\n" + " \"latex\" : \"\\\\{8,\\\\{x\\\\to 2\\\\}\\\\}\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Derivative\",\r\n" + " \"scanner\" : \"Derivative\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"4-2*x\",\r\n" + " \"sinput\" : \"D(4+4*x-x^2,x)\",\r\n" + " \"latex\" : \"4 - 2\\\\cdot x\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Indefinite integral\",\r\n" + " \"scanner\" : \"Integral\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"4*x+2*x^2-x^3/3\",\r\n" + " \"sinput\" : \"Integrate(4+4*x-x^2,x)\",\r\n" + " \"latex\" : \"4\\\\cdot x + 2\\\\cdot {x}^{2}+\\\\frac{ - {x}^{3}}{3}\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 17
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testETimesPi001() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult(// "E*Pi", // formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 2,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"E*Pi\",\r\n" + " \"sinput\" : \"E*Pi\",\r\n" + " \"latex\" : \"e\\\\,\\\\pi\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Decimal form\",\r\n" + " \"scanner\" : \"Numeric\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"8.539734222673566\",\r\n" + " \"sinput\" : \"N(E*Pi)\",\r\n" + " \"latex\" : \"8.53973\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 18
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testRationalHalf() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("1/2", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + // " \"queryresult\" : {\r\n" + // " \"success\" : \"true\",\r\n" + // " \"error\" : \"false\",\r\n" + // " \"numpods\" : 3,\r\n" + // " \"version\" : \"0.1\",\r\n" + // " \"pods\" : [ {\r\n" + // " \"title\" : \"Input\",\r\n" + // " \"scanner\" : \"Identity\",\r\n" + // " \"error\" : \"false\",\r\n" + // " \"numsubpods\" : 1,\r\n" + // " \"subpods\" : [ {\r\n" + // " \"plaintext\" : \"1/2\",\r\n" + // " \"sinput\" : \"1/2\",\r\n" + // " \"latex\" : \"\\\\frac{1}{2}\"\r\n" + // " } ]\r\n" + // " }, {\r\n" + // " \"title\" : \"Exact result\",\r\n" + // " \"scanner\" : \"Rational\",\r\n" + // " \"error\" : \"false\",\r\n" + // " \"numsubpods\" : 1,\r\n" + // " \"subpods\" : [ {\r\n" + // " \"plaintext\" : \"1/2\",\r\n" + // " \"sinput\" : \"1/2\",\r\n" + // " \"latex\" : \"\\\\frac{1}{2}\"\r\n" + // " } ]\r\n" + // " }, {\r\n" + // " \"title\" : \"Decimal form\",\r\n" + // " \"scanner\" : \"Numeric\",\r\n" + // " \"error\" : \"false\",\r\n" + // " \"numsubpods\" : 1,\r\n" + // " \"subpods\" : [ {\r\n" + // " \"plaintext\" : \"0.5\",\r\n" + // " \"sinput\" : \"N(1/2)\",\r\n" + // " \"latex\" : \"0.5\"\r\n" + // " } ]\r\n" + // " } ]\r\n" + // " }\r\n" + // "}");// } }
Example 19
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testTeXParser() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("\\sin 30 ^ { \\circ }", formatsHTML); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 3,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"Sin(30*Degree)\",\r\n" + " \"sinput\" : \"Sin(30*Degree)\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Exact result\",\r\n" + " \"scanner\" : \"Rational\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"1/2\",\r\n" + " \"sinput\" : \"Sin(30*Degree)\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Decimal form\",\r\n" + " \"scanner\" : \"Numeric\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"0.5\",\r\n" + " \"sinput\" : \"N(Sin(30*Degree))\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }
Example 20
Source File: TestPods.java From symja_android_library with GNU General Public License v3.0 | 4 votes |
@Test public void testIntegrate001() { String s = System.getProperty("os.name"); ObjectNode messageJSON = Pods.createResult("Integral Sin(x)", formatsTEX); final String jsonStr = messageJSON.toPrettyString(); System.out.println(jsonStr); if (s.contains("Windows")) { assertEquals(jsonStr, // "{\r\n" + " \"queryresult\" : {\r\n" + " \"success\" : \"true\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numpods\" : 3,\r\n" + " \"version\" : \"0.1\",\r\n" + " \"pods\" : [ {\r\n" + " \"title\" : \"Input\",\r\n" + " \"scanner\" : \"Identity\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"Integrate(Sin(x))\",\r\n" + " \"sinput\" : \"Integrate(Sin(x))\",\r\n" + " \"latex\" : \"\\\\text{Integrate}(\\\\sin (x))\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Integration\",\r\n" + " \"scanner\" : \"Integral\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"-Cos(x)\",\r\n" + " \"sinput\" : \"Integrate(Sin(x),x)\",\r\n" + " \"latex\" : \" - \\\\cos (x)\"\r\n" + " } ]\r\n" + " }, {\r\n" + " \"title\" : \"Alternate form\",\r\n" + " \"scanner\" : \"Simplification\",\r\n" + " \"error\" : \"false\",\r\n" + " \"numsubpods\" : 1,\r\n" + " \"subpods\" : [ {\r\n" + " \"plaintext\" : \"-1/(2*E^(I*x))-E^(I*x)/2\",\r\n" + " \"sinput\" : \"TrigToExp(-Cos(x))\",\r\n" + " \"latex\" : \"\\\\frac{-1}{2\\\\cdot {e}^{i \\\\cdot x}}+\\\\frac{ - {e}^{i \\\\cdot x}}{2}\"\r\n" + " } ]\r\n" + " } ]\r\n" + " }\r\n" + "}");// } }