Wow ! impossible! it's worked !! i think I'll love java soon ^^
thaaaaaannnk you very much Oralloy you are best adviser
thank you to help me out ^^"
User Profile
Collapse
-
i think i got the idea from the graph !
so i have write a method for n is 1 the x will reach
the base case to stop which is x==0! and then i do the exponential term.
I'll try what i understand ..
i tried to post this comment five times !! but it gave me an error !!...Leave a comment:
-
yeah i understand now , because the n which is increase
one each step !
so i created method for add 1 for each n !
Code:public static double sum(double n) { if(n==0) return 1; else if(n>0) return sum(n+1); else return -1; }
Code:public static double CalculateTheExp(double
Leave a comment:
-
-
Code:if(x==0) return 1 ; else if (x>0) return sum+=CalculateTheExp (CalculatPower(x,n),CalculatPower(x,n-1)/(CalculatFact(n-1))); else return sum; }
I study the case :
tell me if am wrong !
base case is when x=0 , return 1 .
but look !
power has its own base case to stop ?...Leave a comment:
-
e^x=1+ x/1!+x^2/2!+ …….+x^n/n!
-----
THAT LAST THING MY MIND FOUND !
Code:Sum = 0; Num = 0; if(x==0) return one ; else if(x>0) Num = CalculatPower(x-1,n)+CalculateTheExp(CalculatPower(x,n),(CalculatPower(x,n)/(CalculatFact(n)))); Sum = Sum + Num; return sum ; else return -1;
Leave a comment:
-
actually am still confuse !
but if i think in that way .. e = 2.718
so do i have say (should x be >1)!!Leave a comment:
-
yup! but i do not need to change any thing in fact & pow methods ? right !
.
exp function !
basic case (if x = 0) --> return one and stop !
but if (x+1) .. 1 .. , return (x-1)+(x^n/n!) ! am a right !! because each index will call the previous one
to get the answer ! is that what do you mean !!
do i have change my code to :
return x-1+(x/(CalculateTheEx p(x,n)));...Leave a comment:
-
the second one i already solved by myself and it's worked ! so forget it and i'll removed now!
but the first one even if it's homework , i did not
say i need someone to solve it to me i almost solved it
but .. i have problem with exp. function !!
here where i got the error & and i know i made
a mistake .. but i do not know what it is !!
return x+(x/(CalculateTheEx p(x,n)));Leave a comment:
-
Expontional Function in java and the number of vowels
Hii , every body .. how are you ?
Code:public static double CalculateTheExp(double x , double n) { double sum = 0; x = CalculatPower(2 , 5 ); n = CalculatFact(5); if(x==0) return 1 ; else if (x>0) { return x+(x/(CalculateTheExp(x,n))); } else System.out.println("WRONG
No activity results to display
Show More
Leave a comment: