Ask Your Question
1

Rewrite log in exponents

asked 2021-06-09 13:52:42 +0200

B r u n o gravatar image

updated 2021-06-09 13:58:05 +0200

Does there exist a method in Sage's symbolic ring that would be able to (automatically) rewrite expressions such as $3^{\log n}$ into $n^{\log 3}$?

Here I assume that $n$ is a positive integer.

Remark: I am quite surprised (and therefore pessimistic for my question) by the following:

sage: [bool(3^(log(i)) == i^(log(3))) for i in range(1, 12)]
[True, True, True, True, False, False, True, False, True, False, False]
edit retag flag offensive close merge delete

Comments

1

I do not know if this would be helpful for your question but .canonicalize_radical() solves the problem in your example:

var('k')
[bool((3^(log(k)) - k^(log(3))).canonicalize_radical()==0) for k in range(1, 12)]

I used the variable k instead of i which is sqrt(-1).

tolga gravatar imagetolga ( 2021-06-09 19:08:50 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-06-10 21:04:14 +0200

Emmanuel Charpentier gravatar image

What you want to do may or may no be legitimate. Read the introduction to this section of the Sympy documentation...

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

2 followers

Stats

Asked: 2021-06-09 13:52:42 +0200

Seen: 72 times

Last updated: Jun 10