Hello , by matlab , compute the product of :
이전 댓글 표시
p1=sqrt(2)/2 , p2=sqrt(2+sqrt(2))/2 , p3=sqrt(2+sqrt(2+sqrt(2)))/2 ,
compute product by matlab, p1 * p2* p3 *........... * p20
댓글 수: 5
Jan
2011년 5월 3일
Do you have a question concerning Matlab? What have you tried so far and where did the problems occur?
Walter Roberson
2011년 5월 3일
Say... what does the keyword "fsolve" have to do with the question?
Matt Tearle
2011년 5월 4일
The OP wants us to "solve" the problem. Duh. (I leave the "f" part as an exercise for the reader.)
Sean de Wolski
2011년 5월 4일
F* solving it, Matt?
Walter Roberson
2011년 5월 4일
"Fer Sure"??
답변 (3개)
Walter Roberson
2011년 5월 2일
function t66 = prod_p1_p20
V = 2;
t1 = V ^ V;
t3 = t1 ^ V;
t4 = t3 ^ V;
t5 = t4 ^ V;
t6 = V^(-1);
t7 = V^t6;
t11 = (V + t7)^t6;
t14 = (V + t11)^t6;
t16 = (V + t14)^t6;
t19 = (V + t16)^t6;
t23 = (V + t19)^t6;
t25 = (V + t23)^t6;
t28 = (V + t25)^t6;
t30 = (V + t28)^t6;
t33 = (V + t30)^t6;
t38 = (V + t33)^t6;
t40 = (V + t38)^t6;
t43 = (V + t40)^t6;
t45 = (V + t43)^t6;
t48 = (V + t45)^t6;
t52 = (V + t48)^t6;
t54 = (V + t52)^t6;
t57 = (V + t54)^t6;
t59 = (V + t57)^t6;
t62 = (V + t59)^t6;
t66 = t62 * t59 * t57 * t54 * t52 * t48 * t45 * t43 * t40 * t38 * t33 * t30 * t28 * t25 * t23 * t19 * t16 * t14 * t11 / t7 / t5 / t1 / V;
end
댓글 수: 9
Abdulfattah lulu
2011년 5월 2일
Oleg Komarov
2011년 5월 2일
What's not clear to you?
Abdulfattah lulu
2011년 5월 2일
Abdulfattah lulu
2011년 5월 2일
Abdulfattah lulu
2011년 5월 2일
Abdulfattah lulu
2011년 5월 2일
Walter Roberson
2011년 5월 2일
The function is prod_p1_p20 and t66 is the output. If you run the function, then the output will be exactly the quantity you were asked to calculate, and thus this function *is* a solution to the problem as stated. There was nothing in the problem statement that required that the variable names p1, p2, and so on, were used in the solution: the problem statement only required that the product of the quantities be found.
Go through the logic step by step. The only "tricky" part of this logic is in computing the denominator.
John D'Errico
2011년 5월 3일
Crystal clear.
Walter Roberson
2011년 5월 4일
Abdulfattah: how would you calculate any one p(n)? If you know p(n-1) how would you extend it to p(n) ?
Matt Tearle
2011년 5월 4일
disp(1*0.6366)
댓글 수: 5
Sean de Wolski
2011년 5월 4일
Surely you meant:
disp(1*pi/4.734) %?
Walter Roberson
2011년 5월 4일
Read the problem statement, Matt. *Compute* the product, not *display* the product. And the value displayed is nearly 2E-5 wrong compared to what would be computed.
Walter Roberson
2011년 5월 4일
Sean, re-check that output!
John D'Errico
2011년 5월 4일
Well, arguably, multiplying by 1 makes it a computation.
Matt Tearle
2011년 5월 4일
Exactly, John. And there was no specification of accuracy. So I claim that my answer computes the product requested (just to 4 dp, that's all).
John D'Errico
2011년 5월 4일
0 개 추천
Well, for complete overkill...
disp(0 + 0.63661977236781944823166583843277598162106456255690961760282370334657710024147820303991996854856502247043508070567897809925678676832984935864030869184975575167078632289509242155624801993112605554672293135860993145476492852903886184623882769012238145575770975998129003396352798880718475639573387445219320317598093723758568037151319811216067649754946716309234535128512187466093946760854635939038744626459238525652130733923947876362385118364006093735040924909121572691582778720782038355177247697778990109)
Walter - this IS a computation, as I added 0 to the result.
댓글 수: 6
Sean de Wolski
2011년 5월 4일
John, I'm disappointed in that offering. This is begging for your vpi class:
X = 1*vpi('636619772367819448231665838432775981621064562556909617602823703346577100241478203039919968548');
vpi2English(X)
ans =
six hundred thirty six novemvigintillion, six hundred nineteen octovigintillion, seven hundred seventy two septenvigintillion, three hundred sixty seven sexvigintillion, eight hundred nineteen quinvigintillion, four hundred forty eight quattuorvigintillion, two hundred thirty one trevigintillion, six hundred sixty five duovigintillion, eight hundred thirty eight unvigintillion, four hundred thirty two vigintillion, seven hundred seventy five novemdecillion, nine hundred eighty one octodecillion, six hundred twenty one septendecillion, sixty four sexdecillion, five hundred sixty two quindecillion, five hundred fifty six quattuordecillion, nine hundred nine tredecillion, six hundred seventeen duodecillion, six hundred two undecillion, eight hundred twenty three decillion, seven hundred three nonillion, three hundred forty six octillion, five hundred seventy seven septillion, one hundred sextillion, two hundred forty one quintillion, four hundred seventy eight quadrillion, two hundred three trillion, thirty nine billion, nine hundred nineteen million, nine hundred sixty eight thousand, five hundred forty eight
Walter Roberson
2011년 5월 4일
Interesting how close the answer is to 2/Pi; I wonder if 2/Pi would be the limit of the product?
Matt Fig
2011년 5월 4일
For example:
http://en.wikipedia.org/wiki/Vi%C3%A8te%27s_formula
John D'Errico
2011년 5월 4일
Sean - Well, I did generate the result using my new floating point arithmetic class. But this brings up a good question. Can I (should I?) write a float to english converter?
John D'Errico
2011년 5월 4일
Walter - I tried to verify that. Using a good approximation of pi that is sufficiently accurate for many school boards...
pi = 3;
2/pi
ans =
0.6666666666666667
Can you help me here? It seems to give the wrong answer.
Sean de Wolski
2011년 5월 4일
Absolutely! Couldn't you just add 'ths to the end of each of the suffix and reverse the order? I.e. tenths hundredths thousandths etc...
카테고리
도움말 센터 및 File Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!