Re: DSolve Error Message
- To: mathgroup at smc.vnet.net
- Subject: [mg16747] Re: DSolve Error Message
- From: paulh (P.J. Hinton)
- Date: Wed, 24 Mar 1999 02:23:56 -0500
- Organization: Wolfram Research, Inc.
- References: <7d72kh$85u@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <7d72kh$85u at smc.vnet.net>, "Dana DeLouis" <dana2 at email.msn.com> writes: > Hello. I am studying Differential Equations and am stuck at the beginning > of Chapter 3! (I have a long way to go.) Chapter 3 of which book? > I am getting a lot of error messages about ". is longer than depth of > object." The book can solve these equations. Does anyone know what this > error means so I can fix the equation? Thank you. It's hard to say exactly what you did to run into this error message, but I can propose a scenario where it may happen. A mistake often made by beginning Mathematica users is the confusion of Set[] (=) with Equal[] (==). In your case, you may have started out by evaluating the following expression: In[1]:= DSolve[{y'[x] = x^2 * (1 - 3 y[x] ) , y[0] == -1}, y[x], x] 2 Solve::eqf: x (1 - 3 y[x]) is not a well-formed equation. 2 Out[1]= Solve[{x (1 - 3 y[x]), y[0] == -1}, y[x]] Then, you may try to edit the Input cell to correct your mistake, only to find that this results in a different error: In[2]:= DSolve[{y'[x] == x^2 * (1 - 3 y[x] ) , y[0] == -1}, y[x], x] Part::partd: Part specification True[[1]] is longer than depth of object. Part::partd: Part specification True[[2]] is longer than depth of object. Out[2]= {{}} What went wrong? In your first input, you unwittingly made an assignment that stated y'[x] = x^2 * (1 - 3 y[x]) To verify this, we can evaluate the following expression: In[3]:= D[y[x], x] 2 Out[3]= x (1 - 3 y[x]) When you evaluate In[2], the kernel sees: y'[x] == x^2 * (1 - 3 y[x]) -> x^2 * (1 - 3 y[x]) == x^2 * (1 - 3 y[x]) Which evaluates to True. NDSolve[] attempts to pull out the left and right hand sides of an equation with the Part[] function. You can now see how the Part::"partd" error messages are emitted. The way to get ourselves out of this mess is to undo the assignment with the Unset (=.) operator. In[4]:= Derivative[1][y][x] =. Now things are back to normal. In[5]:= DSolve[{y'[x] == x^2 * (1 - 3 y[x] ) , y[0] == -1}, y[x], x] 3 x -4 + E Out[5]= {{y[x] -> --------}} 3 x 3 E > Also, I had to type most of this by hand because when I copy the > equation and paste into a word document, I get all the underlying > stuff as well. I have tried all combinations of copy - paste. I > have set the display of the equations to text, and copied the > equation as text, but I still get all the other stuff that does > not look well when posting a question. I am looking for a way to > copy what is displayed only so I can participate in this newsgroup. The backslash escape sequences you see when copying and pasting are used by Mathematica to store typesetting information, when it is pasted back into a notebook, the front end will reformat it back into it's proper, two-dimensional form. I agree with you that the use of box syntax is not optimal for newsgroup postings. One way you can get a cleaner paste is do the following before copying the cells to the clipboard: 1) Select the Input style cells by holding Ctrl (Windows), Cmd (Macintosh), or Mod1 (X Window) key as you click on cell brackets. 2) Click on the front end menu command sequence: Cell -> Convert To -> InputForm 3) Repeat Step 1, this time choosing the Output style cells 4) Click on the front end menu command sequence: Cell -> ConvertTo -> OutputForm 5) Now copy the cells to the clipboard with the standard Edit -> Copy menu command. 6) Paste in your news reader message composition window. -- P.J. Hinton Mathematica Programming Group paulh at wolfram.com Wolfram Research, Inc. http://www.wolfram.com/~paulh/ Disclaimer: Opinions expressed herein are those of the author alone.