about newton Bionomial Expansion

3 ビュー (過去 30 日間)
Imtiaz Islam
Imtiaz Islam 2020 年 8 月 30 日
編集済み: John D'Errico 2020 年 8 月 30 日
Hi,
Good day.
Can anyone help me to develop this equation

回答 (1 件)

John D'Errico
John D'Errico 2020 年 8 月 30 日
編集済み: John D'Errico 2020 年 8 月 30 日
What is the problem? Why not try it? Make an effort. You will learn by doing so. If we need to teach you everything in this, we might as well teach an entire basic course in MATLAB to you here, and that will not happen. What is worse, that already exists! And if all we give you is a code snippet that you don't understand, that teaches you nothing, except to immediately ask for help on every problem you cannot handle.
Break a problem that is too large for you to handle into small pieces. Solve each small piece. Then put it together.
Do you know how to use the sin function? If not, then you REALLY need to read the getting started tutorials. Try the MATLAB OnRamp tutorial.
Remember that sin(x) assumes radians, though sind is available.
Next, hpw do you raise sin(x) to a power? Even though you may write the square of the sin of x as
sin^2(x)
in MATLAB, you want to write it as:
sin(x)^2
That is, you compute the sin(x), THEN you square the result.
Then how would you raise sin(x) to some more general power? Be careful to use parens there around the exponent.
How about that power of 2? That seems trivial. Again, use parens, or you will get in trouble.
Next, how about those binomial coefficients? Read the help for nchoosek. Be careful if the numbers get too large, as you could conceivably create something that is too large to put into a double precision number, in case w gets REALLY large.
help nchoosek
Finally, do you know how to use a for loop? Why not? Look at the examples in
doc for
Yes, you could do some of the work in that sum by computing each piece from the preceeding term in the sum. Learn how to solve the problem first, and only then should you bother to do it in some way that MAY be an improvement, and only bother to do so if there is a known issue with the code you wrote.
One other issue: Sometimes, those terms in that expansion can create really large binomial coefficients, that end up being counterbalanced by large powers of 2 in the denominator. That could even create an inf/inf situation, which will then result in a NaN. Could you use logs to solve this problem? (Yes.) The intelligent use of good numerical methods is often an important programming skill to learn.
You will learn MATLAB by making an effort to learn it. And when you have too big problems for you to swallow, you eat a progrmming elephant one byte at a time.

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by