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
3 answers

How to sort a list of lists based on multiplication of elements inside of smaller list

How do I sort list of lists based on product of multiplication of elements in list? list1 = [[11,11], [15,12], [13,18], [14,21]...[a,b]] How do i sort list from the smallest value of a*b to the highest? Let's say we have list2 = [[1,1], [5,5],…
0
votes
0 answers

What's the method to multiply two 32 bit numbers using the 16 bit register in MASM 8086?

Here is a 32x16 bit code i have made (12345678x1011) MYCODE SEGMENT ASSUME cs:MYCODE ORG 1000h START: nop L1: mov ax, cs mov ds, ax mov sp, ax L2: mov ax, 5678h mov cx, 1011h L3: MUL cx mov WORD PTR ds:[5000h],ax …
0
votes
0 answers

finding ratio of a decimal

I read that to find the ratio between two decimals I need to multiply both by powers of 10 until they are both whole numbers. then simplify the ratio. my program is currently doing this input: 9.902, 1.00131 ratio: 58247 : 5890 the ratio is not…
Andy An
  • 29
  • 5
0
votes
1 answer

Matrix-vector-multiplication, Lost in Lapack

I would like to compute x^T A x* (x transposed times matrix A times x conjugate complex) using Lapack. I did not find a function for this. Or is there one? What is the fastest way of doing this?
zeus300
  • 1,017
  • 2
  • 12
  • 30
0
votes
2 answers

JavaScript Smoother Multiplication Circle

The Idea I came across this idea of multiplication circles from a YouTube video that I stumbled upon and I thought that would be a fun thing to try and recreate using JavasSript and the canvas element. The Original Video The Problem I smoothed out…
James
  • 73
  • 9
0
votes
2 answers

Multiplication in Loops of Unknown Length

I've been stuck on this code from mypy2 for the last hour but I can't seem to wrap my head around it. It wants me to write a program that multiplies many numbers together. Where the program will keep asking the user for numbers until they enter…
esier0
  • 1
0
votes
1 answer

MSVC's instrinsics __emulu and _umul128 in GCC/CLang

In MSVC there exist instrinsics __emulu() and _umul128(). First does u32*u32->u64 multiplication and second u64*u64->u128 multiplication. Do same intrinsics exist for CLang/GCC? Closest I found are _mulx_u32() and _mulx_u64() mentioned in Intel's…
Arty
  • 14,883
  • 6
  • 36
  • 69
0
votes
4 answers

Multiplication using repetitive addition

Why this code is working ? I meant that if “b” is negative then “c” will never achieve the value of “b” in “if statement” and answer should not come right but still irrespective what “b” is (positive or negative) ,the multiplication always comes…
Prince
  • 119
  • 1
  • 8
0
votes
4 answers

Multiplying a scaler to a matrix in python

I am given >>> scalar = 3 >>> A = [[1,0,0],[0,1,0],[0,0,1]] >>> D = [] What I am supposed to do is multiply all of A with the scaler and have that answer stored as D. How would I do that?
0
votes
1 answer

Easy method to solve multiplication of many numbers followed by division

Please help for easy method to solve longish multiplications and division equation. Example like (667 x 6 x 74) / (384 x 384) Many Thanks in advance
0
votes
1 answer

How to multiply all elements in a row with corresponding element in same row in different column in pandas dataframe in Python?

I have a dataframe which looks as follows: I want to multiply elements in a row except for the "depreciation_rate" column with the value in the same row in the "depreciation_rate" column. I tried df2.iloc[:,6:26]*df2["depreciation_rate"] as well as…
hbstha123
  • 1,260
  • 11
  • 23
0
votes
1 answer

Conditional multiplying based on column name

I already checked this solution but it doesn't fit my data structure. Input I have a data frame Portfolio containing company indentifiers Indentifier, portfolio weights Weight, Dates and in the rest of the columns return data at least for each of…
GitTY095
  • 17
  • 4
0
votes
1 answer

Weird problem with a kata on codewars (python)

Kata description: In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative? Example: Kata.MakeNegative(1); // return -1 Kata.MakeNegative(-5); // return -5 Kata.MakeNegative(0); //…
Nafikos
  • 11
  • 3
0
votes
1 answer

Is there a method to multiply only certain elements in a numpy array

Suppose I have a numpy array like so: a = ([[4, 9], [38, 8], [90, 10]...[8545, 17]]) Where the first element is a location ID and the second is the amount of time spent at each location in minutes. I want to convert these times into seconds which…
0
votes
0 answers

Multiply matrices in C using pointers

First of all I apologize if I write something wrong, english is not my main language, and second, I'm new at developing world so... I'm kinda noob at programming hahaha I'm developing a code in C using pointers (and this is my difficulty) where the…
Felipe
  • 1