2015-03-05 03:03:18 UTC+1, felix34:

I need to define a  periodic function of a variable t (for time)
>
that can be integrated like a symbolic function.
>
> I have no idea how to do that with sagemath and even if it is possible.
>
> An example would be an periodic triangle function or periodic square 
> function.
>

A few basic tricks can help to define periodic functions.

Trick one: a(x) = arcsin(sin(x)) is a periodic triangle function,
(it is 2*pi-periodic, increasing on [-pi/2,pi/2], where it equals x).
Its derivative b(x) = diff(a(x),x) is a periodic square function
(it is 2*pi-periodic, equal to 1 on (-pi/2,pi/2), -1 on (pi/2,3*pi/2)).
The product ab(x) = a(x) * b(x) is a periodic sawtooth function
of period pi, which equals x on (-pi/2,pi/2).

Trick two: c(x) = x - floor(x) is a sawtooth function with period 1,
which equals x on [0,1).

Given a sawtooth function, cooking up periodic functions is easy.
Indeed, suppose some function f is defined over (-pi/2,pi/2),
then g(x) = f(ab(x)) is the corresponding pi-periodic function.

Or if f is defined over [0,1) and you want a 1-periodic function
based on f, then you can use g(x) = f(c(x)).

Of course, if you prefer some other period, say, some t > 0,
notice that cc(x) = t*c(x/t) is a t-periodic sawtooth function,
and if you have some function f defined over [0,t), then
the corresponding t-periodic function is just g(x) = f(cc(x)).

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to