Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 Re: Help Me ! » C++ to mathematics » 2009-03-09 11:02:34

Thanks guys

Is this mathematically correct ?

F(n)=I(0,n,n/2)   ( does it have the same behavious as the previous function in c++ ?)

with

I(r,i,m)  =I(r,i-1,m) +R(r,i,m)   and  I(r,0,m)=R(r,0,m)
R(r,i,m)= R1( r , i , m) + R2( R1( r , i , m) , i , m) + R3( R2( R1( r , i , m) , i  , m) , i , m)
R1(r, i , n) = r +  ( ifl( i , m) * 1 )
R2( r , i , n ) = ( r *  ife( i , m) ) + ( not(ife( i , m) * r )
R3( r , i,  n) = ( (r^2) *  ifg( i , m) ) + ( not(ifg( i , m) * r )
-----------
isz (x) = floor( 1 / (abs(x) +1) )
Out :   1 if x=0  ,  0 if  x <> 0
-----
sgn(x) = abs(x) / ( x + isz(x) )
Out :   1 if x>0  ,  0 if  x = 0 , -1 if x < 0
----
NOT (x) =  isz (x)
----
cmp(a,b) = sgn(a-b)
Out :   1 if a>b  ,  0 if  a=b, -1 if a<b
-----
isnz(x) = abs( sgn(x) )
Out :   1 if a<>0  ,  0 if  a=0
---
ife(a,b) = isz(a-b)
Out :   1  if a=b  ,  0 if a<>b
--------------------
ifg(a,b) = isz(cmp(a,b)-1)
Out :   1  if a>b  ,  0 if a<b
--------
ifl(a,b) = isz(cmp(a,b)+1)
Out :   1  if a<b  ,  0 if a>b



Source  : dirbax.com/inventions/dimd-dynamic-intelligent-mathematical-design-/basic-functions.html

#2 Help Me ! » C++ to mathematics » 2009-03-06 10:52:48

dirbax
Replies: 3

Hi , is it possible to transform the following code to math

int F( int n )
{
int r=0;
int mid=n/2;
for( int i=0 ; i<n ; i++)
{
if( i<mid) r+=1 ;
if( i==mid) r*=2 ;
if( i>mid) r=pow(r,3) ;
}
return r ;
}

and is this correct ? www.dirbax.com/inventions/dimd-dynamic-intelligent-mathematical-design-/practical-example-1.html

thanks

Board footer

Powered by FluxBB