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

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])

edit retag close merge delete

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

( 2021-08-08 00:23:30 +0200 )edit

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

( 2021-08-08 01:25:40 +0200 )edit

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

( 2021-08-08 09:53:24 +0200 )edit

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

( 2021-08-08 10:19:31 +0200 )edit

( 2021-08-08 11:24:40 +0200 )edit

Sort by ยป oldest newest most voted

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

more