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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Floating point error in Transfer Matrix

g1lai
1-Newbie

Floating point error in Transfer Matrix

I am using a transfer matrix method to do optical calculation, and encountered a floating point error when Ds, which is related to refractive index, thickness and wavelength, is out of range. Is there any way to solve this problem without changing my optical model? tx.
59 REPLIES 59
StuartBruff
23-Emerald II
(To:g1lai)

On 5/29/2009 3:21:14 PM, g1lai wrote:
== I am using a transfer matrix method to do optical calculation, and encountered a floating point error when Ds, which is related to refractive index, thickness and wavelength, is out of range. Is there any way to solve this problem without changing my optical model? tx.

The easiest way I can think of without thinking about it is to redefine cos and sin to act on the modulus of their arguments wrt 2π

By using Math styles you can still get at the original definitions.

Stuart


deleted

Without thinking about it is right. Complex numbers are numbers, not pairs of independent real numbers. You cannot apply the mod function separately to the real and imaginary parts and get anything meaningful.

The period of the sine function is 2π. Thus you can add any multiple of 2π to the argument and keep the same result. The sine function is not perioding in the imaginary direction, and adding a multiple of 2πi does not preserve the value of the sine.
__________________
� � � � Tom Gutman
StuartBruff
23-Emerald II
(To:TomGutman)

On 5/29/2009 5:39:58 PM, Tom_Gutman wrote:
== Without thinking about it is right.

Yes. You're right.
RichardJ
19-Tanzanite
(To:g1lai)

What are the units for wavelength and d_Ag (I assume the thickness of a silver layer)?

Richard

As written, no. Your problem is an overflow due to the imaginary part of the argument to the trig functions being too large. The numbers you are looking for are simply not representable using the normal floating point.

But Richard may have identified the problem. You are not using units. That makes the validity of all of your equations open to question. It is possible that the reason for the out of range numbers is simply that the units are wrong. Note that the coefficients in polynomial approximations are not dimensionless, and do in fact have units.
__________________
� � � � Tom Gutman

On 5/29/2009 5:46:32 PM, Tom_Gutman wrote:
>But Richard may have
>identified the problem. You
>are not using units. That
>makes the validity of all of
>your equations open to
>question.

Yup. By looking up tabulated values of N & K for silver, I can infer that the dispersion equations in the sheet assume the wavelength is given in nanometers.

With this as the assumed unit, the value for d_Ag means that the thickness of the silver film is 25 microns.

Since the matrix being calculated is related to the propagation of light all the way through the film, and because 25 microns is far, far too thick for visible light to penetrate, the equations naturally blow up.

All is well if d_Ag is set to a value of 25 ... nanometers.

Using units definitely helps here,

- Guy

>>In mathematics, therefore in numerical approximation of functions, the argument to cos(x) must be real.<<

Balderdash. The trigonometric functions are all properly defined over the entire complex plane. I respectfully recommend taking a course in functions of a complex variable.
__________________
� � � � Tom Gutman
StuartBruff
23-Emerald II
(To:TomGutman)

On 5/29/2009 7:25:27 PM, jmG wrote:
>= ...

On 5/29/2009 8:16:17 PM, stuartafbruff wrote:
>On 5/29/2009 7:25:27 PM, jmG wrote:
>>= ...
_____________________

I wrote nothing, deleted all.

1. Let Tom Gutman do it as he seems so willing.
2. A work sheet w/o a single words of description deserves no help.
3. It was not saved 11, but tanks Stuart for letting me read.
4. Too many problems in that sheet + optics incoherence.

I might read again ... I have no time to reconstruct an entire work sheet from scratch w/o informations. Simply correct for the red error message as required.

jmG




The Ag layer is 25 micron. I did see that the error message was gone if a thin thickness was used. However, I have another layer (silicon) in the model which has very high k at short wavelength. The same error message appeared in the corresponding matrix for Si. I can reduce the wavelength range to make MathCAD happy, but it does not seem to be a solution for me.

