Differential equations

Hello,
I’m new so haven’t done a lot of research on this site yet. So, I have dx/dt=f1(t,x,z), dy/dt=f2(t,y,z) where dx/dt and dy/dt have been coupled as shown by use of a third equation dz/dt=Adx/dt+Bdy/dt. My problem is that LibreOfficeCalc won’t do the math correctly in solving, simultaneously I guess, for x(t) and y(t) values due to incorrect Runge-Kutta coefficients K1,K2,K3,K4 (for x(t)) and L1,L2,L3,L4 (for y(t)). I have not ‘drag-copied’ the formulas for the individual time step rows, and am using absolute cell references in all formulas rather than range names. I have once obtained a graph with the exact shape of x(t) vs t, but the amplitude of x(t) doesn’t even get above 0.00 (to two decimals). Using a …mart HP laptop with Windows 11 OS. Should I expect success?? It also does fail as follows: When it computes the following non-RK constants in three cells as: 140,940,000 in cell T49, 563,760,000 in cell U49, and 281,880,000 in cell V49 and I then formulate in cell W49 the formula T49*U49-V49^2, W49 then shows 33,840, whereas my calculator says W49 should = 0.000. I guess I see the reason for the existence of programs like Matlab, which I don’t possess. Any advice??? Thanks

Please attach the spreadsheet, so we can see the actual formulas. In case the spreadsheet is large, reduce it as much as possible.

1 Like
OK. I misquoted the number above. I should have said "W49 then shows 67648, whereas......"

TDS BugAvoid ReDo RK4 Support.ods (72.0 KB)

And column labeled “c29” should rather be labeled as the variable “y(t)”.

I think, the error is in a magnitude you need to aspect for a spreadsheet that uses double in its calculations.
T49 has already 140940000.00006 instead of the assumed 140940000.
U49 has already 563760000.00024 instead of the assumed 563760000.
In such many-steps calculations I would not assume a better precision than 12 decimal digits, for shorter calculations up to 15 decimal digits.

Besides the in-built precision limit of data type double you should consider a phenomena called " Catastrophic cancellation". Sometimes you can increase precision when you use a different algorithm. However, I have not examined your spreadsheet, whether it contains affected formulas.

Yes. Some tasks require tools that are more specialized than a spreadsheet.

How do you mean “posses”?
There are free CAS. Maxima (wxMaxima) going back to MIT Macsyma is an example.
In the few cases I used it, however, I missed an interface to Calc.

See Apache OpenOffice Community Forum - Apache OpenOffice Community Forum

As demonstrated above, you must check step by step the required precisions of all coefficients.
 
TUV47

A respectably complex table!

I suspect it’s meant to calculate an RC network at f = 60 Hz. The alleged and correct difference of 67648 is, from an electronics perspective, very small and, roughly estimated relative to 281 million, represents a 2.4% tolerance, which is far more precise than any capacitive tolerance of a capacitor – and therefore negligible. Working with such numerical behemoths without evaluating the individual tolerance ranges of the complexly interconnected components, both with and against each other, is pointless and far removed from any circuit reality. There’s no calculation error herein [T49:V49]!

I haven’t analyzed where the ten-thousandths in [T49:U49] come from, but their tolerances are well below 0.001‰!

I haven’t unraveled the complex, interconnected relationships because I can’t understand how they work. However, I’m missing any consideration of component tolerances, and therefore the permissible range around the idealized line in the diagram.

My advice: use any simulation program from various manufacturers (TI, ADI, etc.).

For circuit simulation, I recommend QUCS I used a lot. It is FOSS and quite easy. It seems it has not been updated for a long time but works well on small projects like filters.