# Difference between revisions of "Symbolic package"

Jump to navigation
Jump to search

(formatted example) |
|||

Line 3: | Line 3: | ||

[[Category:Octave-Forge]] | [[Category:Octave-Forge]] | ||

− | + | === Demos and usage examples === | |

− | |||

− | + | * '''Demo of Anonymous function to symbolic function and back to anonymous function and then the use of the interval pkg.''' | |

+ | <source lang="octave"> | ||

+ | % this is just a formula to start with, | ||

% have fun and change it if you want to. | % have fun and change it if you want to. | ||

Line 35: | Line 36: | ||

[-5.743488743719015, -5.743488743719013] | [-5.743488743719015, -5.743488743719013] | ||

[-3.0962279604822407, -3.09622796048224] | [-3.0962279604822407, -3.09622796048224] | ||

− | + | [-0.777688831121563, -0.7776888311215626] | |

− | + | [0.22911205809043574, 0.2291120580904359] | |

+ | </source> |

## Revision as of 07:38, 29 June 2015

The symbolic package is part of the octave-forge project.

### Demos and usage examples

**Demo of Anonymous function to symbolic function and back to anonymous function and then the use of the interval pkg.**

```
% this is just a formula to start with,
% have fun and change it if you want to.
f=@(x) x.^2 +3*x-1 + 5*x.*sin(x);
% the next 2 line take the Anonymous function into a symbolic formula
syms x;
ff=formula(f(x));
% now calculate the derivative of the function
ffd=diff(ff);
% and convert it back to an Anonymous function
df=function_handle(ffd)
% this uses the interval pkg. to find all the roots between -15 an 10
fzero (f, infsup (-15, 10), df)
ans ⊂ 4×1 interval vector
[-5.743488743719015, -5.743488743719013]
[-3.0962279604822407, -3.09622796048224]
[-0.777688831121563, -0.7776888311215626]
[0.22911205809043574, 0.2291120580904359]
```