Syntax for Differential Equations Solver / desolve()???
|
09-04-2015, 06:22 PM
Post: #1
|
|||
|
|||
Syntax for Differential Equations Solver / desolve()???
Has anyone been able to figure out the proper syntax for the desolve() command? I have tried everything I can think of, and each time receive an error message "Error: Bad Argument Value"
Very simple example problem: y' = 2x + 4 Solution: y = x^2 + 4x + C However, desolve(y'=2x + 4, x, y) as well as desolve(y'=2x+4, y) both give the "Bad Argument Value" error message. In fact, so do the examples from the "Help" system, when I use the "Exampl" key to copy them into the command line to try them. Any advice? Thanks. |
|||
09-04-2015, 06:27 PM
Post: #2
|
|||
|
|||
RE: Syntax for Differential Equations Solver / desolve()???
Check that x or/and y are purged.
desolve(eqdiff) should work, you can omit x and y (the variables are required if they are not the default). |
|||
09-04-2015, 06:27 PM
Post: #3
|
|||
|
|||
RE: Syntax for Differential Equations Solver / desolve()???
When I do this without spaces it seems to work ok.
desolve(y'=x^2+4,x,y) evaluated to: desolve(diff(y)=x^2+4,x,y) returns: (3G_0+x^3+12x)/3 I'm not sure if that's right or not... but there ya go. |
|||
09-04-2015, 06:46 PM
Post: #4
|
|||
|
|||
RE: Syntax for Differential Equations Solver / desolve()???
(09-04-2015 06:22 PM)ewjax Wrote: Has anyone been able to figure out the proper syntax for the desolve() command? I have tried everything I can think of, and each time receive an error message "Error: Bad Argument Value" Your example is a simple derivative, in order to get the result you have just to integrate ;-) |
|||
09-04-2015, 09:11 PM
Post: #5
|
|||
|
|||
RE: Syntax for Differential Equations Solver / desolve()???
Thanks for responses. The clearing/purging of existing variables seemed to do the trick. As an aside - that seems disconcerting that I have to remember to purge all variables prior to using the solver...
I also learned I am only able to make it work by using the y' form of differential - the dy/dx template does not seem to work (yields "undef" message). |
|||
09-04-2015, 11:10 PM
Post: #6
|
|||
|
|||
RE: Syntax for Differential Equations Solver / desolve()???
Finally was able to solve the problem I started out working on. This only took me 48 hours to figure out...(my son is taking a DiffEq course, it's only been 3 decades since I took mine so my skills are, uh, rusty. They are solving this thing manually and I just wanted to confirm the final answer using my shiny new HP Prime. A mere 48 hours later, after a shocking lack of info from google, I finally have my answer, and thought I might share what I learned for the next google-starved victim researching this same question.)
Differential equation: y' - 2y = xe^x Boundary condition: y(0) = 1 You must ensure nothing is stored in x or y. Mem (shift toolbox), highlight "User Variables", backspace will allow you to clear them all. Thanks for that advice to the user above, that was the enabling step. Once that is done: Keystrokes: Code:
Now key in the differential equation and boundary condition in a [] vector, followed by the dependent variable y after the vector. The Help example accomplishes the same thing with AND statements rather than the [] vector, but I find the vector method more elegant. Code:
results in Code:
Items of note: - near as I can tell, you cannot use the dy/dx template, you must enter the differential in y' form. Disappointing. - you must explicitly put the multiplication star between x and e^x, otherwise it thinks you've created a new variable xe and won't implicitly insert the multiplication - as mentioned, for some reason the variables x and y cannot have anything previously stored in them. I find this puzzling but it seems to be important, so... |
|||
09-04-2015, 11:31 PM
Post: #7
|
|||
|
|||
RE: Syntax for Differential Equations Solver / desolve()???
(09-04-2015 09:11 PM)ewjax Wrote: Thanks for responses. The clearing/purging of existing variables seemed to do the trick. As an aside - that seems disconcerting that I have to remember to purge all variables prior to using the solver... If you want to do numerical calculations, do them in the home screen where you need to assign values to the variables for the function to evaluate. Assigning a value to X in the home screen will not affect the variable x in the CAS. I've run into that issue as well, and I've found this approach works. If you insist on assigning values to variables in the CAS, get in the habit of clearing the variable immediately after evaluation. vars -> CAS -> All -> highlight the var and hit the del key. |
|||
09-05-2015, 12:42 AM
Post: #8
|
|||
|
|||
RE: Syntax for Differential Equations Solver / desolve()???
(09-04-2015 11:31 PM)pwarmuth Wrote: If you want to do numerical calculations, do them in the home screen where you need to assign values to the variables for the function to evaluate. Assigning a value to X in the home screen will not affect the variable x in the CAS. I've run into that issue as well, and I've found this approach works. If you insist on assigning values to variables in the CAS, get in the habit of clearing the variable immediately after evaluation. vars -> CAS -> All -> highlight the var and hit the del key. Thanks, good advice/tips. |
|||
09-05-2015, 06:42 AM
Post: #9
|
|||
|
|||
RE: Syntax for Differential Equations Solver / desolve()???
(09-04-2015 11:10 PM)ewjax Wrote: Items of note:I think it's much more natural to use y'. I have nothing against the template as long as it is translated by the HP UI to diff(y,x) :-) Quote:- you must explicitly put the multiplication star between x and e^x, otherwise it thinks you've created a new variable xe and won't implicitly insert the multiplicationIt's very difficult to evaluate some variables but keep other variables unevaluated (the code to do that in solve or diff/int took months to mature), especially in a function like desolve that as a lot of possible syntaxes. Because if you desolve(y'+a*y) where a is assigned to say 2, you expect an answer with 2 not with a. I assume that users having to solve differential equations are more experienced users than those learning derivatives, so that I can spend more time coding math algorithms instead of bugprone user interaction code. |
|||
09-05-2015, 03:05 PM
Post: #10
|
|||
|
|||
RE: Syntax for Differential Equations Solver / desolve()???
I would like the Prime both the symbolic and numerical results.
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)