Ask Your Question
0

How to enter a periodic function in Sagemath?

asked 2026-02-06 14:53:55 +0100

I am trying to enter a periodic function with a non-integer period into sagemath. However when i use mod(x, T)) where T it says that mod can only used for integers.

edit retag flag offensive close merge delete

Comments

Please illustrate your question with an actual code giving an error.

Max Alekseyev gravatar imageMax Alekseyev ( 2026-02-10 07:41:04 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2026-02-11 06:54:50 +0100

updated 2026-02-12 19:50:45 +0100

I tried this sample code which is working fine:

sage: def periodic_function(x):
....:     result1 = sin(x/2)
....:     result2 = tan(x/2)
....:     result3 = cos(x/4)
....:     return result1, result2, result3
....:

sage: print(periodic_function(pi))
(1, Infinity, 1/2*sqrt(2))
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2026-02-06 14:53:55 +0100

Seen: 75 times

Last updated: Feb 12