Ask Your Question
0

Roots of a function

asked 2020-06-08 21:51:11 +0200

curios_mind gravatar image

updated 2020-06-08 21:51:24 +0200

Hello,

Given the following function

f(x)=1/(x+1)^(1/3)

I would like to assign the 3 roots of this function to three different functions; say f1(x),f2(x),f3(x). How can I do that with sage?

edit retag flag offensive close merge delete

Comments

What do you mean by root ? Do you mean branch of the cube root ?

tmonteil gravatar imagetmonteil ( 2020-06-08 22:18:07 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-06-08 23:47:57 +0200

Emmanuel Charpentier gravatar image

Assuming that, as suggested by tmonteil, you mean a function per cube root branch, the following one-liner :

sage: (f1,f2,f3)=tuple(((1/u)*1/(x+1)^3).function(x) for u in (x^3==1).roots(multiplicities=False))

does what you mean :

sage: [f1, f2, f3]
[x |--> 1/((x + 1)^3*(1/2*I*sqrt(3) - 1/2)),
 x |--> 1/((x + 1)^3*(-1/2*I*sqrt(3) - 1/2)),
 x |--> (x + 1)^(-3)]

But remember that the expression 1/(1+x)^(1/3) will evaluate to some cube root of x+1, with no specification of which one :

sage: ((x+1)^(1/3)).subs(x=7)
2
sage: ((x+1)^(1/3)).subs(x=-9)
2*(-1)^(1/3)
sage: ((x+1)^(1/3)).subs(x=-9).n()
1.00000000000000 + 1.73205080756888*I

Caveat emptor... HTH,

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: 2020-06-08 21:51:11 +0200

Seen: 269 times

Last updated: Jun 08 '20