[newbie] how to expand function to original variables
Subject: [newbie] how to expand function to original variables
From: Hugo Coolens
Date: Tue, 19 Feb 2013 11:54:49 +0100
I have reworked the code as follows:
p(tau11,tau22):=tau11*tau22;
sigma(tau11,tau12,tau22):=tau11+tau12+tau22;
A(p,sigma):=sqrt(p^2+2*p*sigma)-p;
hjmax(A,sigma,p):=sqrt((1+A/p)/((1-A/sigma^2)^2+A/p));
subst(sigma(tau11,tau12,tau22),sigma,hjmax);
subst(p(tau11,tau22),p,hjmax);
this gives me hjmax as a function of tau11, tau12 and tau22 which is what
I wanted. I just wondered whether the last two statements can be combined
in one?
thanks for all the help
hugo
On Mon, 18 Feb 2013, Stavros Macrakis wrote:
> As Barton suggests, it's not clear why you've define p and sigma as
> functions, and A and hjmax as expressions.
> If you'd like to keep the unexpanded form in some cases, there are a couple
> of possible approaches:
>
> * When using the function, don't write just the name (p), but the full call
> p(...), but quote?the call as 'p(...). ?This is what we call a noun form.
> ?It will stay unevaluated until you do ev(<<expr>>, nouns) or more narrowly
> ev(<<expr>>, p).
>
> * You can also substitute the full value, e.g. subst(p(tau11,tau22), p,
> hjmax).
>
> ? ? ? ? ? -s
>
> On Mon, Feb 18, 2013 at 9:11 AM, Barton Willis <willisb at unk.edu> wrote:
> Since you defined p and sigma to be functions, I think you want
> something like (append arguments to p and sigma)
>
> (p(tau11,tau22):=tau11*tau22,
> sigma(tau11,tau12,tau22):=tau11+tau12+tau22,
> A:sqrt(p(tau11,tau22)^2+2*p(tau11,tau22)*sigma(tau11,tau12,tau22))-p(tau11,
> tau22),
> hjmax:sqrt((1+A/p(tau11,tau22))/((1-A/sigma(tau11,tau12,tau22)^2)^2+A/p(tau
> 11,tau22))));
>
> Or maybe you wanted p and sigma to be expressions, not functions
> ?(thus p : tau11 * tau22, sigma : =tau11+tau12+tau22)?
>
> --Barton
>
> ________________________________________
> From: maxima-bounces at math.utexas.edu
> [maxima-bounces at math.utexas.edu] on behalf of Hugo Coolens
> [coolens at kahosl.be]
> Sent: Monday, February 18, 2013 06:14
> To: maxima at math.utexas.edu
> Subject: [newbie] how to expand function to original
> variables
>
> I have the following code:
> p(tau11,tau22):=tau11*tau22;
> sigma(tau11,tau12,tau22):=tau11+tau12+tau22;
> A:sqrt(p^2+2*p*sigma)-p;
> hjmax:sqrt((1+A/p)/((1-A/sigma^2)^2+A/p));
>
> I now would like to see hjmax written again as a function of
> tau11, tau12,
> tau22.
> Can anyone here point me to which command to use for that
> purpose?
>
> thanks in advance
> hugo
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
>
>