JSXGraph logo
JSXGraph
JSXGraph share

Share

Trigonometric functions on the unit circle
QR code
<iframe 
    src="https://www.jsxgraph.uni-bayreuth.de/share/iframe/trigonometric-functions" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Trigonometric functions on the unit circle" 
    allowfullscreen
></iframe>
This code has to
<div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div>
</div>

<script type = "text/javascript"> 
    /*
    This example is licensed under a 
    Creative Commons Attribution ShareAlike 4.0 International License.
    https://creativecommons.org/licenses/by-sa/4.0/
    
    Please note you have to mention 
    The Center of Mobile Learning with Digital Technology
    in the credits.
    */
    
    const BOARDID = 'board-0';

    var board = JXG.JSXGraph.initBoard(BOARDID, {
        boundingbox: [-2, 2, 2, -2],
        keepaspectratio: true,
        axis: true,
        defaultAxes: {
            // Set the exes invisible, but use them for intersections
            x: { visible: false },
            y: { visible: false }
        }
    });
    
    // Shortcuts
    var ax = board.defaultAxes.x;
    var ay = board.defaultAxes.y;
    
    var p0 = board.create('point', [0, 0], { fixed: true, visible: false });
    var c = board.create('circle', [p0, 1], { dash: 2, strokeWidth: 1, strokeOpacity: 0.6 });
    
    var p2 = board.create('glider', [0.4, 1.0, c], { name: '', withLabel: false });
    var p3 = board.create('point', [() => p2.X(), 0.0], { visible: false, name: '', withLabel: false });
    var p4 = board.create('point', [0.0, () => p2.Y()], { visible: false, name: '', withLabel: false });
    var angle = board.create('angle', [[10, 0], p0, p2], {name: 'φ' });
    
    // hypotenuse
    var hypot = board.create('segment', [p0, p2], {
        strokeColor: 'black',
        withLabel: true,
        name: '1',
        label: {
            position: '50% right',
            distance: 0.5
        }
    });
    
    // sine
    board.create('segment', [p2, p3], {
        strokeColor: 'red',
        withLabel: true,
        name: 'sinφ',
        label: {
            position: '50% right',
            distance: 0.5,
            anchorY: 'top'
        }
    });
    
    // cosine
    board.create('segment', [p2, p4], {
        strokeColor: 'red',
        withLabel: true,
        name: 'cosφ',
        label: {
            position: '50% left',
            distance: 2,
            anchorX: 'right',
            anchorY: 'middle'
        }
    });
    
    var t = board.create('tangent', [p2], { visible: false });
    var p5 = board.create('intersection', [t, ax, 0], { visible: false, name: '', withLabel: false });
    var p6 = board.create('intersection', [t, ay, 0], { visible: false, name: '', withLabel: false });
    
    // tangent
    board.create('segment', [p2, p5], {
        withLabel: true,
        name: 'tanφ',
        label: {
            position: '50% right',
            distance: 0.5
        }
    }); 
    
    // cotangent
    board.create('segment', [p2, p6], {
        withLabel: true,
        name: 'cotφ',
        label: {
            position: '50% right',
            distance: 0.1,
            anchorX: 'middle',
        }
    });
    
    // cosecant
    board.create('segment', [p0, p6], {
        strokeColor: 'green',
        withLabel: true,
        name: 'cscφ',
        label: {
            position: '50% left',
            distance: 1.4,
            anchorX: 'right',
        }
    });
    
    // secant
    board.create('segment', [p0, p5], {
        strokeColor: 'green',
        withLabel: true,
        name: 'secφ',
        label: {
            position: '50% right',
            distance: 1,
            anchorY: 'top',
        }
    }); 
    
    
    
 </script> 
/*
This example is licensed under a 
Creative Commons Attribution ShareAlike 4.0 International License.
https://creativecommons.org/licenses/by-sa/4.0/

Please note you have to mention 
The Center of Mobile Learning with Digital Technology
in the credits.
*/

const BOARDID = 'your_div_id'; // Insert your id here!

var board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-2, 2, 2, -2],
    keepaspectratio: true,
    axis: true,
    defaultAxes: {
        // Set the exes invisible, but use them for intersections
        x: { visible: false },
        y: { visible: false }
    }
});

// Shortcuts
var ax = board.defaultAxes.x;
var ay = board.defaultAxes.y;

var p0 = board.create('point', [0, 0], { fixed: true, visible: false });
var c = board.create('circle', [p0, 1], { dash: 2, strokeWidth: 1, strokeOpacity: 0.6 });

