Ask Your Question
0

Equation solver with assume

asked 2019-11-26 21:10:48 +0100

technossomy gravatar image

Odd behaviour: the following gives a solution:

x, c, k = var('x, c, k')
assume(k > 0)
assume(k, "integer")
solve(x**k == (k/c), x)

but the following does not:

x, c, k = var('x, c, k')
assume(k > 0)
assume(k, "real")
solve(x**k == (k/c), x)

I should be able to remove the assume(k, "datatype") completely, right?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-11-27 12:37:51 +0100

Emmanuel Charpentier gravatar image

updated 2019-11-27 12:38:24 +0100

since you assume(k>0), which is meaningless if k is not real, you implicitly assume that it is real:

sage: x, c, k = var('x, c, k')
....: assume(k > 0)
....: 
sage: k.is_real()
True

the following failure of Maxima's solver is unrelated to this assumption. This weakness of Maxima's solver has been known for a long time.

This equation can nevertheless be solved with a little help from the user:

sage: (x**k==k/c).log().log_expand().solve(x)
[x == e^(-log(c)/k + log(k)/k)]

And further tidied:

sage: (x**k==k/c).log().log_expand().solve(x)[0].canonicalize_radical()
x == k^(1/k)/c^(1/k)
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: 2019-11-26 21:10:48 +0100

Seen: 635 times

Last updated: Nov 27 '19