Ask Your Question
1

How do I calculate the first solution, without calculating all the others?

asked 3 years ago

Periodic_1_6 gravatar image

How do I calculate the first solution, without calculating all the others?

 var('x')

eq0 = x^100-3 == 0

solutions = solve([eq0],x)
sol0 = solutions 
print(sol0[0])
Preview: (hide)

Comments

How do you define the "first solution"? Are there any constraints that you would like to put on the result?

tolga gravatar imagetolga ( 3 years ago )

If this is your actual problem, in this case, you could directly ask for 3^(1/100) for instance. If you are interested in real solutions, you could try solve(x^100 == 3, x, algorithm='sympy', domain='real').

FabianG gravatar imageFabianG ( 3 years ago )

@tolga any, as long as you only calculate that.

Periodic_1_6 gravatar imagePeriodic_1_6 ( 3 years ago )

@FabianG my problem is: I have a non-linear system to solve and since my PC is old I would like to calculate a single solution, not all of them to reduce the time.

Periodic_1_6 gravatar imagePeriodic_1_6 ( 3 years ago )

if you want to see what we are talking about, look here https://www.linkedin.com/feed/update/urn:li:activity:6829793175205359616/ (https://www.linkedin.com/feed/update/...)

Periodic_1_6 gravatar imagePeriodic_1_6 ( 3 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 3 years ago

tmonteil gravatar image

If you are interested in the numerical value, you can do:

sage: f = x^100-3
sage: find_root(f,0,10)
1.0110466919377765

You can check:

sage: 3^(1/100).n()
1.01104669193785
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

1 follower

Stats

Asked: 3 years ago

Seen: 268 times

Last updated: Aug 08 '21