Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
1

Rewrite log in exponents

asked 3 years ago

B r u n o gravatar image

updated 3 years ago

Does there exist a method in Sage's symbolic ring that would be able to (automatically) rewrite expressions such as 3logn into nlog3?

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]
Preview: (hide)

Comments

2

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 ( 3 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 3 years ago

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...

Preview: (hide)
link

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: 3 years ago

Seen: 267 times

Last updated: Jun 10 '21