Ask Your Question
0

algebraic substitution

asked 2014-02-06 04:38:29 -0600

czsan gravatar image

How can I imitate the algsubs function of Maple? A little example:

p = x^18

algsubs(x^2=x+1,p)

The reult in Maple is:

x^9+9x^8+36x^7+84x^6+126x^5+126x^4+84x^3+36x^2+9x+1.

edit retag flag offensive close merge delete

Comments

What is the mathematical meaning of this function ? If you want `x^2` to be equal to `x+1`, then the optimal result would be a polynomial of degree 1, namely `2584*x + 1597`.

tmonteil gravatar imagetmonteil ( 2014-02-06 07:57:54 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-02-07 10:54:12 -0600

It seems that there are not the same function in sagemath but we can use " ratsubst " function of maxima

sage : maxima('p:x^18')
sage : maxima('ratsubst(a+1,x^2,p)')

how to use certain maxima functions (e.g. ratsubst)?

edit flag offensive delete link more
-1

answered 2014-02-06 05:28:02 -0600

ndomes gravatar image

updated 2014-02-06 05:58:02 -0600

kcrisman gravatar image
var('y')
P = x^18
eqn = x^2 == y + 1
soln = solve(eqn,x)
P = P.subs(x=soln[0].rhs())
P.expand().subs(y=x)
edit flag offensive delete link more

Comments

It works only for even powers.

czsan gravatar imageczsan ( 2014-02-06 07:06:33 -0600 )edit

For example, if P = x^17 = x^16*x=(x^2)^4*x=(x+1)^4*x. But it is impossible with this method.

czsan gravatar imageczsan ( 2014-02-06 07:08:24 -0600 )edit

Out of curiosity, what do you want when you have `x^{17}`? Something with a square root? And if so, which square root?

kcrisman gravatar imagekcrisman ( 2014-02-06 07:30:50 -0600 )edit

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: 2014-02-06 04:38:29 -0600

Seen: 440 times

Last updated: Feb 07 '14