Python Forum
Error : "can't multiply sequence by non-int of type 'float' "
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error : "can't multiply sequence by non-int of type 'float' "
#1
Hello ! Please can someone help me to resolve this error, this is the One-electron approximate form. I need to applicate this equation for all orbitals of the atoms Cadmium, Thelium and Zinc (CdTeZn). I have the orbitals number of each atom and the corresponding J, as well as the number of electrons in each orbital.

from math import exp

# Approximate one-electron profiles :
    
# Zinc Zn, atomic number = 30
# Electronic Configuration : 1s2  2s2  2p6  3s2  3p6  4s2  3d10

# Cademium Cd, atomic number = 48
# Electronic Configuration : 1s2  2s2  2p6  3s2  3p6  4s2  3d10  4p6  5s2  4d10

# Thelium Te, atomic number = 52
# Electronic Configuration : 1s2  2s2  2p6  3s2  3p6  4s2  3d10  4p6  5s2  4d10  5s2  5p4

# For Zn
n = 2
d1 = (n - 1 / n) ** 1/n
d2 = 2/n * [d1** (1-n)]
# Ji,0 = Ji (0) <=> la valeur du profil à Pz = 0
J1_30 = 2.90*10**-2  # J(i = 1s), Pz = 30   ;    
Pz = 30
# electrons number = 1

# General equation form
# Ji,A_Pz = Ji,0* ((n * d2/2) [(d1 + d2 * Ji,0 * abs(Pz)) ** (n-1)]) (exp [d1**n- ((d1 + d2 * Ji,0 * abs(Pz))**n)])

Ji,A_Pz = J1_30 * ((n * d2/2) [(d1 + d2 * J1_30 * abs(Pz)) ** (n-1)]) (exp [d1**n- ((d1 + d2 * J1_30 * abs(Pz))**n)])
Error:
TypeError: can't multiply sequence by non-int of type 'float'
Larz60+ write Apr-12-2021, 04:55 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Also, when posting error traceback, please post entire, unaltered traceback.
Reply


Messages In This Thread
Error : "can't multiply sequence by non-int of type 'float' " - by Ala - Apr-12-2021, 01:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python calculate float plus float is incorrect? sirocawa 6 2,131 Apr-16-2024, 01:45 PM
Last Post: DeaD_EyE
  Wrong type error rowan_bradley 6 2,758 Aug-07-2023, 10:44 AM
Last Post: rowan_bradley
  Type Error: Unsupported Operand jhancock 2 4,746 Jul-22-2023, 11:33 PM
Last Post: jhancock
  Write Null values as 0.0 (float) type in csv mg24 3 2,711 Dec-07-2022, 09:04 PM
Last Post: deanhystad
  Python Anytree - Is not of type 'NodeMixin' error georgebijum 3 3,225 May-05-2022, 01:43 PM
Last Post: Gribouillis
  TypeError: sequence item 0: expected str instance, float found Error Query eddywinch82 1 7,204 Sep-04-2021, 09:16 PM
Last Post: eddywinch82
  Getting error trying to use functions to multiply numbers rrowhe4d 5 3,097 Aug-30-2021, 07:11 AM
Last Post: Yoriz
  Why can't I explicitly call __bool__() on sequence type? quazirfan 11 7,079 Aug-20-2021, 06:49 AM
Last Post: Gribouillis
  Incorrect Type Error milkycow 4 3,940 Jun-25-2021, 06:04 AM
Last Post: milkycow
Star Type Error: 'in' object is not callable nman52 3 4,504 May-01-2021, 11:03 PM
Last Post: nman52

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020