How to do Fourier Integrals on the HP Prime?
12-07-2019, 10:34 PM
Post: #1
 medwatt Junior Member Posts: 43 Joined: Jun 2015
How to do Fourier Integrals on the HP Prime?
Hello,

I want to do Fourier Integrals (not Fourier Series) on the Prime but there doesn't to be a function for that. I'm surprised that a calculator as powerful as the Prime doesn't have a built in function for this when there is one already for Laplace Transforms. The HP 50g can do Fourier Transforms. Is there some app out there that can add this functionality to the Prime ?
12-08-2019, 07:02 AM (This post was last modified: 12-08-2019 07:46 AM by Stevetuc.)
Post: #2
 Stevetuc Member Posts: 251 Joined: Jan 2014
RE: How to do Fourier Integrals on the HP Prime?
(12-07-2019 10:34 PM)medwatt Wrote:  Hello,

I want to do Fourier Integrals (not Fourier Series) on the Prime but there doesn't to be a function for that. I'm surprised that a calculator as powerful as the Prime doesn't have a built in function for this when there is one already for Laplace Transforms. The HP 50g can do Fourier Transforms. Is there some app out there that can add this functionality to the Prime ?

I tried this in cas mode
Code:
 1/(√(2*π))*int(e^(i*w*t),t)

The result on max simplification

Code:
 (-i)*√(2*π)*e^(i*t*w)/(2*π*w)

Which (I think ) is the deltadirac function and the correct result for fourier transform of 1 (see wolfram screenshots attached)
The prime doesnt recognise the above as a deltadirac (although there is a builtin Dirac) It may be helpful to define as a cas substitution to simplify results. I havent tried this yet.

Code:
 1/(√(2*π))*int(Dirac(t)*e^(i*w*t),t,-(∞),∞)

Gives correct result of
Code:
 1/√(2*π)
Comparing to wolfram.

12-08-2019, 08:28 AM
Post: #3
 Stevetuc Member Posts: 251 Joined: Jan 2014
RE: How to do Fourier Integrals on the HP Prime?
(12-08-2019 07:02 AM)Stevetuc Wrote:
(12-07-2019 10:34 PM)medwatt Wrote:  Hello,

I want to do Fourier Integrals (not Fourier Series) on the Prime but there doesn't to be a function for that. I'm surprised that a calculator as powerful as the Prime doesn't have a built in function for this when there is one already for Laplace Transforms. The HP 50g can do Fourier Transforms. Is there some app out there that can add this functionality to the Prime ?

I tried this in cas mode
Code:
 1/(√(2*π))*int(e^(i*w*t),t)

The result on max simplification

Code:
 (-i)*√(2*π)*e^(i*t*w)/(2*π*w)

Which (I think ) is the deltadirac function and the correct result for fourier transform of 1 (see wolfram screenshots attached)
The prime doesnt recognise the above as a deltadirac (although there is a builtin Dirac) It may be helpful to define as a cas substitution to simplify results. I havent tried this yet.

Code:
 1/(√(2*π))*int(Dirac(t)*e^(i*w*t),t,-(∞),∞)

Gives correct result of
Code:
 1/√(2*π)
Comparing to wolfram.

Actually I see there is an e^-itw term missing in the result of my first example compared to wolfram, which may be the reason the cas doesn't recognise the result as a dirac()
12-08-2019, 11:40 AM (This post was last modified: 12-14-2019 07:42 AM by Stevetuc.)
Post: #4
 Stevetuc Member Posts: 251 Joined: Jan 2014
RE: How to do Fourier Integrals on the HP Prime?
Here are two methods on the prime to get same result as the fourier integral on page 16_46 of Hp50g AUG

Modified laplace transform of e^(-t)
Code:
 1/(√(2*π))*subst(laplace(e^(-t),t,s),s = (i*w))

Integral
Code:
 1/(√(2*π))*int(e^(-t)*e^(-(i)*w*t),t,0,∞)

Both give result
Code:
 1/(√(2*π)*(i*w+1))

Simplify set to minimum

Ive verified that both forms agree for e^(-t)*sin(t) too.

12-08-2019, 03:18 PM
Post: #5
 medwatt Junior Member Posts: 43 Joined: Jun 2015
RE: How to do Fourier Integrals on the HP Prime?
(12-08-2019 11:40 AM)Stevetuc Wrote:  Simplify set to minimum

