Questions tagged [multiplication]

Multiplication is the mathematical operation of scaling one number by another. It is an elementary operation of most programming languages and is typically denoted by the symbol *.

Multiplication is the mathematical operation of scaling one number by another.

It is an elementary arithmetic operation in most programming languages along with addition, subtraction, division and sometimes modulo.

It is typically denoted by * (asterisk symbol) in programming, and × (cross symbol) in math.

Example (math): multiplication of numbers 3 and 4

3 × 4 = 12

See also: Multiplication on Wikipedia

2530 questions
0
votes
0 answers

Large Kartusba multiplication is failing. What is possibly going wrong?

I have implemented Karatsuba multiplication in Python. The code and pseudocode are as follow: def karatsuba(x, y): """ Input: two n-digit positive integers x and y. Output: the product x·y. Assumption: n is a power of 2. (NOT…
skad00sh
  • 171
  • 11
0
votes
1 answer

Multiplication of matrices in R - problem of dimensions

I am trying to multiply to matrices in R: I know this multiplication can be done, but I am getting an error. Any idea why? > d1 [,1] [1,] -3 [2,] 0 [3,] 3 > t1 [,1] [,2] [,3] [1,] 2 2 2 > t1 * d1 Error in t1 * d1 :…
Sss
  • 427
  • 2
  • 8
0
votes
1 answer

Giving infinite as result when using matrix chain multiplication to find the efficient cost

I am trying to understand Matrix Chain Multiplication. Particularly the problem Given a sequence of matrices, find the most efficient way to multiply these matrices together. I tried the following but it prints some infinite value for the result.…
Amanda
  • 2,013
  • 3
  • 24
  • 57
0
votes
1 answer

Reading float numbers using getchar() and printing the float number and it's double

I'm having trouble in converting numbers to float using getchar() method to solve my problem. For my problem I need to store characters in an array of fixed size = 50. Also, storing in an array only happens when there is a space ' ' or a newline \n…
Nzed
  • 109
  • 7
0
votes
2 answers

By increasing a value, another value is increased by that amount

So I have this code, where I want with a button increase amount and by increasing amount the weight changes with it. The result of the code below, by clicking the button innerText changes to for example 1piece = 8 g 2piece = 16 g 3piece = 48 g ->…
0
votes
1 answer

How to multiply pointer positions in a function?

I am trying to create some functions to handle vector and matrix operations. The vector sum function works as expected, but the dot product function returns always zeros. What I am doing wrong? Also, I am not sure if this is the best way to handle…
brantrigo
  • 3
  • 2
0
votes
1 answer

Product of array elements

In this exercise, I need to find the product of the array elements. I wrote the following program but it doesn't seem to work. The correct answer is -36288, but I keep getting 49. The result I'm after is : -7 x 8 x -9 x 6 x 6 x -2. The number 3 in…
jane
  • 124
  • 10
0
votes
1 answer

scalar multipling two data.frames in r

I have two data.frames in r.THe first one is cases population urbanisation density temperature h_dev_index Austria 563.375758 10.7969091 63.07388 134.08690 13.011172 0.9898000 Belgium 109.400000…
0
votes
2 answers

Google Sheet Not Multiplying in IF Formula

I am trying to calculate a price based on rates. If the number is $20,000 or below, there is a flat rate of $700. If the number is between 20,001.01 and $50,000, the rate is 3.5% of the number. The rates continue to lower as the numbers go up. I can…
0
votes
2 answers

SQL (MS SQL Server) return column value as the result of the multiplication

I have a table in SQL that looks like the below: table is like the below: Partno b5 b6 b7 A 3*38 4*38 5*38 B 4*1100 8*1100 15*1100 Column b5,b6,b7 is currently nvarchar. Can I check how to convert this column to…
0
votes
2 answers

pandas dot product on each sub frame in multi-index data frame

I have the following data df_matrix, level_1 and level_2 are the multi-index: |level_1|level_2|value_1|value_2|value_3| |-------|-------|-------|-------|-------| |a |w |1 |2 |3 | | |y |4 |5 |6 | | …
JohnnieL
  • 1,192
  • 1
  • 9
  • 15
0
votes
6 answers

Creating a list of mutable items repeated N times

I have a list containing a set of x mutable items. I would like to create another list where the set of x mutable items is repeated n times. However, the items must be references to unique objects rather than simply references to the original…
Alvin
  • 59
  • 1
  • 6
0
votes
1 answer

Can't wrap my head around this this recursion example

So there is this recursion example in chap 3 of Eloquent JavaScript, it goes like this: Consider this puzzle: by starting from the number 1 and repeatedly either adding 5 or multiplying by 3, an infinite set of numbers can be produced. How would you…
javeria
  • 81
  • 2
  • 9
0
votes
1 answer

Multiplying two large numbers gives the wrong result

I'm getting the wrong results when multiplying p*q in the below code: #include #include #include #include #include #include #include #include uint32_t…
Levi
  • 23
  • 3
0
votes
4 answers

Printing a Multiplication Table Using Python Nested For Loops

for i in range(3,33,3): for j in range(1,11,1): print("3 *", j, '=', i) if j == 10: break This is the output that I am getting: 3 * 1 = 3 …
user14665723