Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi all,
I am trying to figure out if it is (mathematically) possible to obtain a x(y) function via the following system with odesolve:
dx/dy=F(x)
Do you guys have a idea if it is possible in mathcad, and if so, how?
Solved! Go to Solution.
As x is your function and dependent on y, you have to always write x(y) and not just x!
And the initial condition can't be that of F but that of the function to solve for -> x(0)=...
After all, in your example F(0)=5 and not 4 🙂
The plots also show the exact symbolic solution of your ODE.
Give an example and post the initial worksheet please.
Here is an example done in MC15
If you use Prime keep in mind that solve blocks and the syntax for odesolve is different there.
So something like this. I want to plot x versus y, given the equations in the screenshot. (this is a simplified version of what i want to actually solve).
As x is your function and dependent on y, you have to always write x(y) and not just x!
And the initial condition can't be that of F but that of the function to solve for -> x(0)=...
After all, in your example F(0)=5 and not 4 🙂
The plots also show the exact symbolic solution of your ODE.
Allright, thank you for your response!
It is a relieving thought that such a system can be solved.
However, when I try to do it myself this error occurs:
Also I can't define F(x(y)) above the solve block, since prime doesn't allow me to add another bracket ((y)) between the F() bracket, is that the source of the error?
I see that you answer to allot of posts here, and I want to say thank you for that! I am sure that you helped so many people out (:
That you can't define a function with another function as argument is OK an normal. Its absolutely OK to define F(x):=3x+5 in front of the solve block. The x there is just a formal arguement anyway and so you can later call the function with any actual argument you like, also a function like x(y). You may as well define F(oops):=3*oops+5, it doesn't make any difference 😉
The problem with your solve block seems to be that your function is named x and you state the derivative with respect to x. As your function x is dependent on y you should use the derivative wrt y -> d/dy...
Look at my screenshot in my previous answer to see the difference.
You had not told us which version of Prime you are using. Hope you can read the attached Prime 6 file.
P.S.: I am not sure why you assigned the odesolve result to variable z. If you like you sure can also use x instead.
I was just wondering what happens when in the F function, y is also a variable. So like in the example in the screenshot below:
Is mathcad able to solve that aswell?
Then your differential equation becomes:
(This is what you should set in the Constraints section, or you define:
and your Constraint becomes:
).
The solution to that equation, with:
is:
Proof:
You can (also) check this result with your result of odesolve..
Success!
Luc
Hi,
Thanks for your response and indeed it works for the example system I proposed.
However, when I try it on my own system, it doesn't work and it gives the following error:
I cannot figure I what goes wrong...
The Worksheet is attached.
Thanks for your help in advance!
I already solved it, sorry!
@TW_9638511 wrote:
I already solved it, sorry!
So you found out yourself despite of the misleading error message that you forgot the function arguments here
But even with that correction the system won't solve up to 400 because there seems to be a vertical asymptote around 61
Maybe some error in your model/equations?
BTW, why don't you take advantage of Primes capability to work with units?
Becomes very unstable for H.L values above 60:
Success!
Luc
Interesting! I can't go much further than 60.9568 without getting an unknown exception error.
The values you show at the end are much larger and in Prime we get no negative values.
The ripple in the left picture is because of the larger step width:
EDIT: Long time no see - now after a long while I once again experience the forum error
I have no idea why I could upload this pic of the error message but the picture from the Prime sheet still fails - both were made with the very same screenshot software using the same procedure ...
I'll post a follow up with the pic.
So here is the pic which I wasn't able to include in my last post: