Calculating Decimal Multiplication for f(x)=A/B

  • Context: Undergrad 
  • Thread starter Thread starter lewis198
  • Start date Start date
  • Tags Tags
    Multiplication
Click For Summary

Discussion Overview

The discussion revolves around the mathematical formulation of a function that extracts the decimal part of a division result, specifically for the function f(x) = A/B, where A and B are positive integers. Participants explore various methods to express this function, including algebraic approaches, programming techniques, and alternative mathematical concepts.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant inquires about a function g(x) that returns B multiplied by the decimal part of A/B.
  • Another participant suggests the expression B(A/B - floor(A/B)) as a potential solution.
  • There is a question regarding the algebraic representation of the floor function and whether a solution exists without it.
  • Some participants argue that the floor function is a valid mathematical function and can be used effectively.
  • Alternative methods are proposed, including programming examples in BASIC and discussions about using modulo operations.
  • One participant mentions the use of Fourier analysis to approximate the floor function, which raises questions about the appropriateness of such methods for this problem.
  • Concerns are raised about the distinction between functions and methods for evaluating those functions.
  • There is a suggestion to consider calculus as a potential method, although its relevance is debated.
  • Participants express uncertainty about the necessity of using complex methods for a function that could be calculated directly.

Areas of Agreement / Disagreement

Participants express differing views on the necessity and validity of using the floor function, programming techniques, and alternative mathematical methods. There is no consensus on a single approach or solution, and the discussion remains unresolved.

Contextual Notes

Participants highlight limitations in their approaches, such as the dependence on specific definitions of functions like the floor function and the potential for confusion between methods and functions. Some methods proposed may not be universally applicable or may depend on the context of their use.

lewis198
Messages
95
Reaction score
0
I was wondering, if you have the function:

f(x)=A/B

and the value returned is a non-integer, what form would the function g(x) have if it were to return the decimal part of the value returned multiplied by B?

For example:

A/B=3.245862

What function would return B*0.245862?(This is a specific example of course, what I am looking for is a function that is valid for all numbers, at least for all positve integers of A, and all positive values of B) Thank you for your time.
 
Mathematics news on Phys.org
[tex]B\left(A/B-floor(A/B)\right)[/tex]
 
But that's the thing- what is the algebra for the floor function? is there a solution with pure algebra?
 
Ah I see I posted a question asking if that's what you meant, then deleted it.

Why would you need to do that by algebra I wonder, when you can achieve the same thing much more easily without algebra? Computers can do this too with the int(integer) command. One for the pure mathameticians maybe?
 
Last edited:
lewis198 said:
But that's the thing- what is the algebra for the floor function? is there a solution with pure algebra?
?? That is perfectly good algebra. The floor function is as valid a function as x2 or [itex]\sqrt{x}[/itex].
 
okay, how about an operation that uses one of the following: multipication, division, addition, and subraction?
 
or calculus
 
How about, in magma notation for the sheer hell of it

function floor(x)
if x ge 1 then return floor(x-1); end if; // add or subtract 1 until
else if x lt 0 then return floor(x+1); end if; // you reach the range [0,1)
else return x; // then return x if x is in said range.
end function;

or does logical case by case analysis not fit into what ever arbitrary methods you've chosen as 'preferable'?

You should try not to confuse functions with methods to evaluate those functions - plenty of posters round here continually make this very important mistake.
 
Last edited:
How about BASIC

10 inkey a
20 inkey b
25 a/b=x
30 print (x-int x)*b
40 Print"Another y/n?"
50 inkey$
60 if inkey$="y" then goto 10
70 if inkey$="n" then goto 80
80 Print"bye!"

run

What's the formula to return b*the result of(x-int x) without a floor funciton?

What's the derivation mathematically of the floor function using +-/* or calculus?
 
Last edited:
  • #10
I don't believe calculus, multiplication, division, addition, and subtraction are arbitrary methods. I have just found the approximation using Fourier analysis.
 
  • #11
Don't forget modulo. X%1 will return a value >=0 and < 1 for all positive numbers. I'm not sure if C defines what happens if X is negative. In APL, the modulo function was implemented "correctly" for negative numbers. The sign of the result is always the sign of the divisor (and not the dividend), so that (-.6)%(+1.0) = (+.4), and (+.6)%(-1.0) = (-.4), this eliminates a double step at 0, and makes the modulo function and integer division origin independent. On computers that implement a "non-restoring" divide algorithm, the results are the same as that of APL, but few computers use this method.
 
  • #12
lewis198 said:
I don't believe calculus, multiplication, division, addition, and subtraction are arbitrary methods. I have just found the approximation using Fourier analysis.

I know what "multiplication, division, addition and subtraction" are :rolleyes:, but what do you mean by "calculus" as an arithmetic method?

And why in the world would anyone use Fourier analysis to approximate something as easy to calculate exactly as the floor function? That's like using Bessel Functions to approximate x2!
 
  • #13
Of course what I wrote isn't the floor function - it returns the fractional part. D'oh. Can easliy be altered, though (just subtract the fractional part of x from x).
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K