Hello,
I am using Adams to solve the differential equations as below but failed, may anyone could suggest how to solve it or should I use another equation.The error can only disappear when x was deleted in the equation.
.
,x from 0 to 10000
Thanks in advance.
PW
Solved! Go to Solution.
Your sheet is still missing - its not attached.
I see that you changed the initial value for x significantly now from 0 to 3600!
In Prime you would have to use the commands inside of a solve block!
The syntax for odesolve had changed, too, from legacy Mathcad to Prime (look it up in the help):
The attached file is in Format of Prime 6., so you should be able to open it with P7.
You have to write y(x), not just y.
Furthermore I guess you will run into problems because the right hand term is not defined for the start value x=0 (division by zero).
I changed the start value to x=10^-10 and it works OK.
Here done in Mathcad 15 using "odesolve" with Adams/BDF chosen as algorithm.
I let x only run up to 1000 - you can see that y approaches zero continually.
For further questions please attach your worksheet, not just a picture. And in case you are using Prime also state which version.
Thank you Werner,
Please fine my error enclosed.I am using Prime 7.0.
Thank for guiding me how to proceed.
PW
Your sheet is still missing - its not attached.
I see that you changed the initial value for x significantly now from 0 to 3600!
In Prime you would have to use the commands inside of a solve block!
The syntax for odesolve had changed, too, from legacy Mathcad to Prime (look it up in the help):
The attached file is in Format of Prime 6., so you should be able to open it with P7.
Should be more like in attached.
Notice how Prime handles solve blocks different from Mathcad (15 and before).
Success!
Luc
Dears,
I come back to this topic further more,How could I make the If program fuction in this Odesolve modle please.I use Prime 9.0 now.
Not sure what you want. Note that in your solve block, y is a function: y(x), described by the ODE, and dependent on c. Now it appears that you want c (that y depends on) to change depending on the value of y....?
I see a chicken<>egg problem.
Success!
Luc
I, too, see the chicken and egg problem mentioned by Luc 😉
I parametrized your solve block so you can create a solution for any given value of c.
Then I defined the two solution functions for c=1 and c=4 (y1 and y5).
Finally a function y was defined which equals y1 as long as its value is over 0.05 and then drops down to y5.
But I hardly can imagine that this is really what you are looking for ...
Prime 6 file attached
Here is a different approach with a similar result.
I used the if-function but of course you could as well use the program if-statement.
Still not sure if you are really looking for something like this.
Prime 6 file attached
This is exactly what I need,thank you both.
Had not seen your second posting with the file and in the meantime edited my answer above and added a file created in P6 (I never bothered to install P7 or P8).
Basically the same as what was posted by Luc - use a solve block and change the syntax of "odesolve".
BTW, Prime also allows units in a solve block with "odesolve" (legacy Mathcad didn't), so you should take advantage of Primes unit-awareness and use units, too.
The differential equation:
Has solution:
Now with:
we know c also.
So:
We can compare the numeric solution
with the exact solution:
The difference is:
Success!
Luc
Forgot to mention that in case you are using a current version of Prime, the ODE can also be solved symbolically
It also looks like we could add an initial condition
But the first attempt using a numeric value failed
Using 1/10 instead of 0.1 does the trick:
Using the prime symbol for the derivative you may even omit the function argument x, but I won't suggest doing so
May you upload your file for symbolical solution in your free time please,I am not able to proceed with the mistake below
Thanks
Prime 7 does not support solving differential equations symbolically. You have to upgrade to Prime 9 for that.
Success!
Luc
Thanks for your rapid reply Luc,
Also for your proffessional response for solve block/numeric solution last month.
You don't show the sheet and you don't say what the error message is you get, so we have to guess and either you forgot to clear y (at least for symbolical usage) before you solve symbolically (you can't solve for a variable or function which already is defined)
or its because you are still using Prime 7. Version 9 is the first one with the ability to solve ODEs symbolically. That's the reason why I wrote "Forgot to mention that in case you are using a current version of Prime, the ODE can also be solved symbolically".
For whatever its worth I nonetheless attach the P9 sheet with the symbolic solutions.