Adriaan

15 Reputation

One Badge

11 years, 210 days

MaplePrimes Activity


These are questions asked by Adriaan

In Maple, I want to define a set of functions by means of two for loops:

    printlevel:=2;

    # Node coordinates.
    N_x:=5;
    N_y:=4;
    N_elx:=N_x-1;
    N_ely:=N_y-1;
    h_x:=(x_e-x_s)/N_elx;
    h_y:=(y_e-y_s)/N_ely;
    x_n:=[seq(x_s+j*h_x,j=0..N_elx)];
    y_n:=[seq(y_s+j*h_y,j=0..N_ely)];

    # Partition of unity.
    for j from 2 by 1 to N_x-1 do
        for k from 2 by 1 to N_y-1 do
            phi[j,k]:=(x,y)->(x-x_n[j-1])*(x-x_n[j+1])*(y-y_n[k-1])*(y-y_n[k+1])/((x_n[j]-x_n[j-1])*(x_n[j]-x_n[j+1])*(y_n[k]-y_n[k-1])*(y_n[k]-y_n[k+1]));
        od;
    od;

However, this gives output in which the `[j,k]` vary but the `x_n[j-1]`, `x_n[j+1]`, `y_n[j-1]` and `y_n[j+1]` are not evaluated. But if I for instance input `x_n[3]` I correctly get 1/2 as answer.

How do I solve this?

I'm writing a simple Maple program to test the Generalized Finite Element Method: main_screened_Poisso.mw

When trying to define the Neumann boundary conditions, I have to define a directional derivative dudn=dudx*n. However, I can't seem to define a unit vector normal to Gamma, which is defined by a LineSegments objects.

Other than that, the row reduction is very slow, even though I'm using floating point arithmatic and not exact arithmatic, I believe.

How can I solve these problems? Thanks in advance!

 

 

main_screened_Poisso.mw

In the attached Maple program I construct a matrix of which the entries involve numerical integration. Nothing difficult, I think, yet the ReducedRowEchelonForm is taking forever. What am I doing wrong?

Page 1 of 1