cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

fourier series coeff calc. in symbolic mode

mark_neil2
1-Visitor

fourier series coeff calc. in symbolic mode

Hi,
I am trying to calculate Fourier Series coefficients in symbolic form but for some reason Mathcad doesn't calculate the integral. I use MC14, M020. I have attached the file. Does anyone have an idea why? Thanks.

Mark
22 REPLIES 22
RichardJ
19-Tanzanite
(To:mark_neil2)

On 7/16/2009 8:46:01 PM, mark_neil wrote:
> Does anyone have an
>idea why? Thanks.

Because, when it comes to doing integrals the MuPad symbolic engine in version 14 sucks. Not what you wanted to hear perhaps, but when doing symbolic math the old 1994 Maple engine is way ahead of the 2005 MuPad engine

Richard

use the same platform. Enter a value for Ts in the first segment. Somehow this clears the rest of the example up & it runs symbolically OK.



On 7/17/2009 9:01:48 AM, jmG wrote:
>jmG


Thanks everyone. I already have a Fourier series calculation Mathcad file that calculates the coefficients numerically and it works just fine. I recently changed to MC14 and wanted to calculate the coefficients symbolically (as formulas). It didn't make sense that MC14 didn't solve the integral. Period will always cancel out in the coefficient equations, so I don't mind assigning a numeric number to it. Again, thanks everyone who replied.

Mark.

On 7/17/2009 2:06:32 PM, jmG wrote:
>>It didn't make sense that MC14 didn't solve the integral<<br> >_______________________
>
>Can you post an image in this
>forum, so collabs can look at
>this curiosity and maybe
>declare an immense bug not
>already picked up. You may be
>omitting the Dirac delta ?
>
>jmG

It is the file that I posted in my first message in this thread (Thursday, July 16, 2009 08:46 PM). MC14 doesn't solve the integral if the period (Ts in the MC file) is a parameter. It has to be numeric to get the solution.

Mark

I have made the period numeric and now it works fine except some cases. Pls see the attached file. If I enable the second function of f(t) on top of the file (with t^2 in it), then the fourier coefficients become complex numbers and it doesn't plot g(x) anymore. I use MC14. Does anyone have a suggestion as how to modify the file so that it works for any function?
Thanks.

Mark.

On 7/17/2009 9:20:09 PM, mark_neil wrote:
>I have made the period numeric
>and now it works fine except
>some cases. Pls see the
>attached file. If I enable the
>second function of f(t) on top
>of the file (with t^2 in it),
>then the fourier coefficients
>become complex numbers and it
>doesn't plot g(x) anymore. I
>use MC14. Does anyone have a
>suggestion as how to modify
>the file so that it works for
>any function?
> Thanks.
>
> Mark.

Plot the magnitude. Complex numbers in data are
not plotted (It is one of the techniques for
leaving gaps in plotted data lines).

Likewise you can plot the phase of the Fourier
components by using the arg() function.

I haven't opened the file yet, but I'm presuming
the presence of the t^2 term means you will have a
'chirp' effect, which changes both frequency and
phase [There are multiple definitions of 'phase',
allowing lots of discussion without great
illumination]. It is the phase term that creates
the complex value (and vice versa)

Philip Oakley

No, the coefficients should be real. It works fine in version 11 (and presumably 13, although I didn't bother to try it). I don't see how to make it work in version 14. I wonder if the complex solution to the integral is even correct.

Richard

I [finally] open it (the (1) version) in the latest
M030 and didn't spot any complex values.

Yes it did take a little while to solve the
integrals (say a minute), but gave what look like
reasonable answers (3 terms in each a() and b()
coefficient)

The final plot of g(x) is OK with the usual Gibb's
phenomena showing at the transitions.

Philip Oakley

There are two different definitions for f(x). As posted the second one is disabled so the first one is used. That one works OK. But if you enable the second function (the one with t²) you get the incorrect integrals.
__________________
� � � � Tom Gutman

The complex values for the integrals are clearly not correct. Integrating a real integrand cannot result in a complex result. And it's not just that the coefficients are expressed with an expression involving complex terms (that is possible) but the actual values are complex.

Doing the complex Fourier series (instead of separate cosine and sine terms) may be enlightening. The solution is also wrong (as can be seen when the resulting series is evaluated), but here the cause is likely to be the incorrect use of principle values. There are several fractional exponents in the solution, and non-integer powers of complex numbers are not well defined.
__________________
� � � � Tom Gutman
RichardJ
19-Tanzanite
(To:TomGutman)

On 7/18/2009 2:44:15 PM, Tom_Gutman wrote:
> Integrating a real
>integrand cannot result in a
>complex result.

Good point 🙂

> And it's not
>just that the coefficients are
>expressed with an expression
>involving complex terms (that
>is possible) but the actual
>values are complex.

Yes, I also checked that.

Richard

I had a chance to run the file with MC13 at the weekend. I have changed the input function into many different combinations of exponential, power of t, and trigonometric functions and it worked very well in all cases. I think it is something with MC14 that doesn't work right in this file.
Even the complex Fourier function doesn't help either. See the attached MC file... The very same file works just fine on MC13 but it is screwed up on MC14. The attached pdf file is the output from MC14.

Mark.

Remember there was a change of symbolic engines
between V13 & 14 which makes a whole world of
difference to the approach used (internally) to
solving these problems.

Computer algebra doesn't always succeed, and is
occasionally wrong or takes a different viewpoint...

Philip Oakley

On 7/20/2009 6:43:32 PM, philipoakley wrote:

>Computer algebra doesn't
>always succeed, and is
>occasionally wrong

In this case it's wrong. MuPad is unfortunately wrong too often, especially when it comes to integrals.

Richard

On 7/20/2009 7:27:24 PM, rijackson wrote:
>On 7/20/2009 6:43:32 PM, philipoakley
>wrote:
>
>>Computer algebra doesn't
>>always succeed, and is
>>occasionally wrong
>
>In this case it's wrong. MuPad is
>unfortunately wrong too often,
>especially when it comes to integrals.
>
>Richard

I have been using MC13 until a year ago and I was pretty happy with it. I have been using MC14 in the past 11 months because my new company ordered MC for me after I started and it turned out to version 14. Is it ever possible to get version 13 mailing back the cd of MC14?

Mark.
RichardJ
19-Tanzanite
(To:mark_neil2)

On 7/20/2009 7:33:08 PM, mark_neil wrote:

> Is it ever possible to get
>version 13 mailing back the cd of MC14?

I doubt it. On the upside though, although the symbolic processor in 14 is notably worse than the one in 13, in almost all other respects 14 is better than 13.

Richard



>takes a different viewpoint...<<br> ________________________________

The process outlined in the *.GIF (Originator) is conceptually wrong and >takes a different viewpoint...<, i.e: the Fourier viewpoint. It might just be a 14 MuPad feature to conform to Fourier

jmG

Skipping all the controversy, this worksheet is made with MC14.MO and posted in MC11. However, I concentrate on the part getting Fourier transform coeffs., and substitute this worksheet instead for only that part. The original coeffs. were not found correctly.

This issue is now logged.

Mona

On 11/30/2009 6:36:52 PM, MonaZ wrote:
>This issue is now logged.
>
>Mona
___________________________

I have no time to review but like Theodore says" controversy".
How come I wrote:

"The process outlined in the *.GIF (Originator) is conceptually wrong and >takes a different viewpoint...<, i.e: the Fourier viewpoint. It might just be a 14 MuPad feature to conform to Fourier"
What it says in short: garbage = garbage out.
i.e: wrong setup [just read my *.gif]

jmG




Announcements

Top Tags