Spirithaunter

75 Reputation

4 Badges

5 years, 217 days

MaplePrimes Activity


These are questions asked by Spirithaunter

Hi there!

I am trying to express a given polynomial not in terms of the monomes, but in terms of some orthogonal polynomials p_i, i=1..n.

If I have let's say x^5+x^4+2x^2 then I first divide that term by p_5, then the remainder by p_4 and so on, until I have the wanted coefficients. My problem is, that Maple complains about my code:

Error, (in Basenwechsel) invalid input: op expects 1 or 2 arguments, but received 0.

NEUZMinus:= proc(Unten, Oben, f,G,Liste,n)::real;
  #Unten:= Untere Intervallgrenze; Oben:= Obere Intervallgrenze; g:= zu integrierende Funktion;
  #G:= Gewicht; n:= Hinzuzufügende Knoten;
 
  Basenwechsel:=proc(Dividend, m);
 
  print(Anfang,Dividend,p[m]);
  Koeffizient:=quo(Dividend, p[m],x);
  print(Koeffizient);
  Rest:=rem(Dividend, p[m],x);
  print(Rest);
  if m=0 then
    Basenwechsel:=[Koeffizient];
  else
    
    Basenwechsel:=[Koeffizient,op(Basenwechsel(Rest,m-1))];
   print(Basenwechsel);
  end if;
  print(Durchlauf)
  end proc;
p[-1]:=0;
p[0]:=1;
for i from 1 to max(n,numelems(Liste)) do
  p[i]:=x^i-add(int(x^i*p[j]*diff(G,x),x=Unten..Oben)*p[j]/int(p[j]^2*diff(G,x),x=Unten..Oben),j=0..i-1);
  print(p[i]);
end do;
print(Liste[1],numelems(Liste));
Hn:=mul(x-Liste[i],i=1..numelems(Liste));
print(Hn);
 Koeffizienten:=Basenwechsel(Hn,numelems(Liste));
print(Koeffizienten)
end proc
 

Funnily enough, when I add a print command before the op-function, it does work:

 

NEUZMinus:= proc(Unten, Oben, f,G,Liste,n)::real;
  #Unten:= Untere Intervallgrenze; Oben:= Obere Intervallgrenze; g:= zu integrierende Funktion;
  #G:= Gewicht; n:= Hinzuzufügende Knoten;
 
  Basenwechsel:=proc(Dividend, m);
 
  print(Anfang,Dividend,p[m]);
  Koeffizient:=quo(Dividend, p[m],x);
  print(Koeffizient);
  Rest:=rem(Dividend, p[m],x);
  print(Rest);
  if m=0 then
    Basenwechsel:=[Koeffizient];
  else
    print(Basenwechsel(Rest,m-1));
    Basenwechsel:=[Koeffizient,op(Basenwechsel(Rest,m-1))];
   print(Basenwechsel);
  end if;
  print(Durchlauf)
  end proc;
p[-1]:=0;
p[0]:=1;
for i from 1 to max(n,numelems(Liste)) do
  p[i]:=x^i-add(int(x^i*p[j]*diff(G,x),x=Unten..Oben)*p[j]/int(p[j]^2*diff(G,x),x=Unten..Oben),j=0..i-1);
  print(p[i]);
end do;
print(Liste[1],numelems(Liste));
Hn:=mul(x-Liste[i],i=1..numelems(Liste));
print(Hn);
 Koeffizienten:=Basenwechsel(Hn,numelems(Liste));
print(Koeffizienten)
end proc

Does anyone know how I can get rid of the print command without getting no result? And how does a simple print command change the outcome of an algorithm in the first place?

 

Thank you in advance,

Daniel Reksten

 

Hi!

I am trying to determine the weights of a Gauß quadrature rule, the code I currently have is this:

 

for i from 1 to n do
  RekursivesZwischenergebnis:=1;
  for j from 1 to n do
    if i <> j then
      RekursivesZwischenergebnis:= RekursivesZwischenergebnis*((x-GaußKnoten[j])/(GaußKnoten[i]-GaußKnoten[j]))
    end if;
  end do;
  GaußGewichteAlt[i]:=int(RekursivesZwischenergebnis,x=-1..1);
end do;
 

The code works, is inefficient however. I want to use the product or mul function, however I dont know how to tell Maple not to multiply

((x-GaußKnoten[j])/(GaußKnoten[i]-GaußKnoten[j]))

if j=i.  mul(function(j), j=1..n,j<>i) doesnt work. Any efficient suggestions?

Hi there!

 

I am trying to calculate Eigenvectors of Matrices, Maple does not seem to understand that, however. I have used the structure of the example in the "help" section

A := `<|>`(`<,>`(-1, -3, -6), `<,>`(3, 5, 6), `<,>`(-3, -3, -4));
v, e := Eigenvectors(A) 

and even the example itself, it doesn't work. Maple always responds with   

"Error, (in Matrix) triangular[] storage expects name parameters"

What can I do?


           

1 2 3 4 Page 4 of 4