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 *.
2,534
questions
0
votes
1
answer
62
views
Why the multiplication result is wrong on this code? [closed]
I using this code (is working in progress)
the part
unsigned int i;
unsigned int b = 512;
i = atoi(line);
unsigned int linekb = (i * b);
return..
The size in 512b blocks of the disk /...
0
votes
1
answer
17
views
This program must raise the number two to a power that the user enters
Warning C6385 Reading invalid data from 'result'. 21
Warning C6386 Buffer overrun while writing to 'result'. 12
Warning C6385 Reading invalid data from 'number'. 58
When raised to a power ...
-1
votes
0
answers
10
views
Componentwise product in complex numbers
I want to prove that we can't express u1u2+iv1v2 with addition, subtraction, multiplication operations on z1=u1+iv1,z2=u2+iv2
I tried to prove it, but it doesnt work. If we introduce conjugate ...
0
votes
2
answers
82
views
Cartesian multiplication of two sets where the member of each set is a set
enter link description hereI have two expressions that I want to get a member-by-member union of. But the problem is where the member of each expression is a set.
I have a graph from which I obtained ...
0
votes
1
answer
59
views
How can I multiply negative numbers using the VVM program editor?
How can I multiply negative numbers using only some functions in vvm like INP, STO, LDA, BR, BRP, SUB, ADD, and OUT?
My code can multiply positive numbers, but it does not work correctly if the second ...
-1
votes
0
answers
30
views
VHDL Multiplication force Overflow
I do calculations with angles in VHDL.
As they are cyclic, I want to make use of this by using the overflow.
NBIT and NSAMP are generic integer
The others are signed variables
for i in 0 to NSAMP-1 ...
-2
votes
2
answers
59
views
Elementwise array mutliplication in VHDL
How can I multiply two arrays elementwise.
In Matlab, I could do
a[1:6 ] = b[2:7] .* b[1:6]
I have tried
calc_imag(5 to 7) <= i_real(5 to 7) * i_real(6 to 8);
but it doesn't seem to work
1
vote
2
answers
91
views
Find the number of bits in the product of a multiplication without knowing one of the factors
Suppose I have some odd number N with more than 1000 bits and I want to multiply it by some number H so that their product results in a number in which all its bits are 1. For example:
N = 0b1101
...
-1
votes
1
answer
71
views
How to get multiplication of two column's value which is nearly equal (highest decimal) in the third column using SQL/Python?
I have a dataset named df
Multiplicating two columns (Open and low, which have the equal values) should give the result nearly equal to the highest integer (decimal) value referring to the 'High' ...
1
vote
3
answers
206
views
Binary multiplication without arithmetic operators and loops
I have to do the following task:
Implement written multiplication of two two-digit binary numbers
without using the +, -, *, / and bit operations. The logical
operators &&, || and ! may only ...
0
votes
0
answers
48
views
Fail to release the memory after 2D array multiplication with python ctypes
I tried to call functions in DLL with python ctypes module. The functions perform 2D array multiplication successfully and created by C. The following source code would be packaged into "...
0
votes
1
answer
74
views
Creating a new column or row in flowgorithm
I am trying to create a multiplication table from 1 to 10, but print each line one at a time. I need to know how to do this in flowgorithm. I have the chart correct to print the multiplication table ...
0
votes
1
answer
45
views
What's the difference between following code?
Currently Im solving and learning DSA. I'm using Coding Ninjas to learn DSA and for problems too.
so my question is what's the difference between following code?
def mul(m, n):
if m ==0 or n == ...
0
votes
2
answers
89
views
Multiply and IF function
I am trying to write a formula that if c7 is over 90 the number in that column multiplies by 4, If the number is over 100 it should multiply by 6. I have this formula and it is not multiplying by 6 ...
0
votes
1
answer
74
views
Multiplying float with BigInt in JavaScript? [duplicate]
By using this website
I can calculate for example
x = 0.28
y = 1e18
x * y = 280,000,000,000,000,000
How can I do this in javascript while x could be any number, including ints, and y could be any ...
0
votes
0
answers
23
views
Confused with scipy csr_matrix multiply
Consider
row_A = np.array([0, 0, 1, 2 ])
col_A = np.array([0, 1, 0, 1])
data_A = np.array([4, 3, 8, 9])
csrMatrix_A = csr_matrix((data_A, (row_A, col_A)),
shape = (3, 3))
...
1
vote
2
answers
151
views
Faster multiplication than * [closed]
I am trying to find a faster way than regular multiplication. I run the code in vscode, and as far as I can see I have no optimization enabled. I also tried gcc -O0 _.c -o _ but still getting the same ...
1
vote
2
answers
193
views
Problem in multiplying two 64-bit numbers
I want to multiply two 64-bit unsigned numbers together and store the result in a 128-bit variable. I did it in the way given in the link https://www.plantation-productions.com/Webster/www.artofasm....
0
votes
0
answers
9
views
get wrong return value of float of a function
I have a function that calculate multiplication two float numbers in FPU representation(sign,exponent,mantissa).The output of the multiplication function is correct in print but when I get the return ...
0
votes
2
answers
35
views
Why is the solution to multiply rather than dividing by 10,000? [closed]
Hi I was working on Datacamp and there was a problem where you needed to find the number of homeless individuals per 10,000. I was unable to understand why the website answer only involves multiplying ...
0
votes
1
answer
105
views
cuBLAS element-wise multiplication
Suppose i have two integer arrays in device memory (cuda c code).
Examplex = [1, 2, 4, 8, 16, 32] y = [2, 5, 10, 20, 40, 50]
i want to do element-wise multiplication using cuBLAS.
I tried this and ...
0
votes
1
answer
32
views
How to correct MARIE simulator assembly code to correctly output z when z = a*b*c
ORG 100
Input, Input / Read input value
Store A / Store input value in A
Input / Read input value
Store B ...
0
votes
1
answer
92
views
Is there any difference between these two?
I donno if this is possible or not but am confused.
Are they both same?
I know that in the first case we are allocating memory dynamically for 20 elements of type int.
int *p;
p=(int *) malloc(20*...
0
votes
0
answers
30
views
VBA - #VALUE error during initial run , multiplier to dynamic range
I apologize for the confusing title but to start, I created some code to apply a multiplier (a defined variable referenced to a cell value) to a dynamic range of non-blank/non-empty cells but only in ...
-1
votes
1
answer
80
views
Multiplication of numbers from a to b
I need to write algorithm, that multiplies numbers from a to b without input (scanf). Like this:
a = 2;
b = 6;
2 * 3
2 * 4
...
2 * 6
I have my algorithm:
void main()
{
int dist = 1;
int a = ...
0
votes
4
answers
84
views
Python signed multiplication is not commutative near floor division?
-1 * abs(-123)//10
is
-13
but
abs(-123)//10 * -1
is
-12
Why is this? What's the rule to be consistent and predictable when coding this?
0
votes
5
answers
84
views
js function repeatedly invokes through an array of multipliers
I am running into an error: Uncaught TypeError TypeError: multipliers.reduce(...) is not a function. I was looking at currying and partial application. I expected multiply function to correctly invoke ...
0
votes
1
answer
54
views
Numpy 3D Matrix Multiplication (Same Dimensions)
I am trying to multiply two 3D matrices with the same dimensions (MxNxD). I know in 2D matrix multiplication, I can just transpose one and do the matrix multiplication. Is there a similar approach for ...
0
votes
1
answer
62
views
Python: TypeError: numpy.float64
I defined the following matrix:
B = np.outer(v,n1) + W
Which means:
B = v^T * n1 + W.
W is a matrix with s columns and rows respectively.
The vector n1 has s elements, as well as the transposed vector ...
0
votes
1
answer
80
views
Need help fixing calculator's multiplication and division in assembly language
Division and Multiplication part doesn't work. It jumps in to the prompt of the 2nd input number.
I ran the code the addition and subtraction part work, whereas the division and multiplication doesn't ...
0
votes
1
answer
29
views
Iter-selection data from a row-list and multiply each value with multiple csv files in order , Python
I have multiple csv files can be read in order using glob in pandas. Each file should multiply with a value from a list in order. Here is the code I wrote to read the whole csv file:
#list file
list = ...
0
votes
0
answers
22
views
Is there a way to generate an integer numpy array by multiplying a float array with one that will remove the need of a float for result?
multiplication of a numpy float array for an integer and producing an integer array with results
standard multiply function, when starting with a float array, generates a float result, yet i start ...
0
votes
0
answers
9
views
Replicate row by n times being n a value in another column [duplicate]
Imagine I have the following data:
Index Local ID Number of Dependents
0 PT1 362 2.0
1 PT2 363 1.0
2 PT3 369 3.0
3 PT4 ...
0
votes
1
answer
31
views
Python SQLite: Taking user input for an order of fruit, finding price from database, and multiplying with quantity for a receipt
I have a python program using sqlite and I'm trying to create a function to take user input for a simple order of fruit. I have 2 user inputs; a string and an int and have a float in my database. What ...
0
votes
1
answer
58
views
Google Sheets formula for calculating and multiplying data ranges
Thank you in advance for your attention.
I'm attempting to create a spreadsheet that tracks employee hours on different aspects of a project. One employee is paid $250 daily. If this employee spends ...
0
votes
1
answer
15
views
How Do I Create a Multidimensional Array in Python Via Multiplication in a Loop?
I am trying to multiply individual elements in an array with a dataframe of 5 columns to get a multidimensional array of ndim(5, 5, 2),
however, the code I am using gives me ValueError: operands could ...
1
vote
1
answer
121
views
Error with Multiply-Accumulation Verilog Simulation: Illegal output or inout port connection
I'm trying to build a Multiply-Accumulator (MAC) module for Matrix Multiplier with Verilog.
Here's Verilog Code for the MAC module:
module Multiply_Accumulation(MAC_out, sel, a, b, clk, rstn); //...
0
votes
2
answers
311
views
Multiplying two 24 bit digits in Verilog
I am trying to write code that multiplies two 24-bit numbers and results in a 32-bit number. I have tried to do it using such a bit-by-bit method but I think something is wrong.
This is my code:
...
1
vote
1
answer
111
views
check for uint64_t overflow in a loop
I have a C-method which calculates the k-th number of the collatz-sequence of n.
If n is / gets bigger than 64-Bit the method may return 0.
My approach however has a lot of false positives.
How can a ...
0
votes
1
answer
66
views
Python Pandas mlutiplication witihin one column base on a condition in other column
I am trying to multiply quantity defined as column ['TRGQTY'] within different rows in my DataFrame based on the condition defined for other columns. I want to take the ['TRGQTY'] where ['SUBPACKNR'] ...
0
votes
0
answers
23
views
Using DataFrame.Multiply on 2 Data Frames with 1 Having multi-level headers
I am loading 2x csv files into 2 separate dataframes and then trying to multiple the column of one dataframe against all the columns of another dataframe to create a third dataframe. Both csvs and ...
2
votes
1
answer
50
views
Multiply a list of arrays by a list of dataframes - R
I am trying to multiply a list of arrays by a list of dataframes, but it's not turning out the way I had in mind.
The arrays are a list of 2 with a dimension of 5x2, and the dataframes are a list of 2 ...
0
votes
1
answer
58
views
How to multiply(*) without using multiply(*) JOLT
Multiplying in JOLT. How to multiply without using multiply.
3
votes
1
answer
193
views
How can I multiply char with a number?
It is my first time using stackoverflow!
I am a beginner and I will try to write my problem as short as possible;
User puts a number e.g 1234
char NUMBER = In.read();
while (NUMBER != '\n') {
Out....
0
votes
0
answers
51
views
Gpu copy bottleneck(fluctuation) during matrix multiplication
I am trying to train my updated model with pytorch. It has 6 conv layers and 6 conv transpose layers and the kernels for these layers are made by matrix multiplication. It shows the amazing ...
1
vote
1
answer
241
views
MUL Instruction in x86 Assembly
I am having difficulties figuring out what the result of the below operation would be. After doing research online and referencing my 80x86 book, it looks likes the mul instruction always references ...
1
vote
1
answer
103
views
Verilog 4bit X 4bit add and shift multiplier
I'm trying to make a 4bit X 4bit multiplier in Verilog that uses the add and shift method. However, when I run the simulation, I keep getting 00 for the result value.
This is the code that I used:
`...
1
vote
2
answers
242
views
Multiplication of 4d and 2d matrices using pytorch
I'm trying to do matrix multiplication through a torch. What I want to do is multiply a 4d matrix by a 2d matrix.
For example, 4d has a size of (A,B,C,D), and 2d has a size of (D,C).
What I want is ...
1
vote
2
answers
88
views
Time Complexity of Russian Peasant Algorithm
I'm trying to figure out the time complexity of this:
#include <iostream>
using namespace std;
unsigned int russianPeasant(unsigned int a, unsigned int b)
{
int result = 0;
while (b >...
0
votes
1
answer
29
views
I have no idea whats wrong with the if statement
I'm making a simple 'if' statement to check if the answer the user gave to a multiplication sum was correct, and have the code print "correct" or "wrong". However I cant understand ...