# Sample question: How do I compute symbolic integrals like $\int{sin(x) tan(x)} dx$

(Sample question) How do I compute the integral of $sin(x) tan(x)$ in Sage?

(Sample question) How do I compute the integral of $sin(x) tan(x)$ in Sage?

add a comment

6

First, make sure that you variable "x" is defined to be a symbolic variable:

```
sage: var('x')
```

then you can use the integrate command:

```
sage: integrate(sin(x)*tan(x), x)
-1/2*log(sin(x) - 1) + 1/2*log(sin(x) + 1) - sin(x)
```

5

In addition, symbolic functions have an **integrate** method. For example, given the function $f(x) = \sin(x)\tan(x)$,

```
sage: var('x')
sage: f = sin(x)*tan(x)
```

its symbolic integral is calculated like so:

```
sage: f.integrate(x)
-1/2*log(sin(x) - 1) + 1/2*log(sin(x) + 1) - sin(x)
```

Be sure to provide the variable you wish to integrate with respect to as an argument to **integrate**.

3

You can integrate sin(x)*tan(x) in Sage by using the **integrate** command:

```
sage: integrate(sin(x)*tan(x), x)
-1/2*log(sin(x) - 1) + 1/2*log(sin(x) + 1) - sin(x)
```

You can find some more examples in the tutorial.

0

Sample answer: does TeX work, I wonder... $\int_0^{\infty} e^{-t^2} dt$

No jsmath yet. We need to add it like on mathoverflow.net.

0

$\sum 2$ great

:-) like that !!

can you get (integrate) this (live-preview) functionality into the sage notebook text editor (tiny-mce) somehow ?

i'd like to see the formula there while typing

if i double-click directly on a formula tinymce opens plus a box with latex source code. but only the first time. how about the box popping up each time i place the cursor into a latex formula and then showing the typeset math. at the moment i don't see the use of the box ...

thanks for sage ... am loving it!!!

regards

Patrick

I guess, I am asking in the wrong place - (maybe "mis-")using this forum as a scratch pad - but the suggestion I'm making is somehow connected with this ... (I reached here from a blog bost).

So to be a bit more precise:

I am actually talking about the sage notebook. I am wondering what this light grey window is really good for and suggesting an way to make use of it.

Ehr - no - although that's also a real nice functionality i didn't know of (fancy menu shades! (but menu initially hidden under firefox default menu (ubuntu 10.04 - 64bit : http://oi56.tinypic.com/1hef4p.jpg)))

Asked: **
2010-08-18 12:35:19 -0500
**

Seen: **960 times**

Last updated: **Nov 03 '10**

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.