Rule to Function, Frontend funnies
- To: mathgroup at smc.vnet.net
- Subject: [mg5307] Rule to Function, Frontend funnies
- From: Wouter Meeussen <meeussen.vdmcc at vandemoortele.be>
- Date: Sat, 23 Nov 1996 01:44:44 -0500
- Sender: owner-wri-mathgroup at wolfram.com
how can I convert a rule to a function?
if I get a result from
rulesoln = DSolve[{y'[x]==y[x]/(c+1/x),y[0]==1},y[x],x]
in the form :
2
x/c - Log[1 + c x]/c
{{y[x] -> E }}
how do I get the definition :
y[x_]:= E^(x/c - Log[1 + c x]/c^2)
(*************************************************************************)
Funny : in any text editor, like notepad , I just cut & paste the pieces I
need.
In the Frontend, I can force Mma to produce a one-dimensional output line by
asking
% // InputForm
{{y[x] -> E^(x/c - Log[1 + c*x]/c^2)}}
but when I try to edit it, or make an input-line out of that, either by
Action-Prepare.Input-Copy.Output.from.Above (Control-Shift-L)
or by Menu-Cell-Inactive and Menu-Style-Input, the result is :
No Input Form was generated for this Cell
(*************************************************************************)
Even Funnier : doing Control-Shift-L and Shift-Enter produces:
General::spell: Possible spelling error: new symbol name "Form"
is similar to existing symbols {CForm, For}.
General::spell1: Possible spelling error: new symbol name "for"
is similar to existing symbol "For".
Cell for Form generated Input No this was
(*************************************************************************)
Anybody out there to whom this happens too?
After some {soul,FullForm}-searching, I came up with this rule-eating-rule :
Flatten[rulesoln]/.y[x]->y[x_]/.Rule->SetDelayed
{Null}
you don't get to see much except "{Null}", but it results in:
?y
Global`y
y[x_] := E^(x/c - Log[1 + c*x]/c^2)
(*************************************************************************)
Is there a fast & easy Cut-and-Paste way to do it, not leaving the FrontEnd?
Is this the same on a Mac-machine?
Is this the same in Mma 3.0 for Windows?
Wouter.
NV Vandemoortele Coordination Center
Group R&D Center
Prins Albertlaan 79
Postbus 40
B-8870 Izegem
Tel: +/32/51/33 21 11
Fax:+32/51/33 21 75
vdmcc at vandemoortele.be