Calculate the expected values by hand, for at least a few representative points. You don't need to be very exact in this, pretend you're still working with a slide rule and get just an orer of magnitude estimate. Compare that with the capabilities of the floating point representation used by Mathcad.
__________________
� � � � Tom Gutman

On 5/30/2009 1:31:54 AM, g1lai wrote:
>The Ag layer is 25 micron. I
>did see that the error message
>was gone if a thin thickness
>was used. However, I have
>another layer (silicon) in the
>model which has very high k at
>short wavelength. The same
>error message appeared in the
>corresponding matrix for Si. I
>can reduce the wavelength
>range to make MathCAD happy,
>but it does not seem to be a
>solution for me.
_____________________________

Your problem is not there, your problem is at the similar green Q in your work sheet. That should solve better than the slide rule ! You have introduced something in N6 that you don't handle properly vis Fourier & vis what it needs 'L', where L is "something", i.e: the period (if you have catched my previous work sheet now deleted). What I'm saying, you are trying to reconstruct a function via Fourier but you don't know the period, so you are going nowhere even with a slide rule.

This attachment is for:

1. The two Fourier forms: trig & complex.
2. Start learning about using Fourier polynomials.
3. ... as well as Re(,) for the suite in reference to N6.
4. force you to define "something"

jmG



StuartBruff
23-Emerald II
(To:g1lai)

On 5/30/2009 1:31:54 AM, g1lai wrote:
== The Ag layer is 25 micron. I did see that the error message was gone if a thin thickness was used. However, I have another layer (silicon) in the model which has very high k at short wavelength. The same error message appeared in the corresponding matrix for Si. I can reduce the wavelength range to make MathCAD happy, but it does not seem to be a solution for me.

As Tom's messages is hinting at, it's not a question of making Mathcad happy - your equations result in large numerical values, well beyond the capabilities of most numeric applications.

Using the symbolic processor gives result, but ...

Lunkwill: Do you...
Deep Thought: Have an answer for you? Yes. But you're not going to like it.

... unless, of course, I've made another hideously non-sentient blunder 🙂

Stuart

Why bother with the extra definition of the sine and cosine? The symbolic processor is quite at home with complex numbers. Of course, when you want a floating point answer rather than an exact symbolic expression you have to use the float keyword ...
__________________
� � � � Tom Gutman
StuartBruff
23-Emerald II
(To:TomGutman)

On 5/30/2009 7:09:34 AM, Tom_Gutman wrote:
== Why bother with the extra definition of the sine and cosine? The symbolic processor is quite at home with complex numbers. Of course, when you want a floating point answer rather than an exact symbolic expression you have to use the float keyword ..

Because my M14 wasn't numerically evaluating the cos & sin terms whereas my exp-based version were (provided I used a float representation for the arguments).

I've reloaded it and now the symbolic processor is numerically evaluating the built-in cos & sin just fine ... I give in, I'm obviously having a bad math week 😞 (probably to make up for actually solving a real-life reliability calculation on Wednesday)

Stuart

On 5/30/2009 9:28:26 AM, stuartafbruff wrote:
>... I give in, ...

>Stuart
_______________________

Stuart, please don't give in !

Users must accept maths as they are provided in their computing machinery. My first point here is that Mathcad does NOT compute cos(,), Pentium does, except if Mathcad is instructed otherwise and that is not the case in the work sheet. Therefore, cos(,) takes a real argument and not a slide rule argument or else invention. I have no competence wrt the optics involved, there are gurus-cracks about that matter in this forum. But the argument in the cos(,) in this work sheet is wrong and that's it, despite some previous detraction.

Thanks Stuart for your repost of the work sheet,
the attached is my annotation to your repost.
Does the green cos(,) solves the matrix collection ?

Jean




