Difference between revisions of "P-Norm"

From JSXGraph Wiki
Jump to: navigation, search
Line 1: Line 1:
 
<jsxgraph width="500" height="500">
 
<jsxgraph width="500" height="500">
 
var brd = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-5,5,5,-5]});
 
var brd = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-5,5,5,-5]});
var pNorm = brd.create('slider', [[0,-1],[3,-1],[0,2,10]], {style:6, name:'a'});
+
var pNorm = brd.create('slider', [[0,-1],[3,-1],[0,2,10]], {name:'p'});
 
graph = brd.create('curve', [
 
graph = brd.create('curve', [
 
   function(t){
 
   function(t){
 
       return 2.0;
 
       return 2.0;
      var p = pNorm.Value();
 
      return 2.0/Math.pow(Math.pow(Math.abs(Math.cos(t)),p)+
 
                Math.pow(Math.abs(Math.sin(t)),p),1.0/p);
 
 
   }
 
   }
 
   [0,0],  
 
   [0,0],  

Revision as of 22:35, 1 July 2010

The underlying JavaScript code