Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematica clear a function's derivative definition

I defined the derivative of a function in Mathematica without defining the function itself, i.e. I have a function definition that looks like this:

y'[x_] := constant * f'[x].

I can't figure out how to clear it out. If I use Clear[y'] or `ClearAll[y'], I get an error message:

ClearAll::ssym: y' is not a symbol or a string.

Clear[y] and ClearAll[y] do nothing to remove the definition of y'.

Any ideas on how I can remove the definition of y'?

like image 921
user1676921 Avatar asked Sep 17 '12 07:09

user1676921


People also ask

How do you clear a definition in Mathematica?

To clear all definitions of quantities you've introduced in a Mathematica session so far, type: ClearAll["Global'*"].

What is the use of clear command in Mathematica?

Clear removes values and definitions from a symbol while ClearAll removes attributes, messages and any default options as well as values and definitions from a symbol.

How do you clear the screen in Mathematica?

When in a notebook, <Control>+a will select all cells and <delete> will remove them from your screen, and it will appear as if you have just opened Mathematica. You can't autoamte this (put it in a script), but it's handy if you're just doing some calculations.


2 Answers

This should do what you want:

y'[x_] =.

See Unset. Also see this question for related information.

like image 58
image_doctor Avatar answered Sep 20 '22 13:09

image_doctor


You can use Remove[y]. For a function name f' is unusual syntax, but it does appear in the documentation for derivative: http://reference.wolfram.com/mathematica/ref/Derivative.html

The derivative name form seems to present a bit of a problem for Information (??), which would usually show attribute information.

y'[x_] := constant*f'[x]
y'[4]
??y

constant f'[4]

Global`y

Remove[y]
??y

Information::notfound : Symbol y not found. >>

y'[4]

y'[4]

But oddly, (and nothing to do with the derivative name form):

Information[y]

Global`y

There is some deeper information about Remove here: https://mathematica.stackexchange.com/questions/4921/what-is-the-story-with-removed-symbols

like image 25
Chris Degnen Avatar answered Sep 23 '22 13:09

Chris Degnen