On 5/30/2009 1:31:54 AM, g1lai wrote:
>The Ag layer is 25 micron. I
>did see that the error message
>was gone if a thin thickness
>was used. However, I have
>another layer (silicon) in the
>model which has very high k at
>short wavelength. The same
>error message appeared in the
>corresponding matrix for Si. I
>can reduce the wavelength
>range to make MathCAD happy,
>but it does not seem to be a
>solution for me.
_______________________________

What you have experimented is no proof that it corrects your wrong cos(,) as explained and exemplified in my posting last minute ago. Please review your trigonometry and Fourier complex.

jmG



GuyB
2-Guest
(To:g1lai)

On 5/30/2009 1:31:54 AM, g1lai wrote:
>The Ag layer is 25 micron. I
>did see that the error message
>was gone if a thin thickness
>was used. However, I have
>another layer (silicon) in the
>model which has very high k at
>short wavelength. The same
>error message appeared in the
>corresponding matrix for Si. I
>can reduce the wavelength
>range to make MathCAD happy,
>but it does not seem to be a
>solution for me.

No, it's not a good solution, but that's because you're trying to compute the wrong thing.

I can't be sure what it is you're trying to compute, but it can't be the actual transmission through such a thick layer of silver or any other material with such a high loss coefficient. You should simply set the transmission to zero.

Jean - I've tried to include a full explanation in the enclosed sheet just for you,

- Guy

On 5/30/2009 9:10:50 PM, GuyBeadie wrote:
>On 5/30/2009 1:31:54 AM, g1lai wrote:
>>The Ag layer is 25 micron....
.....
>Jean - I've tried to include a full
>explanation in the enclosed sheet just
>for you,
>
> - Guy
________________________

Oh ! thank you so much for that nice introduction. I will read again and learn from it. An about identical conclusion comes out from the FourierInverseIntegral, given the Real & Imaginary coefficients from the n_Ag & k_Ag. The conclusion was that the "Fourier period" or whatever it might otherwise physically mean, was about non sense for a function to come out.
In other words: the ns6 (under SQRT) and Ds6 will always be complex by the introduced definition of N6. The point about the error message was and still is the fact that further it can't be used as complex in cos(,)... Ds6 would have to be |Ds6| or Real(,,,). The definition of N6 represents the extracted DFT coefficients for the FourierInverseIntegral, no matter where those coefficients originate from, whether from DFT or from a referenced source that corresponds to the true original physical experiment.

The attached sheet was never posted, but can be used in many instances of Fourier applications... continuous or discrete. A memo tool and refresher.

Jean
RichardJ
19-Tanzanite
(To:GuyB)

If you took all the light from all the stars in the universe you could knock off about 23 orders of magnitude. Only another 733 orders of magnitude to go 🙂

Richard
g1lai
1-Newbie
(To:RichardJ)

Jean,

My purpose is to calculate the contribution of imaginary part to the system.

Your notes are very helpful. Sorry MathCAD, it is Pentium's fault.
RichardJ
19-Tanzanite
(To:g1lai)

On 5/30/2009 1:31:54 AM, g1lai wrote:
>The Ag layer is 25 micron. I
>did see that the error message
>was gone if a thin thickness
>was used. However, I have
>another layer (silicon) in the
>model which has very high k at
>short wavelength. The same
>error message appeared in the
>corresponding matrix for Si. I
>can reduce the wavelength
>range to make MathCAD happy,
>but it does not seem to be a
>solution for me.

Perhaps we should back up a bit. Can you tell us more about your system and exactly what it is you are trying to calculate?

Richard
g1lai
1-Newbie
(To:RichardJ)

My system is basically a Si solar cell (200 micron thick) on back contact metal (25 micron Ag). In the real case, the below bandgap light will penetrate through Si and reflected from the Ag layer. I will then calculate the electromagnetic intensity at individual layer.

My question is about the thick Ag layer, but actually I am really interested in the thick Si layer. Unfortunately, the transfer matrix does not seem to work for the thick layer.
IRstuff
3-Visitor
(To:g1lai)

