Python Forum
dividing by list not possible?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dividing by list not possible?
#2
(Oct-01-2018, 09:58 PM)SchroedingersLion Wrote: Isn't this a bit contradictory from a programming point of view?
No, it depends on the implementation for a particular type/object. i.e. the creators of numpy implemented this functionality for numpy array object (that is what np.linspace returns). The python core developers did not implement that functionality for the list. You can use list comprehension instead. Or convert expectation_val_V to numpy array.
Also note that when you multiply a list by int constant, the new list is not constructed by multiplying individual elements of the original list.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: dividing by list not possible? - by buran - Oct-02-2018, 07:03 AM
RE: dividing by list not possible? - by ichabod801 - Oct-02-2018, 12:32 PM
RE: dividing by list not possible? - by volcano63 - Oct-02-2018, 04:43 PM
RE: dividing by list not possible? - by volcano63 - Oct-11-2018, 10:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Dividing a single column of dataframe into multiple columns based on char length darpInd 2 2,495 Mar-14-2020, 09:19 AM
Last Post: scidam
  When dividing elements of matrix i would like the result 0 instead of inf? Koczkodan 4 2,995 Jul-22-2019, 11:40 AM
Last Post: Koczkodan
  linspace not dividing equal intervals sheel 0 2,422 Jan-16-2018, 04:28 PM
Last Post: sheel

Forum Jump:

User Panel Messages

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