Skip to main content
1-Visitor
June 17, 2021
Solved

numerical solution of a differential equation

  • June 17, 2021
  • 1 reply
  • 3421 views

Hello,

 

I would like to solve the differential equation in the document. However, Mathcad can only calculate the values if I use a positive factor. In Python the values are calculated without any problems. What am I doing wrong? The problem exists in Mathcad 15, as well as in Prime 6.0.

Thank you very much for any hints.

Best regards

Paul

Best answer by Werner_E

Mathcad chokes on the different x-values in the initial conditions (0 for z but 4 for y).

Are you aware that the second argument of the odesolve function is the endvalue for x?

The start value is taken from the initial conditions and so Mathcad runs  into troubles if it encounters two different "start" values.

Here is what you get with 0 as the start value for both (and 4 as the endvalue). The last arguement of odesolve is the number of calc steps and is optional.

Werner_E_0-1623951368065.png

 

1 reply

19-Tanzanite
June 17, 2021

Mathcad doesn't like the imaginary components you get from y(x)^0.8 when y goes negative. Taking the real part works ok:

 

g0.png

What does the Python result look like?

 

Alan

 

25-Diamond I
June 17, 2021

Here's another workaround

Werner_E_0-1623950286520.png

The root function is implemented in Mathcad so that it returns the real value, not the main root (the one with the smallest positive phase). Actually in math a power with a rational exponent is defined only for non-negative bases.

See for example

Werner_E_1-1623950359697.png