Ive verified that both forms agree for e^(-t)*sin(t) too.

Hello. Thanks for your reply. What you're doing is not calculating the Fourier Transform. It is easy to get the Fourier Transform from the Laplace Transform if we restrict our function to just one side of the plane (left-sided or right sided). If a function is left-sided or right-sided then to get the Fourier Transform, you evaluate the Laplace Transform and then substitute s=jw or s=-jw. This is what you seem to be doing. But what about the Fourier Transform of a dc signal which goes from -inf to +inf ? How do you calculate that ? Or how do calculate the FT of e^(j*2*t) ?
12-08-2019, 03:30 PM
Post: #6
 Stevetuc Member Posts: 251 Joined: Jan 2014
RE: How to do Fourier Integrals on the HP Prime?
(12-08-2019 03:18 PM)medwatt Wrote:
(12-08-2019 11:40 AM)Stevetuc Wrote:  Simplify set to minimum

Ive verified that both forms agree for e^(-t)*sin(t) too.

Hello. Thanks for your reply. What you're doing is not calculating the Fourier Transform. It is easy to get the Fourier Transform from the Laplace Transform if we restrict our function to just one side of the plane (left-sided or right sided). If a function is left-sided or right-sided then to get the Fourier Transform, you evaluate the Laplace Transform and then substitute s=jw or s=-jw. This is what you seem to be doing. But what about the Fourier Transform of a dc signal which goes from -inf to +inf ? How do you calculate that ? Or how do calculate the FT of e^(j*2*t) ?

Thanks for your response. I simply followed the Fourier Transform examples in the AUG. You mentioned in your first post that "The HP 50g can do Fourier Transforms". I assume you have 50g code examples that cover the cases you mention above. Can you share them?
12-08-2019, 03:43 PM
Post: #7
 medwatt Junior Member Posts: 43 Joined: Jun 2015
RE: How to do Fourier Integrals on the HP Prime?
(12-08-2019 03:30 PM)Stevetuc Wrote:
(12-08-2019 03:18 PM)medwatt Wrote:  Hello. Thanks for your reply. What you're doing is not calculating the Fourier Transform. It is easy to get the Fourier Transform from the Laplace Transform if we restrict our function to just one side of the plane (left-sided or right sided). If a function is left-sided or right-sided then to get the Fourier Transform, you evaluate the Laplace Transform and then substitute s=jw or s=-jw. This is what you seem to be doing. But what about the Fourier Transform of a dc signal which goes from -inf to +inf ? How do you calculate that ? Or how do calculate the FT of e^(j*2*t) ?

Thanks for your response. I simply followed the Fourier Transform examples in the AUG. You mentioned in your first post that "The HP 50g can do Fourier Transforms". I assume you have 50g code examples that cover the cases you mention above. Can you share them?

It was actually a mistake. I assumed the 50g can do Fourier Transforms because I saw a function called "Fourier". Apparently, it's just Fourier Series. I find it ironical that the Prime's CAS is based on Giac/Xcas whose website is: https://www-fourier.ujf-grenoble.fr/~parisse/giac.html. The website literally has "Fourier" in it and you would expect that a function for the Fourier Transform is implemented, but it isn't. I can't understand why HP ignores FT. It's super important for people in Electrical Engineering.
12-08-2019, 04:28 PM (This post was last modified: 12-08-2019 04:29 PM by Stevetuc.)
Post: #8
 Stevetuc Member Posts: 251 Joined: Jan 2014
RE: How to do Fourier Integrals on the HP Prime?
(12-08-2019 03:43 PM)medwatt Wrote:
(12-08-2019 03:30 PM)Stevetuc Wrote:  Thanks for your response. I simply followed the Fourier Transform examples in the AUG. You mentioned in your first post that "The HP 50g can do Fourier Transforms". I assume you have 50g code examples that cover the cases you mention above. Can you share them?

It was actually a mistake. I assumed the 50g can do Fourier Transforms because I saw a function called "Fourier". Apparently, it's just Fourier Series. I find it ironical that the Prime's CAS is based on Giac/Xcas whose website is: https://www-fourier.ujf-grenoble.fr/~parisse/giac.html. The website literally has "Fourier" in it and you would expect that a function for the Fourier Transform is implemented, but it isn't. I can't understand why HP ignores FT. It's super important for people in Electrical Engineering.

