Skip to main content
19-Tanzanite
June 17, 2024
Question

Odesolve bug? Another bug?

  • June 17, 2024
  • 3 replies
  • 7778 views

Hi,

Change variable a from below and look at the V2(t)...Why odesolve block is behaving like this? Is it normal?
Prime 10 file attached.
The expected behaviour is like a =7.

Cornel_3-1718623701982.png

 

Cornel_4-1718623713461.png

 

Cornel_5-1718623726172.png

 

Cornel_6-1718623740384.png

 

Cornel_7-1718623753126.png

 

Cornel_9-1718623787557.png

 

Cornel_10-1718623800847.png

 

Cornel_11-1718623813812.png

3 replies

Cornel19-TanzaniteAuthor
19-Tanzanite
June 17, 2024

The above results are for this:

Cornel_0-1718624284243.png


IF I change to Fixed:

Cornel_1-1718624309283.png

Cornel_2-1718624319711.png

 

If I change to Adaptive:

Cornel_3-1718624347013.png

Endless running:

Cornel_4-1718624359101.png

 

And If I change to Radau:

Cornel_5-1718624391699.png

Cornel_6-1718624414390.png

Cornel_7-1718624425168.png

Cornel_8-1718624436386.png

 

From a=4 until a=8 its ok, but when a=9 not:

Cornel_9-1718624456486.png

 

a = 10, 11 - ok

a = 12 - NOT ok...


It seems that Radau doesn't make so many misses (at least in this example), and at least as not many as Adams/BDF does. 

Its a bug? Or what's happening?

15-Moonstone
June 17, 2024

The solution to this relatively simple initial value problem fails due to the discontinuity of the inhomogeneity. This means that "theoretically" there is no statement about the existence and uniqueness of the solution. Perhaps reformulating it as an integral equation will help. Numerically, less sensitivity can then be expected. Or the inhomogeneity can be approximated by a continuous function. However, MC would probably be unable to cope with this.

Cornel19-TanzaniteAuthor
19-Tanzanite
June 17, 2024

But we do not want to stay with differential eq form (derivative), and not to go to intergrals where odesolve block cannot be used?

Maybe Odesolve is not so good for this problem? I am not sure how could this problem can be translated to other methods of solving differential equations...maybe AdamsBDF Mathcad algorithm? But I do not know at this moment how to translate the above diff eq to others algorithm like AdamsBDF or others...

ttokoro
21-Topaz I
21-Topaz I
June 17, 2024

image.pngimage.pngimage.png

t.t.
Cornel19-TanzaniteAuthor
19-Tanzanite
June 17, 2024

We should maintain the values for C1 and R1 as there were defined initially, not to changed them...as we like..

Cornel_0-1718630756296.png

Cornel19-TanzaniteAuthor
19-Tanzanite
June 17, 2024

But anyway, the problem is still present even so:
Below is with Adams/BDF:

Cornel_3-1718631025861.png

 

Cornel_1-1718630910555.png

Cornel_2-1718630924977.png

 

And with Radau:

Cornel_4-1718631078969.png

 

For all a:0...12 the same results are maintained in this example with Radau:

Cornel_5-1718631092110.png

But as I said previously, we should not changed the values of components. We should have the initial values:

Cornel_6-1718631148857.png

 

23-Emerald IV
June 19, 2024

It's not an Odesolve BUG, it's just complications of numerically computing the voltages and currents, given the non-linear /discontinuous behaviour of the derivative of the diode function I(Vx).

There are other tools better equipped/specifically geared for this kind of calculations, e.g. LTspice:

LucMeekes_2-1718783894265.png

(a simple diode model with a breakdown voltage of 20 V) gives:

LucMeekes_1-1718783797413.png

And with the diode modelled per the I(Vx) function:

LucMeekes_3-1718783975030.png

we get virtually the same result:

LucMeekes_4-1718784006266.png

There are minute differences. The top line of V2 here sits at 0.7 V, while with the previous circuit it is at 0.8 V.

Note that the capacitor value is so small, it could just as well be left out. That would render a non-differential equation to be solved.

If the capacitor is increased significantly (as TTokoro did) you'd see some effect of it:

LucMeekes_5-1718784334482.pngLucMeekes_6-1718784352934.png

Success!
Luc

Cornel19-TanzaniteAuthor
19-Tanzanite
June 19, 2024

Luc, we are talking about a first order differential equation which needs to be solved numerically. 

We can see also in your simulation that the simulation algorithm can solve this differential eq in the end without problems, without missing any pulses. 

So, I am wondering If such reason with continuity/discontinuity is a reason in this case, as we can see other tools does not have problems in giving the correct solution/plot. 

Thus, that I said that maybe odesolve block algorithm in Mathcad is very weak or have some faulty behaviour. 

Then If we need to switch to other better tools even for such exercices, which is not so so so complicated (in the end it's a first order differential eq), then what calculations remains to do in Mathcad? Simple school equations? I am wondering why these guys from Mathcad it boasts that Mathcad is an engineering tool? As we can see that with this engineer math tool cannot solve a first order differential eq or a circuit with one resistor, one capacitor, one diode...I think engineering ÃŪs much more than this. I know that You and me cannot do anything even If I sau this, but .. 

But without having with us Mathcad development team...so that can give an answer even they...

@DJNewman