## 270 Reputation

8 years, 292 days

## Permgroup. Solved....

Thank you very much for the answer.

Hi Carl Love,

## @acer  Thank you for your remarks a...

Thank you for your remarks and answer. I make all the change and I used unapply to define the function alpha.

I think all the lines of the code work very well. But only the problem when I put Kernel(x,y)=ln(abs(x-y)) there is something strange... "infinity " is found everywhere in my computation... How can I avoird this problem.

This is the code.   It's work very well, but when I change the kernel function ln(abs(x-y)) there is a problem. How can is solve this problem

Fred.mw

## @Mac Dude    Thank you for you...

For me, when i put alpha(1,1) I must bet a numeric value but in the code alpha(1,1) is a function pf n and m.

## @Mac Dude  Thank you for your ...

restart:
with(LinearAlgebra):
with(plots):
with(PDEtools):
with(IntegrationTools):
interface(rtablesize=20):
d:=1: N:=2: a:=1: h:=a/N:
Kernel(x,y):=ln(abs(x-y)):

eq2:=int(Kernel(x,y)*phi(y),y=-a..a)=sum(int(Kernel(x,y)*phi(y),y=n*h..(n+d)*h),n=-N..N-d):

Approximate the integral

Compute the coefficients  beta[i]

Vct_basis:=[seq(x^i,i=0..d+1)]:
fct:=[seq(unapply(Vct_basis[i],x),i=1..d+2)]:

sys:=[seq(eq3(fct[i]),i=1..d+1)]:
x:=m*h:
w := [seq(beta[i,n],i=1..d+1)]:
M,b := GenerateMatrix(sys,w):

M1:=-M: V:=-b:

Vect_beta:=(M1)^(-1).V:# Vect_beta is a vector.

beta[1]:=Vect_beta[1]:
alpha:=(n,m)->beta[1];
(n, m) -> beta[1]
alpha(1,1);
alpha(1, 1)  No display.

## @Mac Dude  Okay, thank you, it's so...

Okay, thank you, it's solved.

## BTCS_general...

Initialisation

U[i+1,0] := 0;
U[i+1,M+1] := 0;
U[jj,M+2]:=U[jj,M];
U[jj+1,-1]:=U[jj+1,1];
#Loop
for jj from 1 to M do:
sys[jj] := eval(BTCS_general,j=jj);
od;

Wen I run Mt code U get. I want that all the results in the loop use my initialisation and remplace where ir's necessary  for example U[jj+1,-1]:=U[jj+1,1];

U[jj + 1, 1]
s u[i + 1, -1]   4 s u[i + 1, 0]   6 s u[i + 1, 1]
sys1:=   u[i + 1, 1] + -------------- - --------------- + ---------------
4                4                 4
h                h                 h

4 s u[i + 1, 2]   s u[i + 1, 3]
- --------------- + ------------- = u[i, 1]
4                4
h                h
s u[i + 1, 0]   4 s u[i + 1, 1]   6 s u[i + 1, 2]
sys2:= u[i + 1, 2] + ------------- - --------------- + ---------------
4                4                 4
h                h                 h

s u[i + 1, 3]   s u[i + 1, 4]
- --------------- + ------------- = u[i, 2]
4                4
h                h
s u[i + 1, 1]   4 s u[i + 1, 2]   6 s u[i + 1, 3]
sys3:= u[i + 1, 3] + ------------- - --------------- + ---------------
4                4                 4
h                h                 h

4 s u[i + 1, 4]   s u[i + 1, 5]
- --------------- + ------------- = u[i, 3]
4                4
h                h
s u[i + 1, 2]   4 s u[i + 1, 3]   6 s u[i + 1, 4]
sys4:=   u[i + 1, 4] + ------------- - --------------- + ---------------
4                4                 4
h                h                 h

4 s u[i + 1, 5]   s u[i + 1, 6]
- --------------- + ------------- = u[i, 4]
4                4
h                h

## @Joe Riel  Initialisation U[i+1,0] ...

Initialisation

U[i+1,0] := 0;
U[i+1,M+1] := 0;
U[jj,M+2]:=U[jj,M];
U[jj+1,-1]:=U[jj+1,1];
#Loop
for jj from 1 to M do:
sys[jj] := eval(BTCS_general,j=jj);
od;

Wen I run Mt code U get. I want that all the results in the loop use my initialisation and remplace where ir's necessary  for example U[jj+1,-1]:=U[jj+1,1];

U[jj + 1, 1]
s u[i + 1, -1]   4 s u[i + 1, 0]   6 s u[i + 1, 1]
sys1:=   u[i + 1, 1] + -------------- - --------------- + ---------------
4                4                 4
h                h                 h

4 s u[i + 1, 2]   s u[i + 1, 3]
- --------------- + ------------- = u[i, 1]
4                4
h                h
s u[i + 1, 0]   4 s u[i + 1, 1]   6 s u[i + 1, 2]
sys2:= u[i + 1, 2] + ------------- - --------------- + ---------------
4                4                 4
h                h                 h

s u[i + 1, 3]   s u[i + 1, 4]
- --------------- + ------------- = u[i, 2]
4                4
h                h
s u[i + 1, 1]   4 s u[i + 1, 2]   6 s u[i + 1, 3]
sys3:= u[i + 1, 3] + ------------- - --------------- + ---------------
4                4                 4
h                h                 h

4 s u[i + 1, 4]   s u[i + 1, 5]
- --------------- + ------------- = u[i, 3]
4                4
h                h
s u[i + 1, 2]   4 s u[i + 1, 3]   6 s u[i + 1, 4]
sys4:=   u[i + 1, 4] + ------------- - --------------- + ---------------
4                4                 4
h                h                 h

4 s u[i + 1, 5]   s u[i + 1, 6]
- --------------- + ------------- = u[i, 4]
4                4
h                h

## @mehdi jafari  Hi Mehdi, Please, pu...

Hi Mehdi,

Please, put N=M=2. Then make run in my laptop I get ( Also, the approx solution depend of u[i,j] it's not normal).  Thank you.

Hi Preben,

## @itsme  Hi itsme. This my code. TES...

Hi itsme.

This my code.

TESTESTEst.mw
Many thinks.

 2 3 4 5 6 7 8 Page 4 of 10
﻿