Agreed.
The Laplace Transform on the prime is singlesided, but the integration method I also showed can be used from -inf to +inf
Problems arise with evaluating a dc value over this range. It is not integrable as result is infinite. Standard methods multiple with a dirac function to allow integration.
https://youtu.be/uQkCar2SbVY
Then
Code:
 1/(√(2*π))*int(dc*Dirac(t)*e^(-i*w*t),t,-∞,∞)
Gives result
Code:
 dc/√(2*π)
12-09-2019, 12:23 PM
Post: #9
 Stevetuc Member Posts: 251 Joined: Jan 2014
RE: How to do Fourier Integrals on the HP Prime?
https://www.hpcalc.org/details/9041

Quote:Performs symbolic time to frequency and frequency to time calculations: calculates for a given symbolic f(t) Fourier, Laplace and Z-transformation in symbolic form, draws the complex Laplace function together with the Fourier transformation slice as a 3D plot, and calculates for a given frequency transfer function the unity pulse, dirac pulse response and bode magnitude and phase in symbolic form. Includes PDF documentation.

It uses the following to calculate the Fourier transform

Code:
 //   // Function.F2 Fourier( f(t) ) = ABS( laplace( f(t) ) with (i*X) as independant ) //   ABS(simplify(laplace(F1(x),x))) //   subst('  ',('x') = ('i*X')) //
12-09-2019, 04:09 PM
Post: #10
 John Keith Senior Member Posts: 704 Joined: Dec 2013
RE: How to do Fourier Integrals on the HP Prime?
Note that the 50g does have numeric fast Fourier transform and its inverse. I thought the Prime did too but I don't have mine with me.
Not sure if that is what you are looking for though.
12-09-2019, 08:22 PM
Post: #11
 medwatt Junior Member Posts: 43 Joined: Jun 2015
RE: How to do Fourier Integrals on the HP Prime?
(12-09-2019 12:23 PM)Stevetuc Wrote:  https://www.hpcalc.org/details/9041

Quote:Performs symbolic time to frequency and frequency to time calculations: calculates for a given symbolic f(t) Fourier, Laplace and Z-transformation in symbolic form, draws the complex Laplace function together with the Fourier transformation slice as a 3D plot, and calculates for a given frequency transfer function the unity pulse, dirac pulse response and bode magnitude and phase in symbolic form. Includes PDF documentation.

It uses the following to calculate the Fourier transform

Code:
 //   // Function.F2 Fourier( f(t) ) = ABS( laplace( f(t) ) with (i*X) as independant ) //   ABS(simplify(laplace(F1(x),x))) //   subst('  ',('x') = ('i*X')) //

This is just evaluating the Laplace Transform at s=jw. The Laplace Transform used on the Prime is the single-sided LT, meaning it evaluates the integral from 0 to inf. You can use this LT to get the FT if you have a function that is right-sided. What happens if you want the FT of functions such as sin(wt), a dc signal, that span the the entire time domain ? Well, it's not possible.
12-09-2019, 08:45 PM
Post: #12
 Stevetuc Member Posts: 251 Joined: Jan 2014
RE: How to do Fourier Integrals on the HP Prime?
(12-09-2019 08:22 PM)medwatt Wrote:
(12-09-2019 12:23 PM)Stevetuc Wrote:  https://www.hpcalc.org/details/9041

It uses the following to calculate the Fourier transform

Code:
 //   // Function.F2 Fourier( f(t) ) = ABS( laplace( f(t) ) with (i*X) as independant ) //   ABS(simplify(laplace(F1(x),x))) //   subst('  ',('x') = ('i*X')) //

This is just evaluating the Laplace Transform at s=jw. The Laplace Transform used on the Prime is the single-sided LT, meaning it evaluates the integral from 0 to inf. You can use this LT to get the FT if you have a function that is right-sided. What happens if you want the FT of functions such as sin(wt), a dc signal, that span the the entire time domain ? Well, it's not possible.

Yes indeed. I shared the above code fragment to make that fact clear!
You may have to move back to TI or Casio, assuming you have an app that meets your needs or Wolfram.
12-09-2019, 09:54 PM (This post was last modified: 12-09-2019 09:55 PM by medwatt.)
Post: #13
 medwatt Junior Member Posts: 43 Joined: Jun 2015
