1. Problem with EDOM2

I'm having this problem with EDOM2 and I hope you could help me..
(Any1 on the list or Terrence who received this mail also)

I have three (floating or not values) v1, v2 and v3.
v1 / v3 makes an integer
v2 / v3 makes an integer

I dunno v3, I do know v1 and v2.
How should I get v3 ??

I know have this and it works when v1 and v2 are integers, although it
doesn't give the *best* results..

function ClearDivide (atom v1, atom v2)
    return 1/ (v1 * v2)
end function

Could any1 help me ?

Ralf

new topic     » topic index » view message » categorize

2. Re: Problem with EDOM2

> I have three (floating or not values) v1, v2 and v3.
>  v1 / v3 makes an integer
>  v2 / v3 makes an integer
>
>  I dunno v3, I do know v1 and v2.
>  How should I get v3 ??

What you are looking for is a common factor of v1 and v2 ie a number which
goes into both. A human brain would do this intuitively, but what you need to
do depends on the outcome required ie do you want the HIGHEST common factor,
the LOWEST or just any old one ? Would you prefer an integer or not ?

If you want an integer then find the factors of each, compare them, and choose
the most useful number that appears in both lists.

--Prog to find factors

sequence factors
atom v,res

for a=1 to floor(v/2) do
  res=v mod a    -- find remainder, syntax may be incorrect
  if res=0 then
    factors=factors&res
  end if
next

Daniel

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu