Items tagged with alias

Hey,

I think I found a bug concerning the useage of assume and alias:

restart:

alias(a=a(t),b=b(t));

a, b

(1)

assume(a(t),real);

getassumptions(a(t));

{((a(t))(t))::real}

(2)

assume(b(t),real);

getassumptions(a(t));

{((b(t))(t))::real}

(3)

getassumptions(b(t));

{((b(t))(t))::real}

(4)

 

 

 

Commenting out the alias command produces correct results. I am on linux with build 922027.

alias_bug.mw

Hi!

I use 'alias' to define variable dependencies.
But when I want to use the result of my calculation as an expression, I bite the dust; I cannot get rid of the dependencies.
Can anyone help me here?

In the simplified example below, I use the independent variables z[3] and z[4] to define z[1](z[3],z[4]) and z[2](z[3],z[4]).
I then introduce a function f[1](z[3],z[4]) and its derivatives df_dz.
I introduce the names dz[1]/dz[3]=Dp[1,3], dz[1]/dz[4]=Dp[1,4] etc...
When I have calculated df_dz[3], however, I cannot insert values of z[2] without affecting Dp[2,3].
Actually, now I have finished my calculation and want df_dz[2,3] to be a regular expression, so that I can insert values of
z without affecting the Dp:s.
How can I convert df_dz[3] to a regular expression?

alias( seq(z[i]=z[i](seq(z[j],j=3..4)),i=1..2)):
alias(f=f(seq(z[j],j=3..4))):
alias(seq(seq(Dp[m,n]=diff(z[m](seq(z[j],j=3..4)),z[n]),m=1..2),n=3..4)):

f:=z[1]-z[2]*z[3]:

for j from 3 to 4 do
df_dz[j]:=diff(f,z[j]);
od:

df_dz[3];
subs(z[2]=4711,df_dz[3]);
whattype(Dp[1,3]);
whattype(z[3]);




function

indexed


I am trying to do a substitution as shown in the attached document. I know variants of this question have been asked before but dont quiet get what to do. It is problem with algsubs and how it handles denominators I think. Can get substiturion to work for simple fractions but more complicated ones fail. Would appreciate any guidance here.

restart 

``

``

CR := proc (a, b, c, d) options operator, arrow; (a-c)*(b-d)/((a-d)*(b-c)) end proc

proc (a, b, c, d) options operator, arrow; (a-c)*(b-d)/((a-d)*(b-c)) end proc

(1)

eqns := CR(a, b, c, d)

(a-c)*(b-d)/((a-d)*(b-c))

(2)

e1 := CR(b, a, c, d)

(b-c)*(a-d)/((b-d)*(a-c))

(3)

simplify(e1, {(a-c)*(b-d)/((a-d)*(b-c)) = lambda})

(a*b-a*c-b*d+c*d)/(a*b-a*d-b*c+c*d)

(4)

e1

(b-c)*(a-d)/((b-d)*(a-c))

(5)

``

lambda

lambda

(6)

applyrule((a-c)*(b-d)/((a-d)*(b-c)) = lambda, e1)

(b-c)*(a-d)/((b-d)*(a-c))

(7)

alias(lambda = (a-c)*(b-d)/((a-d)*(b-c)))

lambda

(8)

e1

(b-c)*(a-d)/((b-d)*(a-c))

(9)

``

NULL

``

f := a/b

a/b

(10)

``

f := algsubs(a/b = alpha, f)

alpha

(11)

f

alpha

(12)

algsubs((a-c)*(b-d)/((a-d)*(b-c)) = lambda, e1)

Error, (in algsubs) cannot compute degree of pattern in a

 

``

 

Download UHG5_substitution.mw

One can write 

restart;
alias(C=binomial);
C(4,2);

or

restart;
C:=binomial;
C(4,2);

and then both work the same. In the first case, the replacement of "C" by "binomial" is done at parsing time before evluator gets hold of the code, while in the second case, the replacement is done at run-time (evaluation).

So alias will be more efficient and more safe, I assume.

Is that all there is to it, or are there other more subtle and important reasons to use alias vs. :=  when one want to bind long name to smaller ones to save on typing.

 

Hi guys, I am new on maple I have a simple question for you.

Let's say  A:=b^2*c

Then let's say D:=A*x

Maple give me as result something like D:=b^2*c instead of D:=A*x

And let's say E:=D*F I get E:=b^2*c*x*F instead of E:=A*x*F

My equation is more complicated than these but the problem is the same.

I hope I was clear in the explanation of the problem :)

Thanks :) 

Page 1 of 1