RE: How to do Fourier Integrals on the HP Prime?
(12-09-2019 08:45 PM)Stevetuc Wrote:
(12-09-2019 08:22 PM)medwatt Wrote:  This is just evaluating the Laplace Transform at s=jw. The Laplace Transform used on the Prime is the single-sided LT, meaning it evaluates the integral from 0 to inf. You can use this LT to get the FT if you have a function that is right-sided. What happens if you want the FT of functions such as sin(wt), a dc signal, that span the the entire time domain ? Well, it's not possible.

Yes indeed. I shared the above code fragment to make that fact clear!
You may have to move back to TI or Casio, assuming you have an app that meets your needs or Wolfram.

Thanks, man. I appreciate the effort. There's a package for Laplace Transform for the Ti-89 which I've modified to do the Fourier Transform. The Casio Classpad II can do FT natively but I'm not a fan of it as it is barely has any hardware keys and therefore makes no sense buying it when you can just install any one of the myriad calculator applications on Android.
12-10-2019, 09:28 AM (This post was last modified: 12-10-2019 12:57 PM by Stevetuc.)
Post: #14
 Stevetuc Member Posts: 251 Joined: Jan 2014
RE: How to do Fourier Integrals on the HP Prime?
(12-09-2019 09:54 PM)medwatt Wrote:
(12-09-2019 08:45 PM)Stevetuc Wrote:  Yes indeed. I shared the above code fragment to make that fact clear!
You may have to move back to TI or Casio, assuming you have an app that meets your needs or Wolfram.

Thanks, man. I appreciate the effort. There's a package for Laplace Transform for the Ti-89 which I've modified to do the Fourier Transform. The Casio Classpad II can do FT natively but I'm not a fan of it as it is barely has any hardware keys and therefore makes no sense buying it when you can just install any one of the myriad calculator applications on Android.

I took a look at the classpad app. It has an impressive range of options for the fourier transform, allowing interactive input of the indep var and parameter and different style of formulation such as pure math, physics and signal processing.
Results agree with wolfram and it recognises that for a dc signal, or a unit pulse as T/2 -> inf that the sinc function -> deltadirac.

That isnt possible currently on the prime. If you take the fourier integral of a pulse -T/2 to +T/2 in the limit as T ->inf the result is undefined.
Code:
∫(e^(-i*w*t),t,-τ/2,τ/2)
gives
Code:
(i*e^((−i)*w*τ/2)+(−i)*e^(i*w*τ/2))/w
which are sinc functions, but if you take the limit as τ ->inf the result is undef. The classpad and wolfram both recognise the limiting case of a sinc fn to be a delta.

I also looked at ti89 function lapl.89f.
https://www.ticalc.org/archives/files/fi...44290.html
It looks pretty basic (nopun).
Code:
 [….] If inString(string(∫(fx*e^(-p*var),var)),"∫")=0 Then  ∫(fx*e^(-p*var),var)->lf limit(lf,var,∞)->ilf [….]
Is that the program you modified? Maybe this could be ported to the prime or the hpcalc.org spect program I posted earlier could be modified to use integral form instead of single sided laplace.
12-10-2019, 09:40 AM (This post was last modified: 12-10-2019 09:46 AM by Simone Cerica.)
Post: #15
 Simone Cerica Member Posts: 60 Joined: Mar 2014
RE: How to do Fourier Integrals on the HP Prime?
(12-09-2019 04:09 PM)John Keith Wrote:  Note that the 50g does have numeric fast Fourier transform and its inverse. I thought the Prime did too but I don't have mine with me.
Not sure if that is what you are looking for though.

I am Italian and my English is poor, but I never understood why English native speakers sometimes confuse the various types of Fourier transform!

@medwatt refers unequivocally to the "continuous-time fourier transform", also called "Fourier integral" or more simply "Fourier transform":

https://en.wikipedia.org/wiki/Continuous..._transform = https://en.wikipedia.org/wiki/Fourier_integral = https://en.wikipedia.org/wiki/Fourier_transform
fourier transform wolfram alpha

Unfortunately both the HP 50g and the HP Prime implement the classic Fourier series (fourier_an, fourier_bn, fourier_cn) and discrete fourier transform (DFT) (fft, ifft) but not the continuous-time Fourier transform.

Regards,
Simone
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)