On 5/31/2009 10:52:21 PM, g1lai wrote:
>My system is basically a Si
>solar cell (200 micron thick)
>on back contact metal (25
>micron Ag). In the real case,
>the below bandgap light will
>penetrate through Si and
>reflected from the Ag layer. I
>will then calculate the
>electromagnetic intensity at
>individual layer.
>
>My question is about the thick
>Ag layer, but actually I am
>really interested in the thick
>Si layer. Unfortunately, the
>transfer matrix does not seem
>to work for the thick layer.

Well, I'm confused. I presume that "below bandgap" refers to wavelengths below 1200 nm. However, as shown in http://pvcdrom.pveducation.org/SEMICON/ABSDEPTH.HTM wavelengths above 800 nm are essentially nonparticipatory in solar cell operation, because the absorption needs to close to the junction to do anything useful in conversion. Photons absorbed away from the junction will tend to recombine before they can reach the junction, assuming that the photocarriers are even headed in the right direction.

TTFN,
Eden
IRstuff
3-Visitor
(To:IRstuff)

Note that the absorption depth and solar cell efficiency are inversely related. A large absorption depth means absurdly poor conversion efficiency. Anything between 5 microns and 50 microns are essentially useless as well, since less than 0.03% is even making it back from the back surface. Anything beyond 50 micron absorption depth is also pointless to worry about, because the effective conversion efficiency is quite poor, as the percentage of photons absorbed in the vicinity of the junction is absurdly low.

The only photons of any real interest in front-side, unthinned solar cells are below about 700 nm.

A thinned solar cell would pull in photons out past 800 nm, but the effective conversion efficiency is still quite poor.


TTFN,
Eden
g1lai
1-Newbie
(To:IRstuff)

Eden,

Look the solar irradiation spectrum (http://blaskarm.wordpress.com/2007/09/14/lets-face-the-truth-about-climate-change-mitigation-i/), the sun deliver 1000W/m^2 to the earth. Solar cell is capable of converting some solar power into electricity. The rest will generate heat which affect the cell performance. I want to figure out how much electricity and how much heat for Si solar cell.

The PN junction is around 1-2 micron, so the cut-off wavelength is ~400nm instead of 800nm. BTW, if the solar cell is not able to harvest visible light --- the majority of solar irradiation (see the solar spectrum), the PV industry won't be so "hot".
IRstuff
3-Visitor
(To:g1lai)

On 6/1/2009 10:08:52 AM, g1lai wrote:
>Eden,
>
>Look the solar irradiation
>spectrum
>(http://blaskarm.wordpress.com
>/2007/09/14/lets-face-the-trut
>h-about-climate-change-mitigat
>ion-i/), the sun deliver
>1000W/m^2 to the earth. Solar
>cell is capable of converting
>some solar power into
>electricity. The rest will
>generate heat which affect the
>cell performance. I want to
>figure out how much
>electricity and how much heat
>for Si solar cell.
>
>The PN junction is around 1-2
>micron, so the cut-off
>wavelength is ~400nm instead
>of 800nm. BTW, if the solar
>cell is not able to harvest
>visible light --- the majority
>of solar irradiation (see the
>solar spectrum), the PV
>industry won't be so "hot".

You used the term "below bandgap", which is a LONG way from 400nm. If you look at the absorption curves, you will see that the absorption depth of visible light is completely compatible with a front side illuminated junction.

Additionally, if you peruse any Si camera spectral response, you will see that Si has a peak response around 800 nm. Therefore, the only issue is the absorption depth, which I did not see in your original posting.



TTFN,
Eden
g1lai
1-Newbie
(To:g1lai)

jmG,

I am actually spend much time reading your worksheet, but still have hard time to define "something" (the period if I understand correctly) --- you won't expect I can know math as great as you, will you?

Apparently all your collabs are gentle and nice (very different from NK -:), could you post your solution?
g1lai
1-Newbie
(To:g1lai)

The Si solar cell is able to harvest solar energy in the range from 400-1000nm.
Top Tags