a=2 b=2 c=-1 d = b**2 - 4*a*c x1=-b + d**1/2/2*a x2=-b - d**1/2/2*a printd, x1, x2
Try import math and use math.pow() func
It executes and answers 12 0.3660254037844386 -1.3660254037844386, what is your issue with it?
It was the first thing I did, gave another answer.
every time i write this code (different software) give me a different answer.
If you want to solve a 2nd degree polynomial with your code, probably you want to use numpy for consistency and readability. Something like this should work: import numpy as np coeff = [a,b,c] np.roots(coeff)
no, I'm just training rsrs i decide to use something I can control.
it's correct here, i need to fix the other code. I realize that here, I was worry I made a mistake in the syntax
Another shot of solving your issue is using explicit conversion on your code. Something akin to this might solve it d = float(b**2 - (4*a*c)) x1=float((-b + d**(1/2))/(2*a)) x2=float((-b - d**(1/2))/(2*a)) print(d, x1, x2)
What is rsrs?
means a laugh
thanks i'll try this.
Is consistent my mistake must be in something else in the other software. I'm training the new software.
Now I know Brazilian argot lol. Hope you fix your issue
I can use this jajajaja 😀
Ok! This is a math rule: if d =0 then x=-b/2a and x is only
I got to study the software better
Are you running on same operating system and hardware?
I would recommend trying the numpy alternative and see if results are consistent. If not, are you using same Python implementation and version on both software?
I believe it uses a diferent implementation and the imput is strange. Is more complicate than I anticipated. Thanks for all the help
I suspect the two software somehow use different memory space for your variables during execution time. Add this to your code to see what happens: import sys print(sys.getsizeof(d)) print(sys.getsizeof(x1)) print(sys.getsizeof(x2))
Try calculating everything with float numbers.
ok, i'm trying the software is a little complicated but it claims to use python. so...
thank you i'lll try it
csv files?? https://del.dog/arefeafuly i tried to declare the inputs as BINARY and STR, but even way i get the same error "TypeError: a bytes-like object is required, not 'str'"
power of 2?
m1 , m2 >= 1 and m1 , m2 <= 6: #do stuff
links...
function?
do let me know