Mathematica being very strange

In summary, the conversation discusses a problem with using the DSolve command in Mathematica. The first attempt at using the command results in an error, but when the variable is changed, it works. The IT guy suggests trying the "turning it off and turning it back on again" method, but the problem persists. Different methods such as Clear and Remove are suggested, with Remove being a potential solution. Eventually, the conversation ends with the issue being resolved by downloading a new copy of the assignment.
  • #1
Shinaolord
92
4
So when i use the following command, I get the following error
DSolve[y'[x] - y[x] == 3, y[x], x]
DSolve::deqn: Equation or list of equations expected instead of False in the first argument False. >>

But when i change the variable y[x] and y'[x] to s[x] and s'[x], It works
why is this?
In[185]:= DSolve[s'[x] - s[x] == 3, s[x], x]

Out[185]= {{s[x] -> -3 + E^x C[1]}}
 
Physics news on Phys.org
  • #2
Most likely y[x] has been given some value earlier.
 
  • #3
I tried clearing it with clear all and clear [f,y,x] but it still doesn't work. I think it's strange, maybe y didn clear properly?
 
  • #4
Clear[y] won't clear y[x]. Try Clear[y[x]].
 
  • #5
Clear[y] does remove function definitions and Clear[y[x]] fails.

Code:
In[1]:= y[x_] := 3 x

In[2]:= ?y

Out[2]= Global`y
Out[2]= y[x_]:=3 x

In[3]:= Clear[y]

In[4]:= ?y

Out[4]= Global`y

In[5]:= y[x] := 3 x

In[6]:= Clear[y[x]]

Clear::ssym: y[x] is not a symbol or a string. >>

As the IT Guy says, "Have you tried turning it off and turning it back on again" (possibly trying a ?y before anything else and then just entering that DSolve line and nothing else)?
 
  • #6
Bill Simpson said:
Clear[y] does remove function definitions and Clear[y[x]] fails.

You're right, I'm wrong. Apologies for the mis-information.
 
  • #7
Bill Simpson said:
Clear[y] does remove function definitions and Clear[y[x]] fails.

Code:
In[3]:= Clear[y]

In[4]:= ?y

Out[4]= Global`y[/QUOTE]
Clear clearly didn't work quite as advertised there. clear[y] puts y in limbo rather than removing it. Remove might be better here than clear.
 
  • #8
Code:
In[1]:= y[x_] := E^x

In[2]:= DSolve[y'[x] == y[x], y[x], x]

Out[2]= During evaluation of In[2]:= DSolve::dsfun: E^x cannot be used as a function. >>
Out[2]= DSolve[True, E^x, x]

In[3]:= Clear[y]

In[4]:= DSolve[y'[x] == y[x], y[x], x]

Out[4]= {{y[x] -> E^x C[1]}}
 
  • #9
I've always wanted to see a great example where Clear wasn't enough and Remove was necessary, not just some weird trick, but really interesting use that could be learned from and applied in useful ways in the future.
 
  • #10
Ah, I didn't know there was a remove function! Hopefully that works, I'll try it momentarily. And yes, I restarted Mathematica several times and it persisted.

I tried it in the document where it wasn't working, and it didn't work. However i downlaoded another copy of the assignment and it worked with y[x]! Strange.
 
Last edited:

1. Why does Mathematica sometimes give unexpected results?

Mathematica is a powerful software that uses advanced algorithms and methods to solve mathematical problems. However, like any software, it is not infallible and may occasionally produce unexpected results due to user error or limitations in its algorithms. It is important to carefully check your inputs and understand the underlying mathematical principles to ensure accurate results.

2. How do I troubleshoot strange errors or warnings in Mathematica?

If you encounter strange errors or warnings in Mathematica, the first step is to carefully read the error message to understand the issue. You can also consult the Mathematica documentation or seek help from online forums and communities. It is also important to check for any typos or mistakes in your code.

3. Why does Mathematica sometimes take a long time to compute?

Mathematica is designed to handle complex mathematical calculations, which may take longer to compute depending on the complexity of the problem. Additionally, the speed of computations can be affected by the hardware and resources of your computer. You can try optimizing your code or using more efficient algorithms to improve computation time.

4. Can Mathematica handle all types of mathematical problems?

Mathematica is a versatile software that can handle a wide range of mathematical problems. However, it may not have specialized capabilities for certain niche areas. It is important to check the documentation or consult with experts to determine if Mathematica is the best tool for your specific problem.

5. How can I stay updated with new features and updates in Mathematica?

Mathematica regularly releases updates with new features and improvements. You can stay updated by subscribing to their newsletter, following their social media accounts, or regularly checking their website. Additionally, you can attend workshops and conferences to learn about the latest developments in Mathematica.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
120
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
507
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top