Skip to main content
24-Ruby IV
December 4, 2013
Solved

Create a function as ODEs solution

  • December 4, 2013
  • 5 replies
  • 13540 views

I try to create a user function as a ODEs solution for this task

http://communities.ptc.com/message/223872

I do not know how to do it with the odesolve function but I know how do it with the rkfixed function. But I do not remember how use rkfixed for this ODEs.

Help me please - the Mathcad Prime 3 sheet in attach.

Best answer by Werner_E

But why we cannot have x(t, alpha), y(t, alpha) etc for example by odesolve?

We can have what you demand, but its by no means advisable to do so because the whole Odesolveblock is evaluated again for every value of t.

od1.png

That approach may be OK for calculationg selected values or smaller tables, but not for plotting as the solveblock would have to be evaluated twice for every point calculated.

But maybe this is the time to (again) add vectors of functions to our wishlist for Mathcad Prime 20.0.

Its far more efficient to create different functions for plotting.

od2.png

5 replies

24-Ruby IV
December 4, 2013

May be so, but why I have an error - see te attach please - Prime 2.

25-Diamond I
December 4, 2013

Valery Ochkov wrote:

May be so, but why I have an error

Because you have used the local assignment operator (<--) instead of the "normal" (:=) one. That way Z() is not defined on the worksheet level.

24-Ruby IV
December 4, 2013

Werner Exinger wrote:

Valery Ochkov wrote:

May be so, but why I have an error

Because you have used the local assignment operator (<--) instead of the "normal" (:=) one. That way Z() is not defined on the worksheet level.

Thanks, but see the attach.

24-Ruby IV
December 5, 2013

Valery Ochkov wrote:

I try to create a user function as a ODEs solution for this task

http://communities.ptc.com/message/223872

I do not know how to do it with the odesolve function

And what about the first question - Can we use for it not the rkfixed but the odesolve function?

We can do it with the Given-Find Block.

19-Tanzanite
December 5, 2013

Valery Ochkov wrote:

Valery Ochkov wrote:

- Can we use for it not the rkfixed but the odesolve function?

We can do it with the Given-Find Block.

rkfixed returns numbers, odesolve returns a function. Can you do it with Given..Find when this is set up as a function?

Alan

24-Ruby IV
December 5, 2013

AlanStevens wrote:

Valery Ochkov wrote:

Valery Ochkov wrote:

- Can we use for it not the rkfixed but the odesolve function?

We can do it with the Given-Find Block.

rkfixed returns numbers, odesolve returns a function. Can you do it with Given..Find when this is set up as a function?

Alan

Thanks, Alan, I know it.

But why we cannot have x(t, alpha), y(t, alpha) etc for example by odesolve?

24-Ruby IV
December 5, 2013

Sorry, where is an arror in attach (MC 15) - in Prime all OK!

23-Emerald I
December 5, 2013

Your Reynold's Number is using density instead of viscosity. Fix that---it works!

25-Diamond I
December 5, 2013

and also change the sign before the gravity constant to make the water drops fall down 😉

24-Ruby IV
December 5, 2013

Thanks to all!

One joke in attach!

1-Visitor
December 5, 2013

Oh, Valery.

24-Ruby IV
December 6, 2013

Ryan Kelley wrote:

Oh, Valery.

Ryan, what is it oh in English. Sori, ai nou inglish not gud.

For me it would be better to see the PTC reaction on my joke about Prime 4 and a cat's tail

24-Ruby IV
February 19, 2014

We can create a function as a PDEs solution:

pdeD.png

19-Tanzanite
February 20, 2014

Valery Ochkov wrote:

We can create a function as a PDEs solution:

pdeD.png

Nice Valery, but probably not good practice to plot for a time beyond the end of the time (T) for which the PDE has been solved!

Alan