var p2 = board.create('glider', [0.4, 1.0, c], { name: '', withLabel: false });
var p3 = board.create('point', [() => p2.X(), 0.0], { visible: false, name: '', withLabel: false });
var p4 = board.create('point', [0.0, () => p2.Y()], { visible: false, name: '', withLabel: false });
var angle = board.create('angle', [[10, 0], p0, p2], {name: 'φ' });

// hypotenuse
var hypot = board.create('segment', [p0, p2], {
    strokeColor: 'black',
    withLabel: true,
    name: '1',
    label: {
        position: '50% right',
        distance: 0.5
    }
});

// sine
board.create('segment', [p2, p3], {
    strokeColor: 'red',
    withLabel: true,
    name: 'sinφ',
    label: {
        position: '50% right',
        distance: 0.5,
        anchorY: 'top'
    }
});

// cosine
board.create('segment', [p2, p4], {
    strokeColor: 'red',
    withLabel: true,
    name: 'cosφ',
    label: {
        position: '50% left',
        distance: 2,
        anchorX: 'right',
        anchorY: 'middle'
    }
});

var t = board.create('tangent', [p2], { visible: false });
var p5 = board.create('intersection', [t, ax, 0], { visible: false, name: '', withLabel: false });
var p6 = board.create('intersection', [t, ay, 0], { visible: false, name: '', withLabel: false });

// tangent
board.create('segment', [p2, p5], {
    withLabel: true,
    name: 'tanφ',
    label: {
        position: '50% right',
        distance: 0.5
    }
}); 

// cotangent
board.create('segment', [p2, p6], {
    withLabel: true,
    name: 'cotφ',
    label: {
        position: '50% right',
        distance: 0.1,
        anchorX: 'middle',
    }
});

// cosecant
board.create('segment', [p0, p6], {
    strokeColor: 'green',
    withLabel: true,
    name: 'cscφ',
    label: {
        position: '50% left',
        distance: 1.4,
        anchorX: 'right',
    }
});

// secant
board.create('segment', [p0, p5], {
    strokeColor: 'green',
    withLabel: true,
    name: 'secφ',
    label: {
        position: '50% right',
        distance: 1,
        anchorY: 'top',
    }
}); 


<jsxgraph width="100%" aspect-ratio="1 / 1" title="Trigonometric functions on the unit circle" description="This construction was copied from JSXGraph examples database: BTW HERE SHOULD BE A GENERATED LINKuseGlobalJS="false">
   /*
   This example is licensed under a 
   Creative Commons Attribution ShareAlike 4.0 International License.
   https://creativecommons.org/licenses/by-sa/4.0/
   
   Please note you have to mention 
   The Center of Mobile Learning with Digital Technology
   in the credits.
   */
   
   var board = JXG.JSXGraph.initBoard(BOARDID, {
       boundingbox: [-2, 2, 2, -2],
       keepaspectratio: true,
       axis: true,
       defaultAxes: {
           // Set the exes invisible, but use them for intersections
           x: { visible: false },
           y: { visible: false }
       }
   });
   
   // Shortcuts
   var ax = board.defaultAxes.x;
   var ay = board.defaultAxes.y;
   
   var p0 = board.create('point', [0, 0], { fixed: true, visible: false });
   var c = board.create('circle', [p0, 1], { dash: 2, strokeWidth: 1, strokeOpacity: 0.6 });
   
   var p2 = board.create('glider', [0.4, 1.0, c], { name: '', withLabel: false });
   var p3 = board.create('point', [() => p2.X(), 0.0], { visible: false, name: '', withLabel: false });
   var p4 = board.create('point', [0.0, () => p2.Y()], { visible: false, name: '', withLabel: false });
   var angle = board.create('angle', [[10, 0], p0, p2], {name: 'φ' });
   
   // hypotenuse
   var hypot = board.create('segment', [p0, p2], {
       strokeColor: 'black',
       withLabel: true,
       name: '1',
       label: {
           position: '50% right',
           distance: 0.5
       }
   });
   
   // sine
   board.create('segment', [p2, p3], {
       strokeColor: 'red',
       withLabel: true,
       name: 'sinφ',
       label: {
           position: '50% right',
           distance: 0.5,
           anchorY: 'top'
       }
   });
   
   // cosine
   board.create('segment', [p2, p4], {
       strokeColor: 'red',
       withLabel: true,
       name: 'cosφ',
       label: {
           position: '50% left',
           distance: 2,
           anchorX: 'right',
           anchorY: 'middle'
       }
   });
   
   var t = board.create('tangent', [p2], { visible: false });
   var p5 = board.create('intersection', [t, ax, 0], { visible: false, name: '', withLabel: false });
   var p6 = board.create('intersection', [t, ay, 0], { visible: false, name: '', withLabel: false });
   
   // tangent
   board.create('segment', [p2, p5], {
       withLabel: true,
       name: 'tanφ',
       label: {
           position: '50% right',
           distance: 0.5
       }
   }); 
   
   // cotangent
   board.create('segment', [p2, p6], {
       withLabel: true,
       name: 'cotφ',
       label: {
           position: '50% right',
           distance: 0.1,
           anchorX: 'middle',
       }
   });
   
   // cosecant
   board.create('segment', [p0, p6], {
       strokeColor: 'green',
       withLabel: true,
       name: 'cscφ',
       label: {
           position: '50% left',
           distance: 1.4,
           anchorX: 'right',
       }
   });
   
   // secant
   board.create('segment', [p0, p5], {
       strokeColor: 'green',
       withLabel: true,
       name: 'secφ',
       label: {
           position: '50% right',
           distance: 1,
           anchorY: 'top',
       }
   }); 
   
   
   
