AmusingYeti

165 Reputation

8 Badges

9 years, 321 days

MaplePrimes Activity


These are questions asked by AmusingYeti

Hello Mapleprime members

 

I am having an issue with a Maple script I have written that reads in a separate Maple script at the start of the code which deals with regular Jacobian transformations I apply to the problem and got tired writing it each time so externalised it and read it in each time.

On Maple 2015 on my Mac there is nothing wrong with the script and it runs without issue.

 

When I run it on Maple 17 on my linux machine It says the read in file does not exist and the only difference between both machines is the home directory path. (or perhaps version of Maple, but I have used thew following commands in older Maple versions)

 

The Maple script has this at the top:

cwd:=currentdir():

home:=getenv("HOME");
Expspath:=cat(home,"Pathway to the file to be read in");
currentdir(Expspath);

I am simply getting Maple to find the home directory and apply it to the start of the file path which i thought would universally work between machines, and allow the running of Maple scripts between operating systems.

When I run the program on the linux Maple 17, printing Expspath from above gives  exactly where the file is located as it finds the home directory correctly and uses the correct filepath, it just says it does not exist. is there something obvious I am missing?

The Maple file to be read in is on Dropbox so just after the home directory is /Dropbox. If that makes any difference. In both instances the file path is where the file is located (exact match) but the mac will read in the file and linux says it does not exist even though it is the correct filepath.

 

Any help would be appreciated

 

- Yeti

 

Hello maple prime users

I have used the sequence command and series command in Maple before, but seem to have hit a little hurdle with a particular problem.

I want to run the expression:

h(a,b,c):=b!*(a+c)!*sum(F,n=0..c)

   Where F:=(-1)^n*binomial(c,n)*N(a+n):

   Where N(a):=(-1)^n*[evalf(ln(2)) - 1 + 0.5 -1/3 + 1/4 +... + (-1)^a/a]:

I ran a test case using the following code:

restart:
a:=1:
b:=2:
c:=3:
tot:=0:
F:=((-1)^(a+n)/(a+n)):

for n from 0 to c do
      Seq_F2:=(-1)^(a+n):
   
      Seq:=[seq(F,n=0..n)];
      Seq2:=convert(Seq, `+`);

      final:=Seq_F2*(evalf(ln(2))+Seq2);

      SS:=(-1)^n*binomial(c,n)*final;

      S:=(b!*(a+c)!)*SS;
      tot:=tot+S;
od:
tot;

This works for the case where a =1, but will not work for a>1 as in the N(a+n) sequence it misses out the terms in the series for a-1, a-2 etc.... So when a = 2 it misses out the -1 of the sequence and when a = 3 it misses out the -1 and 1/2. Are there any tips on how to overcome this?

 

Best regards

 

- Yeti

I am looking to extract exponents from a sum of products of three variables A, B and C. An example being:

f:=5*A^4*B^3*C^7   +   3*A^2*B^1*C^7  +  31*A^3*B^6*C^11  + ...

I used the following procedure to extract the exponents of each variable:

Exponents:= proc(p, x::name)
    local
    t;
    coeffs(p,x,t);
    map(degree, [t], x)
end proc:

This works great and will extract the powers for each term:

Exponents(f,A):        [4,2,3]

Exponents(f,B):        [3,1,6]

However, when the exponents are the same it does not count them twice. An example of this being with the variable C above where two of them have an exponent = 7 and it only counts it once.

Exponents(f,C):        [7,11]

Is there a simple way to modify the procedure to list the powers regardless of if they appear more than once?

Many thanks in advance.

1 2 3 4 5 Page 5 of 5