Products

SIN function

PRO BASIC

The SIN function in Jspreadsheet Formulas Pro is used to calculate the sine of a given angle, which is provided in radians. This is a trigonometric function that is commonly used in mathematical calculations. You simply input the angle in radians into the function, and it will output the sine of that angle. It's a handy tool for tasks that require geometric or scientific calculations.

Documentation

Returns the sine of an angle in radians.

Category

Math and trigonometry

Syntax

SIN(x)

Parameter Description
x The angle in radians for which to calculate the sine.

Behavior

The SIN function calculates the sine of an angle (provided in radians). Here is how it handles various inputs:

  • Numbers: The SIN function works with number inputs. It expects the input to be in radians.
  • Empty cells: If the SIN function is applied to an empty cell, it evaluates it as 0 and returns 0.
  • Text: When this function is applied to text, it returns a #VALUE! error.
  • Booleans: When the SIN function is applied to boolean values, TRUE is considered as 1 and FALSE is considered as 0. Therefore, SIN(TRUE) returns the sine of 1 radian, and SIN(FALSE) returns 0.
  • Errors: If the cell referenced by the SIN function contains an error, the function itself will also return that error.

Common Errors

Error Description
#VALUE! This error is returned if the input to the SIN function is non-numeric, such as text or an empty cell.

Best practices

  • Always ensure that the input to the SIN function is in radians. If you have an angle in degrees, you can convert it to radians using the RADIANS function.
  • Be mindful of the fact that the SIN function treats boolean values as numbers, with TRUE being 1 and FALSE being 0.
  • To avoid errors, ensure that the cell referenced by the SIN function contains a numeric value.
  • Remember that the SIN function returns the ratio of the length of the side that is opposite to the angle to the length of the longest side of the triangle (hypotenuse). So, the return value is always between -1 and 1 inclusive.

Usage

A few examples using the SIN function.

SIN(0) returns 0  
SIN(PI()/6) returns 0.5  
SIN(RADIANS(90)) returns 1

Interactive Spreadsheet Demo

<html>
<script src="https://jspreadsheet.com/v11/jspreadsheet.js"></script>
<script src="https://jsuites.net/v5/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v5/jsuites.css" type="text/css" />
<link rel="stylesheet" href="https://jspreadsheet.com/v11/jspreadsheet.css" type="text/css" />

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />
<script src="https://cdn.jsdelivr.net/npm/@jspreadsheet/formula-pro/dist/index.min.js"></script>

<div id="spreadsheet"></div>

<script>
// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('ZTA2YzQ3OWQzMzM2OTRiNTUwYzBkNDBiMzgxYjE5MGM4MzZlY2U0NzE3OThkZGJjZTZhYTZmMmM3MTc5ZDI2ZjU1YTZiZjgxNDM2NjljNzFiNjNiM2QzYmUxYWFjYWMxZDgyOTVkYTkyNjBiNDhjY2ZkNzhhOGFjYzZjMjJiYjgsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVM01ETXdOakV6TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');

// Set the extensions
jspreadsheet.setExtensions({ formula });

// Create a new spreadsheet
jspreadsheet(document.getElementById('spreadsheet'), {
  worksheets: [{
    data: [
    [
        "Angle (radians)",
        "Sine Value"
    ],
    [
        0,
        "=SIN(A2)"
    ],
    [
        "=PI()/6",
        "=SIN(A3)"
    ],
    [
        "=PI()/2",
        "=SIN(A4)"
    ],
    [
        "=PI()",
        "=SIN(A5)"
    ]
]
  }]
});
</script>
</html>
import React, { useRef } from "react";
import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/react";
import formula from "@jspreadsheet/formula-pro";
import "jsuites/dist/jsuites.css";
import "jspreadsheet/dist/jspreadsheet.css";

// Set license
jspreadsheet.setLicense('ZTA2YzQ3OWQzMzM2OTRiNTUwYzBkNDBiMzgxYjE5MGM4MzZlY2U0NzE3OThkZGJjZTZhYTZmMmM3MTc5ZDI2ZjU1YTZiZjgxNDM2NjljNzFiNjNiM2QzYmUxYWFjYWMxZDgyOTVkYTkyNjBiNDhjY2ZkNzhhOGFjYzZjMjJiYjgsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVM01ETXdOakV6TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');

