0

I need to do some math operation in my code. I'm doing something like this:

kapaerror_list[i] = sqrt(4*((LDerror_list[i])**2)*((LDmean_list[i])**2) - (error_list[i])**2)

    print "%s\t%g\t%g\t%g\t%g" % (indexvalue_list[i],mean_list[i],kapa_list[i],LDmean_list[i],kapaerror_list[i])

but i'm getting the following error:


print "%s\t%g\t%g\t%g\t%g" % (indexvalue_list,mean_list,kapa_list,LDmean_list,kapaerror_list)
TypeError: float argument required


The funny thing to me is that when i erase sqrt and just writing:


kapaerror_list[i] = (4*((LDerror_list[i])**2)*((LDmean_list[i])**2) - (error_list[i])**2)

It doesn't give me any error.

I really appreciate your help.

2
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by YasaminKh
0

Put all formats to %s and see the values, one of %g parameters is not float needed for scientific format number.

Or do

print [type(i) for i in (indexvalue_list[i], mean_list[i], kapa_list[i], LDmean_list[i], kapaerror_list[i])]

To see which type the values are.

You can also use **0.5 instead of sqrt().

Edited by pyTony: n/a

0

Thanks a lot for the quick response. That solved the problem.
I really appreciate your help. :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.