# Difference between revisions of "Extensions/Ideas/Calc"

From Apache OpenOffice Wiki

< Extensions | Ideas

Line 1: | Line 1: | ||

− | Function to return roots of quadratic equation | + | = Calc Add-ins = |

− | Numerical integration - Simpson's rules | + | |

+ | == Function to return roots of quadratic equation == | ||

+ | |||

+ | Formerly [https://issues.apache.org/ooo/show_bug.cgi?id=122171 bug 122171] | ||

+ | |||

+ | Quadratic function ax^2+bx+c=0 | ||

+ | |||

+ | Proposed added function: | ||

+ | |||

+ | * quadratic(a,b,c,1) will return (-b+sqrt(b^2-4ac))/(2a) | ||

+ | * quadratic(a,b,c,2) will return (-b-sqrt(b^2-4ac))/(2a) | ||

+ | |||

+ | == Numerical integration - Simpson's rules == | ||

+ | |||

+ | Formerly [https://issues.apache.org/ooo/show_bug.cgi?id=122202 bug 122202] | ||

+ | |||

+ | Given: equally spaced x values, x0 till xn and respective function values in two columns | ||

+ | |||

+ | * Three points n=2: Simpson's 1/3 ruleFunction | ||

+ | Simp13 = (x2-x0)*(f(x0)+4f(x1)+f(x2))/6 | ||

+ | |||

+ | * Four points n=3: Simpson's 3/8 ruleFunction | ||

+ | Simp38 = (x3-x0)*(f(x0)+3f(x1)+3f(x2)+f(x3))/8 | ||

+ | |||

+ | * Five points n=4: Simpson's 1/3 rule on first and last three points | ||

+ | |||

+ | * Six points n=5: Simpson's 1/3 rule on first three points and Simpson's 3/8 rule on last last four points | ||

+ | |||

+ | * etc. |

## Revision as of 21:40, 11 May 2013

# Calc Add-ins

## Function to return roots of quadratic equation

Formerly bug 122171

Quadratic function ax^2+bx+c=0

Proposed added function:

- quadratic(a,b,c,1) will return (-b+sqrt(b^2-4ac))/(2a)
- quadratic(a,b,c,2) will return (-b-sqrt(b^2-4ac))/(2a)

## Numerical integration - Simpson's rules

Formerly bug 122202

Given: equally spaced x values, x0 till xn and respective function values in two columns

- Three points n=2: Simpson's 1/3 ruleFunction

Simp13 = (x2-x0)*(f(x0)+4f(x1)+f(x2))/6

- Four points n=3: Simpson's 3/8 ruleFunction

Simp38 = (x3-x0)*(f(x0)+3f(x1)+3f(x2)+f(x3))/8

- Five points n=4: Simpson's 1/3 rule on first and last three points

- Six points n=5: Simpson's 1/3 rule on first three points and Simpson's 3/8 rule on last last four points

- etc.