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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Create a function as ODEs solution

ValeryOchkov
24-Ruby IV

Create a function as ODEs solution

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

37 REPLIES 37

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

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.

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.

Not sure why you think you would need a second derivative to duplicate the result given by odesolve.

1) You don't need a 6 row vector to set up the ODE for rkfixed - as you are searching for four functions you just need four rows

2) the first column of the result is a time vector, so to duplicate the result of the solve block you have to plot the third colums over the second and not the second over the first.

BTW, the parameter (alpha) of your "function" Z has no effect, but I guess that you will change that later. Otherwise Z could be a simple variable.

05.12.png

Yeeeeees!

I forgot that first column is time not x.

Thanks a lot.

Werner Exinger wrote:

BTW, the parameter (alpha) of your "function" Z has no effect, but I guess that you will change that later. Otherwise Z could be a simple variable.

Yes!

dr0p-alpha.png

So the largest horizontal distance is achieved for a rather flat angle?

What about the envelope curve - is it something special?

05.12.png

Werner Exinger wrote:

So the largest horizontal distance is achieved for a rather flat angle?

What about the envelope curve - is it something special?

05.12.png

Yes, it is a fine ne task.

At Ro.air=0 we can have a symbolic solution. I think.

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.

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

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?

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

Thanks, I forgot this solution!

We can find it here http://communities.ptc.com/groups/dynamic-models-in-mathcad

Valery Ochkov wrote:

Thanks, I forgot this solution!

We can find it here http://communities.ptc.com/groups/dynamic-models-in-mathcad

I think the author of this method is Alan Svensen. Or?

Quite possible. At least some of his sheets have used that method as far as I remember.

Werner Exinger wrote:

Quite possible. At least some of his sheets have used that method as far as I remember.

I think the method with odesolve is not documented.

But same method with rkfixed is quite documented. Or?

I try do not remember not documented methods

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

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

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

Werner Exinger wrote:

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

Thanks, Werner - from one error to others!

Fred Kohlhepp wrote:

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

Thanks - units are units and pseudounits are pseudounits We cannot have this error in Prime

Thanks to all!

One joke in attach!

Oh, Valery.

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

Using "Oh" in this case as an implied "Oh gosh" as in act of amusement. All in good fun.

I already suspected that your goal would be an animation.

Here is another one

Werner Exinger wrote:

I already suspected that your goal would be an animation.

Yes, I think one solution one dynamic or kinematic problem without animation is not a (full) solution!

See please one more:

http://communities.ptc.com/groups/dynamic-models-in-mathcad

http://communities.ptc.com/groups/kinematic-models-in-mathcad

A propos - we have a dynamic and kinematic viscosity (of air) in our task.

Here is another one

Sorry, I cannot see it on my tablet, but hope it is very nice.

Why do you not use the Video block of PlanetPTC?

Why do you not use the Video block of PlanetPTC?

Because I consider it crap - I don't like those streaming flash animations. Most of the time they take longer to load (and sometimes won't load at all), they stall from time to time resulting in a jerky video and have less quality compared to the avi's produced by Mathcad directly. A big reason for avoiding them is that i cannot look at them frame by frame, back and forth, which is especially important for the animations we are dealing with here. Another drawback is that its not easy to save those videos for reference and offline viewing.

So I appreciate it if people simply attach the video file rather than using this forums video facility. They miss 10 points I think they would get otherwise if they upload a video, but then - I can't image that adults would care for those points anyway. What are they good for, or better asked, what can I turn them in for 😉

Sorry, I cannot see it on my tablet, but hope it is very nice.

So here it is inline

Video Link : 4521

Looks like it didn't work (did I say crap?). So its uploaded here: http://communities.ptc.com/videos/4522

Werner Exinger wrote:

Why do you not use the Video block of PlanetPTC?

Because I consider it crap - I don't like those streaming flash animations. Most of the time they take longer to load (and sometimes won't load at all), they stall from time to time resulting in a jerky video and have less quality compared to the avi's produced by Mathcad directly. A big reason for avoiding them is that i cannot look at them frame by frame, back and forth, which is especially important for the animations we are dealing with here. Another drawback is that its not easy to save those videos for reference and offline viewing.

So I appreciate it if people simply attach the video file rather than using this forums video facility. They miss 10 points I think they would get otherwise if they upload a video, but then - I can't image that adults would care for those points anyway. What are they good for, or better asked, what can I turn them in for 😉

Sorry, I cannot see it on my tablet, but hope it is very nice.

So here it is inline

See same video http://www.youtube.com/watch?v=8OzUInp03Qc

Top Tags