Ask Your Question
1

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

asked 2021-08-07 19:31:42 +0200

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])
edit retag flag offensive close merge delete

Comments

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

tolga gravatar imagetolga ( 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').

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

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

Periodic_1_6 gravatar imagePeriodic_1_6 ( 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.

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

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 ( 2021-08-08 11:24:40 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-08-08 22:23:36 +0200

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
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: 2021-08-07 19:31:42 +0200

Seen: 116 times

Last updated: Aug 08 '21