Function with other function as argument and other functions as output



subst(2,'t,vi)

On Sun, May 13, 2012 at 5:42 PM, Miguel Marinho <miguelmarinho at seoutopia.com
> wrote:

>  Dear Stavros Macrakis,
>
> First of all , I would like to thank you for your reply.
>
> Secondly, your way is working fine, but there is just a little problem,
> doing this I'm defining "vi" without any argument, imagine I want to
> calculate vi(2) , is there any way?
>
> Once again, thank you!
>
> Yours Sincerely,
> Miguel Marinho
>
>
> Em 13-05-2012 22:26, Stavros Macrakis escreveu:
>
> There are several technical problems with your definition:
>
>      * Function and block arguments should be symbols, not expressions
> like x(t).
>     * ''(...) evaluates at the time the expression is *read*, not the time
> it is evaluated, so this almost certainly doesn't do what you want,
>
>  But actually you don't need any of that.  Instead of defining
> "functions", it is easier just to define *expressions*, e.g.
>
>  test(expr) := block([vi,ve,T,vu],
>           vi: diff(expr,'t),
>           ve: sqrt(vi . vi)
>           vu : ...,
>           T: subst(vu, 't , ...)
>           etc.
>
>             -s
>
> On Sun, May 13, 2012 at 8:28 AM, Miguel Marinho <
> miguelmarinho at seoutopia.com> wrote:
>
>> Dear Sir/Madam,
>>
>> I would like to creat a function with other function as argument, example:
>>
>>
>> test(x(t)):=block([VelocidadeInst(t),VelocidadeEsc(t),T(t),vector_unit(u)],
>>                define(VelocidadeInst(t), diff(x, t)),
>>                define(VelocidadeEsc(t),
>> sqrt(VelocidadeInst(t).VelocidadeInst(t))),
>>                vetor_unit(u):=((1/(sqrt(u.u)))*u),
>>                T(t):=''(vetor_unit(VelocidadeInst(t))));
>>
>> where x(t) could be something like: x(t):=[t,cos(t)], so when I ran the
>> function test(x(t)) it should return the functions:
>> VelocidadeInst(t),VelocidadeEsc(t) and T(t), instead of "define: in
>> definition of test, found bad argument x(t)".
>>
>> Thank you,
>> Yours faithfully,
>> Miguel Marinho
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>
>
>