كود لمسائله


(math26) #1

السلام عليكم ورحمه الله وبركاته …
ممكن أريد منكم كتابه كود لهذه المسائله …جزاكم الله خيراااا

[FONT=Times-Roman][SIZE=2]One way to compute the exponential function

[/size][/font]e^xis to truncate its Taylor

[LEFT]series expansion around [/left]
[SIZE=2][FONT=Times-Roman]

[LEFT][/font][/size]x = 0,

…+e^x=1+x+(1/2!)x^2[/left]

[LEFT]Unfortunately, many terms are required for accuracy if [/left]
[SIZE=2][FONT=Times-Roman]

[/font][/size]|x| is large. But

[LEFT]a special property of the exponential is that e^2x[/left]
[SIZE=2][FONT=Times-Roman]

[LEFT][/font][/size]= (ex )^2. This leads to a

scaling and squaring [/left]
[FONT=Times-Italic][SIZE=2]

[LEFT][/size][/font]method: Divide x by 2 repeatedly until |x| < 1/2,

use

the Taylor series (16 terms should be more than enough), and square the
result repeatedly. Write a function

[/left]
[SIZE=2][FONT=Times-Roman]

[/font][/size]expss(x) that performs these three

[LEFT]steps. (The functions [/left]
[SIZE=2][FONT=Times-Roman]

[/font][/size]cumprod and polyval can help with evaluating
the Taylor expansion.) Test your function on x values 30, 3, 3, 30.[FONT=Times-Roman][SIZE=2]

[/size][/font]

(math26) #2

الله يوفقك ساعدووووووووووني…


(math26) #3

سبحان الله وبحمده …


(ايجيبت) #4

The most straightforward way to write the function is then:

e = 1 + x + x^2/factorial(2) + x^3/factorial(3)

A more general way to do this is to write a function:

function e = my_exp(x, n)

powers = 0:n;
e = sum(x.^(powers)./factorial(powers));


Then you can call the function "my_exp" with any value of x and any number of terms n.



i found your question on yahoo answers site and the best answer written by someone called
Voters


(math26) #5

شكرررااا لك,جزاكم الله خيرااا