</jsxgraph>

Trigonometric functions on the unit circle

Visualize the trigonometric functions since, cosine, tangent, cotangent, secant , and cosecant. A movable point on the unit circle defines the angle $\varphi$. Then, the values $\sin\varphi$ (sine), $\cos\varphi$ (cosine), $\tan\varphi$ (tangent), $\cot\varphi$ (cotangent), $\sec\varphi$ (secant), and $\csc\varphi$ (cosecant) - depending on the angle $\varphi$ - are visualized as the length of the marked segments.
// Define the id of your board in BOARDID

var board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-2, 2, 2, -2],
    keepaspectratio: true,
    axis: true,
    defaultAxes: {
        // Set the exes invisible, but use them for intersections
        x: { visible: false },
        y: { visible: false }
    }
});

// Shortcuts
var ax = board.defaultAxes.x;
var ay = board.defaultAxes.y;

var p0 = board.create('point', [0, 0], { fixed: true, visible: false });
var c = board.create('circle', [p0, 1], { dash: 2, strokeWidth: 1, strokeOpacity: 0.6 });

var p2 = board.create('glider', [0.4, 1.0, c], { name: '', withLabel: false });
var p3 = board.create('point', [() => p2.X(), 0.0], { visible: false, name: '', withLabel: false });
var p4 = board.create('point', [0.0, () => p2.Y()], { visible: false, name: '', withLabel: false });
var angle = board.create('angle', [[10, 0], p0, p2], {name: 'φ' });

// hypotenuse
var hypot = board.create('segment', [p0, p2], {
    strokeColor: 'black',
    withLabel: true,
    name: '1',
    label: {
        position: '50% right',
        distance: 0.5
    }
});

// sine
board.create('segment', [p2, p3], {
    strokeColor: 'red',
    withLabel: true,
    name: 'sinφ',
    label: {
        position: '50% right',
        distance: 0.5,
        anchorY: 'top'
    }
});

// cosine
board.create('segment', [p2, p4], {
    strokeColor: 'red',
    withLabel: true,
    name: 'cosφ',
    label: {
        position: '50% left',
        distance: 2,
        anchorX: 'right',
        anchorY: 'middle'
    }
});

var t = board.create('tangent', [p2], { visible: false });
var p5 = board.create('intersection', [t, ax, 0], { visible: false, name: '', withLabel: false });
var p6 = board.create('intersection', [t, ay, 0], { visible: false, name: '', withLabel: false });

// tangent
board.create('segment', [p2, p5], {
    withLabel: true,
    name: 'tanφ',
    label: {
        position: '50% right',
        distance: 0.5
    }
}); 

// cotangent
board.create('segment', [p2, p6], {
    withLabel: true,
    name: 'cotφ',
    label: {
        position: '50% right',
        distance: 0.1,
        anchorX: 'middle',
    }
});

// cosecant
board.create('segment', [p0, p6], {
    strokeColor: 'green',
    withLabel: true,
    name: 'cscφ',
    label: {
        position: '50% left',
        distance: 1.4,
        anchorX: 'right',
    }
});

// secant
board.create('segment', [p0, p5], {
    strokeColor: 'green',
    withLabel: true,
    name: 'secφ',
    label: {
        position: '50% right',
        distance: 1,
        anchorY: 'top',
    }
}); 


license

This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License.
Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.