Message Boards Message Boards

0
|
2921 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Converting rules to function or expression

I have this
{{qy1[x] -> -2.72392*10^9 x^3 + 1. x C[1] + C[2]}}
They I want to make a function  to be able to operate on it
f[x_]:=f/. f->qy1[x]

It does not work , I get
In[960]:= f[x_]:=f/. f->qy1[x]
f[.1]

Out[961]= qy1[0.1]
Why not getting a function?
POSTED BY: Jose Calderon
One way might be to not use delayed assignment (:=) but use =. With delayed assignment, "x" was being replaced by ".1" among other issue.
ClearAll[gy1, x, f]
p = First@{{qy1[x] -> -2.72392*10^9 x^3 + 1. x C[1] + C[2]}}
f[x_] = qy1[x] /. p
f[.1]
(*-2.72392*10^6 + 0.1 C[1] + C[2]*)
f[.2]
(*2.179136*10^7 + 0.2 C[1] + C[2]*)
POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract