# Matlab - Maclaurin series -n00b

• MATLAB
• k1dd101
In summary, to find the constant, linear, and quadratic terms in the Maclaurin series of the function f(x,y)= sin(x+y) cos(x-y), you first need to define the variables x and y as symbolic variables. Then, define the function as the product of sin(x+y) and cos(x-y). Use the "taylor" command to find the Maclaurin series with the desired number of terms, and assign it to a variable. Finally, use the "coeffs" command to find the coefficients of the series with respect to the desired variable.
k1dd101
Hi,
I have a problem, and I have no idea how to get started. I tried to follow tutorial on their website but it doesn't seems to help.
Here is my problem:

Derive the constant, linear, and quadratic terms in the Maclaurin series of the function f(x,y)= sin(x+y) cos(x-y).

This is what I have done so far:

>> syms x y
>> a=sin(x+y);
>> b=cos(x-y);
>> syms z
>> z=a*b
z = cos(x - y)*sin(x + y)
>> T=taylor(z,3);

---- After this I'm completely lost-----

>> xd=1:.05:3; yd=1:.05:3; zd=subs(a*b,{a,b},{[0 1; -1 0], [1 -1; -2 1]})

zd =
[ 0, -1]
[ 2, 0]

...using MATLAB for the first time.

Hi there,

I understand that you are having trouble deriving the constant, linear, and quadratic terms in the Maclaurin series of the function f(x,y)= sin(x+y) cos(x-y). Let me provide some guidance on how you can approach this problem.

Firstly, it's great that you have started by defining the variables x and y as symbolic variables using the "syms" command. This allows you to perform symbolic operations on them.

Next, you have defined the function f(x,y) as the product of sin(x+y) and cos(x-y). Now, to find the Maclaurin series of this function, you will need to use the "taylor" command in MATLAB. This command takes in the function and the number of terms you want in the series as inputs and returns the Maclaurin series.

In your case, you have correctly used the "taylor" command by specifying the function and the number of terms as 3. This means that the Maclaurin series of f(x,y) will have 3 terms. However, you have not assigned this series to a variable, so let's do that now.

You can assign the series to a variable, let's call it "S", by using the following command:
>> S=taylor(z,3);

Now, to find the constant, linear, and quadratic terms in this series, you can use the "coeffs" command. This command takes in the series and the variable you want to find the coefficients of as inputs and returns the coefficients in the form of a vector.

In your case, you want to find the coefficients of "S" with respect to "x", so you can use the following command:
>> coeffs(S,x)

This will return a vector with the constant, linear, and quadratic terms of the Maclaurin series of f(x,y).

I hope this helps you get started on solving your problem. If you have any further questions, please feel free to ask. Good luck!

## 1. What is Matlab?

Matlab is a high-performance programming language and interactive environment commonly used in scientific and engineering applications. It allows users to perform complex mathematical computations, create visualizations, and analyze data.

## 2. What is a Maclaurin series in Matlab?

A Maclaurin series is a special type of Taylor series that is centered at x=0. It is a way to represent a function as an infinite sum of terms, each with a different power of x.

## 3. How do I calculate a Maclaurin series in Matlab?

To calculate a Maclaurin series in Matlab, you can use the taylor function. This function takes in the function to be expanded, the number of terms, and the variable of expansion as inputs and returns the Maclaurin series as a symbolic expression.

## 4. What is the significance of a Maclaurin series in Matlab?

A Maclaurin series is useful in approximating complicated functions with simpler ones, making it easier to perform calculations and analyze data. It is also commonly used in solving differential equations and in other areas of mathematics and physics.

## 5. Are there any limitations to using Maclaurin series in Matlab?

Yes, there are limitations to using Maclaurin series in Matlab. The accuracy of the approximation depends on the number of terms used, and it may not accurately represent the function outside of a certain interval. Additionally, not all functions can be represented by a Maclaurin series.

Replies
5
Views
2K
Replies
5
Views
2K
Replies
6
Views
2K
Replies
1
Views
1K
Replies
2
Views
3K
Replies
4
Views
1K
Replies
1
Views
2K
Replies
5
Views
2K
Replies
2
Views
2K
Replies
2
Views
3K