]]> A guided exercise. Please input a function in whose derivative you would like to compute.
Native OpenMath
HttpSession mySession = request.getSession(); // Define an XML string //String fString = (String) pageContext.getAttribute( "f"); String fString = (String) session.getAttribute( "fom"); out.println("**"+fString); // Define the reader. OMXMLReader reader = new OMXMLReader( fString ); // Decode XML to OMObject. OMObject obiect = reader.readObject(); // Send to DOM OMDOMWriter domWriter = new OMDOMWriter(); Document myDocument = domWriter.write( obiect ); //Set an attribute indicator = 0 and curent = 1 to the first Child of OMOBJ // NodeList listOMAs = myDocument.getElementsByTagName("OMA"); // Node fl = listOMAs.item(0); NodeList list = myDocument.getElementsByTagName("*"); int i1; // Note: list.item(0) is OMOBJ, so start with the next one Node fl = list.item(1); for (i1=1;i1<list.getLength();i1++){ Node floc = list.item(i1); if (!(floc.getNodeName().equals("OMS"))){ fl = list.item(i1); break; } } Element fElement; if (fl instanceof Element) { fElement = (Element) fl; } else { fElement = null; } fElement.setAttribute("indicator","0"); fElement.setAttribute("current","1"); // Define the Document containing the tree with the scope session String DocumentName = "myDocument"; mySession.setAttribute( DocumentName, myDocument); f is