Questions tagged [addition]

Addition is a mathematical operation that represents combining collections of objects together into a larger collection. It is signified by the plus sign (+).

Addition is a mathematical operation that represents combining collections of objects together into a larger collection. It is signified by the plus sign (+).

It is commutative, meaning that order does not matter, and it is associative, meaning that when one adds more than two numbers, order in which addition is performed does not matter.

(Wikipedia)

5629 questions
1
vote
2 answers

Is it possible to distinguish operators += and + in class function __add__?

I have a class, which contains some data. Operator + for two objects of such class should merge data from both objects and returns a new object. However, it should be much better if in the case of += operator would append data from the added object…
rth
  • 2,946
  • 1
  • 22
  • 27
1
vote
0 answers

Should I Use append or the Assign by Addition on a string?

The Assign by Addition Operator and the append method seem to serve the exact same functionality for a string. Is there a heuristic for which one I should be using? I mean surely they are different... or at least were different at some…
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
1
vote
2 answers

add selected columns from two pandas dfs

I have two pandas dataframes a_df and b_df. a_df has columns ID, atext, and var1-var25, while b_df has columns ID, atext, and var1-var 25. I want to add ONLY the corresponding vars from a_df and b_df and leave ID, and atext alone. The code below…
profhoff
  • 1,017
  • 1
  • 13
  • 21
1
vote
2 answers

addition in matrix in c++

following is the code for (int w=0;w<10;w++) { for( int y=0;y<8;y++) { matrix[y][0] = arr_v1[y]; matrix[y][1] = arr_v2[y]; matrix[y][2] = arr_v3[y]; …
bijlikamasla
  • 371
  • 3
  • 6
  • 11
1
vote
3 answers

Python) I wanna add two lists which are different order of len

I wanna add list1=[1,2,3,4,5] and list2=[1,1,1,1,1,1,1] What I desired is like list3=[2,3,4,5,6,1,1] This is my wrong code lis1=[1,2,3,4,5] #len=5 list2=[1,1,1,1,1,1,1] #len=7 if len(list1)>len(list2): for i in range(len(list1)): …
1
vote
1 answer

addition of numbers, in a list, that are smaller than a given number

i'm studying prolog and I have to creat a program that returns the addition of numbers (in a list), that are smaller than a given number. I have this.. additionsmaller([X|XS],K,R):-X>K, additionsmaller(XS,K,R). additionsmaller([X|XS],K,R):-X
1
vote
0 answers

Matlab: Why is full/sparse matrix addition slower than full/full matrix addition?

Why is adding a sparse and a full matrix slower than adding two full matrices? The following code demonstrates consistent superior performance for hFullAddFull. I_FULL = 600; J_FULL = 10000; FULL_COUNT = I_FULL*J_FULL; NON_ZERO_ELEMENT_COUNT =…
rnoodle
  • 534
  • 2
  • 5
  • 21
1
vote
1 answer

C# How to add data to a dynamically added MSChart?

I'm currently trying to add data to my chart that I created dynamically. I've got a class (AddGraph) with following method: public class AddGraph { public string Name { get; set; } Random R = new Random(); …
C.User
  • 153
  • 18
1
vote
3 answers

Python: Adding odd numbers together from an input

Have a little problem. I'm writing a simple program that takes an input of numbers (for example, 1567) and it adds the odd numbers together as well as lists them in the output. Here is my code: import math def oddsum(n): y=n%10 if(y==0): …
user9421447
1
vote
1 answer

SQL addition through php script is behaving strangely

I have a strange problem with additions in SQL via a php script. I have the following form in PL.php: echo "
user2237168
  • 305
  • 1
  • 3
  • 17
1
vote
2 answers

Add content to .docx via a loop?

My aim is to add repeated sections to a .docx file, changing values in successive sections by pulling them from a data frame. Using the example code at https://cran.r-project.org/web/packages/officer/vignettes/word.html, I have been able to add a…
Charles Knell
  • 117
  • 1
  • 9
1
vote
1 answer

Add function to laravel Notification

I have next Notification class: class WelcomeNotification extends Notification { use Queueable; public function __construct() { // } public function via($notifiable) { return ['database']; } public…
Igor Ostapiuk
  • 589
  • 3
  • 7
  • 23
1
vote
0 answers

Adding Pandas series values Pandas dataframe values

I have a dataframe and a series A B C 1 3 4 2 5 6 s = df['A'] I have to add df + df['A] All column of df should add values of df['A'] depending on index.
Ajith
  • 11
  • 2
1
vote
2 answers

jQuery multivalue selector

Do you know of any good way/plugin to do this with jquery or any description on how to approach this effectively.
Andreas
  • 6,958
  • 10
  • 38
  • 52
1
vote
1 answer

Adding new JTextFields at the click of a JButton

I am working on an Invoice System and I want to create new fields each time the add new button is clicked. It needs to add the fields in the code below each time. The fields need to appear under its respective columns. JPanel panel_2 = new…
1 2 3
99
100