// Set the extensions
jspreadsheet.setExtensions({ formula });

export default function App() {
    // Spreadsheet array of worksheets
    const spreadsheet = useRef();

    // Worksheet data
    const data = [
    [
        "Angle (radians)",
        "Sine Value"
    ],
    [
        0,
        "=SIN(A2)"
    ],
    [
        "=PI()/6",
        "=SIN(A3)"
    ],
    [
        "=PI()/2",
        "=SIN(A4)"
    ],
    [
        "=PI()",
        "=SIN(A5)"
    ]
];

    // Render component
    return (
        <Spreadsheet ref={spreadsheet}>
            <Worksheet data={data} />
        </Spreadsheet>
    );
}
<template>
    <Spreadsheet ref="spreadsheet">
        <Worksheet :data="data" />
    </Spreadsheet>
</template>

<script>
import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/vue";
import "jsuites/dist/jsuites.css";
import "jspreadsheet/dist/jspreadsheet.css";
import formula from "@jspreadsheet/formula-pro";

// Set license
jspreadsheet.setLicense('ZTA2YzQ3OWQzMzM2OTRiNTUwYzBkNDBiMzgxYjE5MGM4MzZlY2U0NzE3OThkZGJjZTZhYTZmMmM3MTc5ZDI2ZjU1YTZiZjgxNDM2NjljNzFiNjNiM2QzYmUxYWFjYWMxZDgyOTVkYTkyNjBiNDhjY2ZkNzhhOGFjYzZjMjJiYjgsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVM01ETXdOakV6TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');

// Set the extensions
jspreadsheet.setExtensions({ formula });

export default {
    components: {
        Spreadsheet,
        Worksheet,
    },
    data() {
        // Worksheet data
        const data = [
    [
        "Angle (radians)",
        "Sine Value"
    ],
    [
        0,
        "=SIN(A2)"
    ],
    [
        "=PI()/6",
        "=SIN(A3)"
    ],
    [
        "=PI()/2",
        "=SIN(A4)"
    ],
    [
        "=PI()",
        "=SIN(A5)"
    ]
]

        return {
            data
        };
    }
}
</script>
import { Component, ViewChild, ElementRef } from "@angular/core";
import jspreadsheet from "jspreadsheet";
import * as formula from "@jspreadsheet/formula-pro";

// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('ZTA2YzQ3OWQzMzM2OTRiNTUwYzBkNDBiMzgxYjE5MGM4MzZlY2U0NzE3OThkZGJjZTZhYTZmMmM3MTc5ZDI2ZjU1YTZiZjgxNDM2NjljNzFiNjNiM2QzYmUxYWFjYWMxZDgyOTVkYTkyNjBiNDhjY2ZkNzhhOGFjYzZjMjJiYjgsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpVM01ETXdOakV6TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0p6ZEdGamEySnNhWFI2TG1sdklpd2lkMlZpWTI5dWRHRnBibVZ5TG1sdklpd2lkMlZpSWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpOQ0lzSW5OamIzQmxJanBiSW5ZM0lpd2lkamdpTENKMk9TSXNJbll4TUNJc0luWXhNU0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklpd2lZMnhwWlc1MElpd2ljMlZ5ZG1WeUlpd2ljMmhoY0dWeklpd2labTl5YldGMElsMHNJbVJsYlc4aU9uUnlkV1Y5');

// Set the extensions
jspreadsheet.setExtensions({ formula });

@Component({
    standalone: true,
    selector: "app-root",
    template: `<div #spreadsheet></div>`
})
export class AppComponent {
    @ViewChild("spreadsheet") spreadsheet: ElementRef;
    // Worksheets
    worksheets: jspreadsheet.worksheetInstance[];

    // Create a new data grid
    ngAfterViewInit() {
        // Create spreadsheet
        this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, {
            worksheets: [{
                data: [
    [
        "Angle (radians)",
        "Sine Value"
    ],
    [
        0,
        "=SIN(A2)"
    ],
    [
        "=PI()/6",
        "=SIN(A3)"
    ],
    [
        "=PI()/2",
        "=SIN(A4)"
    ],
    [
        "=PI()",
        "=SIN(A5)"
    ]
]
            }]
        });
    }
}