Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi there!

 

I have a procedure that compares the (2n+1)-point Gauß-Kronrod-Quadrature to the (2n+1)-point Patterson-Quadratures for a range of n. I have plotted the results (the absolute and relative error if they "exist", meaning they need to posess certain features) in a graph, however they do not look very insightful. For the lowest n, the reader gets an impression for the different accuracy of the quadrature rules, however, for higher n's, the resulting points are basically just on the x-axis with no difference to see. Is it possible to also print a math table with Maple? Something like:

 

      GKQ   PZ+   PZ-   PY 

1     1,04   1,03  1,02  1,02

2     1,09   1,04     -       -

3     1,02   1,01  1,01  1,01

4     1,03   1,02  1,01  1,01

with - meaning no existance for that particular n? I havent found anything about that on the internet, it's all about plotting.

My (long) code is this:

 

 

restart:
with(LinearAlgebra):     
with(ListTools):
with(PolynomialTools):
with(CurveFitting):
with(plots):
Plotting:=proc(Unten,Oben,f,g,nUnten,nOben)::plot;

local SpeicherlisteX, SpeichervektorX, #speichert die Stützstellen
SpeichervektorXGekürzt, #streicht nicht existierende Quaraturformeln.
SpeicherlisteYAbs, SpeichervektorYAbs,  #speichert die Stützwerte des späteren Splines aus dem absoluten Quadraturfehler
SpeicherlisteYRel, SpeichervektorYRel,  #speichert die Stützwerte des späteren Splines aus den relativen Quadraturfehler
î, #Laufvariable  
InterpolationsfunktionAbs, #speichert den Spline aus dem absoluten Interpolationsfehler                      
InterpolationsfunktionRel, #speichert den Spline aus den relativen Fehlern von f
GraphAbsGK, GraphAbsPY, GraphAbsPZP, GraphAbsPZM, #speichert den Graphen aus dem Spline aus dem absoluten Interpolationsfehler          GraphRelGK, GraphRelPY, GraphRelPZP, GraphRelPZM, #speichert den Graphen aus dem Spline aus den relativen Fehlern  von f  
PunkteAbsGK, PunkteAbsPY, PunkteAbsPZP, PunkteAbsPZM,#speichert den Punktgraphen aus dem absoluten Interpolationsfehler
PunkteRelGK, PunkteRelPY, PunkteRelPZP, PunkteRelPZM, #speichert den Punktgraphen aus dem absoluten Interpolationsfehler
NichtexistenzGK, NichtexistenzPY, NichtexistenzPZP, NichtexistenzPZM, #speichert die Häufigkeit der Nichtexistenz

p,i,c,d,e,Hn,Koeffizienten,s,j,M,V,S,K,nNeu,Em,Hnm,KnotenHnm,KoeffizientenHnm,h0,b,gxi,Gewichte,Delta,Ergebnis,
Endergebnis,Koeffizient,Rest,a,VorgegebeneKnoten,TatsächlicherWert, DoppelterKnoten, KomplexerKnoten,

Text:= proc() #Prozedur zum Schreiben der Ausgabe
uses T= Typesetting;
     T:-mrow(seq(`if`(e::string, T:-mn(e), T:-Typeset(T:-EV(e))), e= [args]))
end proc,
OrtPol:= proc(G,N)::list; #Prozedur zum Berechnen der benötigten orthogonalen Polynome
  local q,r,R;
  q[-1]:=0;
  q[0]:=1;
 
  for r from 1 to N do
  q[r]:=(x^r-add(evalf(Int(x^r*q[R]*G,x=(-1)..1))*q[R]/evalf(Int(q[R]^2*G,x=(-1)..1)),R=0..r-1));
  end do;
  return(fsolve(q[N]));
end proc,
BasenwechselNormiert:=proc(Dividend, m)::list; #stellt ein gegebenes Polynom über eine Linearkombination der orthogonalen Polynome #dar.
   local BasenwechselNormiert;
 
  Koeffizient:=quo(Dividend, p[m],x);

  Rest:=rem(Dividend, p[m],x);
 
  if m=0 then
    BasenwechselNormiert:=[Koeffizient*evalf(Int(g*p[m]^2,x=Unten..Oben))];
  else

    BasenwechselNormiert:=[Koeffizient*evalf(Int(g*p[m]^2,x=Unten..Oben)),op(procname(Rest,m-1))];
   
  end if;
 
  end proc,
    Basenwechsel:=proc(Dividend, m)::list; #stellt ein gegebenes Polynom über eine Linearkombination der orthogonalen Polynome dar.
   local Basenwechsel;
 
  Koeffizient:=quo(Dividend, p[m],x);

  Rest:=rem(Dividend, p[m],x);
 
  if m=0 then
    Basenwechsel:=[Koeffizient];
  else

    Basenwechsel:=[Koeffizient,op(procname(Rest,m-1))];
   
  end if;
 
  end proc,
Erweiterung:= proc(Unten, Oben, f,g,Liste,n)::real; #Prozedur zur Berechnung der optimalen Erweiterung nach Knotenvorgabe
  #Unten:= Untere Intervallgrenze; Oben:= Obere Intervallgrenze; f:= zu integrierende Funktion;
  #g:= Gewicht; Liste:= Liste der alten Knoten, n:= Anzahl hinzuzufügender Knoten;
 
 
 
Hn:=mul(x-Liste[i],i=1..numelems(Liste));

 Koeffizienten:=FromCoefficientList(BasenwechselNormiert(Hn,numelems(Liste)+1),x,termorder=reverse); #Die Koeffizienten der orthogonalen Polynome werden hier als Koeffizienten der Monome gespeichert.

 

M:=Matrix(n,n); #Beginn der Erstellung eines linearen Gleichungssystems, dessen Lösung die Koeffizienten der orthogonalen Polynome sind, deren Summe Em die hinzuzufügenden Knoten als Nullstellen hat.
V:=Vector(n);
 
  for s from 0 to n-1 do
    for j from 0 to s do
      M(s+1,j+1):=add(coeff(a[s][j],x,k)*coeff(Koeffizienten,x,k),k=0..n);
      if s<>j then
        M(j+1,s+1):=M(s+1,j+1);
      end if;
    end do;
    
    M(s+1,n+1):=add(coeff(a[n][s],x,k)*coeff(Koeffizienten,x,k),k=0..n);
    
    
  end do;

S:=LinearSolve(M,V);
K:=evalindets(S,name,()->2);


Em:=add(p[i]*K[i+1],i=0..n); #Erstellen von Em, dessen Nullstellen die hinzuzufügenden Knoten sind
Hnm:=Hn*Em; #Erstellen von Hnm, welches alle Knoten als Nullstelle besitzt
KnotenHnm:=fsolve(Hnm,complex); #Knotenberechnung

 

if (KnotenHnm[1]<-1-10^(-10)) or (KnotenHnm[n+numelems(Liste)]>1+10^(-10)) then
  return(false)
else
KomplexerKnoten:=false;
for i from 1 to n+numelems(Liste) do

 if(Im(KnotenHnm[i])>10^(-10)) then
  KomplexerKnoten:=true
 end if;
end do;
if KomplexerKnoten=true then
  return(false)
else
DoppelterKnoten:=false;
for i from 1 to n+numelems(Liste)-1 do
 
 if (KnotenHnm[i+1]-KnotenHnm[i]<10^(-10)) then
   DoppelterKnoten:=true
 end if;
end do;
if DoppelterKnoten=true then
 return(false)
else

 

KoeffizientenHnm:=Reverse(Basenwechsel(Hnm,n+numelems(Liste)));  #Das Polynom Hnm wird über die orthogonalen Polynome dargestellt.

h0:=evalf(Int(g,x=Unten..Oben)); #Beginn der Berechnung der Gewichte
 
b[n+numelems(Liste)+2]:=0;
b[n+numelems(Liste)+1]:=0;
  for i from 1 to nops([KnotenHnm]) do
    for j from n+numelems(Liste) by -1 to 1 do
      
      b[j]:=KoeffizientenHnm[j+1]+(d[j]+KnotenHnm[i]*c[j])*b[j+1]+e[j+1]*b[j+2];
      
    end do;
    
    gxi:=quo(Hnm,x-KnotenHnm[i],x);
   
    Gewichte[i]:=c[0]*b[1]*h0/eval(gxi,x=KnotenHnm[i]);
    
   
    Delta[i]:=c[0]*b[1];
  end do;

Ergebnis:=add(eval(f,x=KnotenHnm[k])*Gewichte[k],k=1..nops([KnotenHnm]));

Endergebnis:=Re(evalf(Ergebnis))
end if;
end if;
end if;
end proc:


p[-1]:=0;
p[0]:=1;
for i from 1 to (2*nOben+1)*2 do
  p[i]:=(x^i-add(evalf(Int(x^i*p[j]*g,x=Unten..Oben))*p[j]/evalf(Int(p[j]^2*g,x=Unten..Oben)),j=0..i-1)); #Berechnung einer Folge orthogonaler Polynome bezüglich der gegebenen Gewichtsfunktion und des gegebenes Intervalles
 
c[i-1]:=coeff(p[i],x,i)/coeff(p[i-1],x,i-1); #Berechnung der dreigliedrigen Rekursion der errechneten orthogonalen Polynome
d[i-1]:=(coeff(p[i],x,(i-1))-c[i-1]*coeff(p[i-1],x,(i-2)))/coeff(p[i-1],x,(i-1));
if i <> 1 then
  e[i-1]:=coeff(p[i]-(c[i-1]*x+d[i-1])*p[i-1],x,i-2)/coeff(p[i-2],x,i-2);
else
  e[i-1]:=0;
end if;
end do;

a[0][0]:=1; #Beginn der Berechnung der orthogonalen Produkterweiterungen, die Koeffizienten der orthogonalen Polynome werden wieder über die Monome gespeichert (2*x^2+2 bedeutet bspw. [2,0,2,0,0...] für die Koeffizienten)
a[1][0]:=x;
a[1][1]:=-e[1]*c[0]/c[1]+(d[0]-d[1]*c[0]/c[1])*x+c[0]/c[1]*x^2;
for s from 2 to 2*nOben+1 do
  a[s][0]:=x^s;
  a[s][1]:=-e[s]*c[0]/c[s]*x^(s-1)+(d[0]-d[s]*c[0]/c[s])*x^s+c[0]/c[s]*x^(s+1);
    pprint (coeff(a[s][1],x,s),as1s);
end do;
for s from 2 to 2*nOben+1 do
  for j from 2 to s do

     a[s][j]:=c[j-1]*add(coeff(a[s][j-1],x,k-1)/c[k-1]*x^k,k=abs(s-j)+2..s+j)+add((d[j-1]-c[j-1]*d[k]/c[k])*coeff(a[s][j-1],x,k)*x^k,k=abs(s-j)+1..s+j-1)-c[j-1]*add(e[k+1]*coeff(a[s][j-1],x,k+1)/c[k+1]*x^k,k=abs(s-j)..s+j-2)+e[j-1]*add(coeff(a[s][j-2],x,k)*x^k,k=abs(s-j)+2..s+j-2);

     
    
  end do;
end do;
for î from nUnten to nOben do
  VorgegebeneKnoten[î]:=OrtPol(g,î);
end do;
TatsächlicherWert:=evalf(Int(f*g,x= Unten..Oben));
GraphAbsGK:=plot([]); PunkteAbsGK:=plot([]); GraphAbsPZP:=plot([]); PunkteAbsPZP:=plot([]); GraphAbsPZM:=plot([]); PunkteAbsPZM:=plot([]); GraphAbsPY:=plot([]); PunkteAbsPY:=plot([]);
GraphRelGK:=plot([]); PunkteRelGK:=plot([]); GraphRelPZP:=plot([]); PunkteRelPZP:=plot([]); GraphRelPZM:=plot([]); PunkteRelPZM:=plot([]); GraphRelPY:=plot([]); PunkteRelPY:=plot([]);
SpeicherlisteX:=[];
SpeicherlisteYAbs:=[];
SpeicherlisteYRel:=[];
for î from nUnten to nOben do
  if Erweiterung(Unten,Oben,f,g,[VorgegebeneKnoten[î]],î+1) <> false then
    SpeicherlisteX:=[op(SpeicherlisteX),î]; #Stützstellen definieren                                   
    SpeicherlisteYAbs:=[op(SpeicherlisteYAbs),Erweiterung(Unten,Oben,f,g,[VorgegebeneKnoten[î]],î+1)-evalf(Int(f*g,   x=Unten..Oben))]; #Bestimmen des absoluten Fehlers von f für n=î
      if abs(TatsächlicherWert) > 10^(-10) then #Bestimmen des relativen Fehlers von f1 falls                                                          #dieser definiert ist
      SpeicherlisteYRel:=[op(SpeicherlisteYRel),abs(SpeicherlisteYAbs[-1]/TatsächlicherWert)];
    end if;
  end if;
end do;
if numelems(SpeicherlisteX)>0 then
  SpeichervektorX:=Vector[row](numelems(SpeicherlisteX),SpeicherlisteX);
  SpeichervektorYAbs:=Vector[row](numelems(SpeicherlisteYAbs),SpeicherlisteYAbs);
  PunkteAbsGK:= plot(SpeichervektorX,SpeichervektorYAbs,style = point, color=red, legend = ["GK"]);
    #  Generierung des Punktgraphen, der sich aus den absoluten Fehlern von f ergibt
  if numelems(SpeicherlisteX)>1 then
    InterpolationsfunktionAbs:=Spline(SpeichervektorX,SpeichervektorYAbs,n);
      #  Splines aus Stützpunkten, die sich aus den absoluten Fehlern von f ergeben
    GraphAbsGK:= plot(InterpolationsfunktionAbs, n=nUnten..nOben, color=red);
      #  Generierung des Graphen, der sich aus dem Spline aus den absoluten Fehlern von f ergibt
  end if;
end if;

if abs(TatsächlicherWert) > 10^(-10) then
  # falls der relative Fehler definiert ist analoges Vorgehen für die relativen Fehler
  if numelems(SpeicherlisteX)>0 then
    SpeichervektorYRel:=Vector[row](numelems(SpeicherlisteYRel),SpeicherlisteYRel);
    PunkteRelGK:= plot(SpeichervektorX,SpeichervektorYRel,style = point, color=red, legend = ["GK"]);
   
    if numelems (SpeicherlisteX)>1 then
      InterpolationsfunktionRel:=Spline(SpeichervektorX,SpeichervektorYRel,n);
      GraphRelGK:= plot(InterpolationsfunktionRel, n=nUnten..nOben, color=red);
    end if;
  end if;
end if;
NichtexistenzGK:=nOben-nUnten+1-numelems(SpeicherlisteX);

SpeicherlisteX:=[]; # analoges Vorgehen für PZP
SpeicherlisteYAbs:=[];
SpeicherlisteYRel:=[];
for î from nUnten to nOben do
  if Erweiterung(Unten,Oben,f,g,[-1,VorgegebeneKnoten[î]],î) <> false then
    SpeicherlisteX:=[op(SpeicherlisteX),î]; #Stützstellen definieren                                   
    SpeicherlisteYAbs:=[op(SpeicherlisteYAbs),Erweiterung(Unten,Oben,f,g,[-1,VorgegebeneKnoten[î]],î)-TatsächlicherWert]; #Bestimmen des absoluten Fehlers von f für n=î
      if abs(TatsächlicherWert) > 10^(-10) then #Bestimmen des relativen Fehlers von f1 falls                                                          #dieser definiert ist
      SpeicherlisteYRel:=[op(SpeicherlisteYRel),abs(SpeicherlisteYAbs[-1]/TatsächlicherWert)];
    end if;
  end if;
end do;
if numelems(SpeicherlisteX)>0 then
  SpeichervektorX:=Vector[row](numelems(SpeicherlisteX),SpeicherlisteX);
  SpeichervektorYAbs:=Vector[row](numelems(SpeicherlisteYAbs),SpeicherlisteYAbs);
  PunkteAbsPZP:= plot(SpeichervektorX,SpeichervektorYAbs,style = point, color=orange);
    #  Generierung des Punktgraphen, der sich aus den absoluten Fehlern von f ergibt
  if numelems(SpeicherlisteX)>1 then
    InterpolationsfunktionAbs:=Spline(SpeichervektorX,SpeichervektorYAbs,n);
      #  Splines aus Stützpunkten, die sich aus den absoluten Fehlern von f ergeben
    GraphAbsPZP:= plot(InterpolationsfunktionAbs, n=nUnten..nOben, color=orange);
      #  Generierung des Graphen, der sich aus dem Spline aus den absoluten Fehlern von f ergibt
  end if;
end if;

if abs(TatsächlicherWert) > 10^(-10) then
  # falls der relative Fehler definiert ist analoges Vorgehen für die relativen Fehler
  if numelems(SpeicherlisteX)>0 then
    SpeichervektorYRel:=Vector[row](numelems(SpeicherlisteYRel),SpeicherlisteYRel);
    PunkteRelPZP:= plot(SpeichervektorX,SpeichervektorYRel,style = point, color=orange, legend = ["PZP"]);
    
    if numelems (SpeicherlisteX)>1 then
      InterpolationsfunktionRel:=Spline(SpeichervektorX,SpeichervektorYRel,n);
      GraphRelPZP:= plot(InterpolationsfunktionRel, n=nUnten..nOben, color=orange);
    end if;
  end if;
end if;
NichtexistenzPZP:=nOben-nUnten+1-numelems(SpeicherlisteX);
SpeicherlisteX:=[];# analoges Vorgehen für PZM
SpeicherlisteYAbs:=[];
SpeicherlisteYRel:=[];
for î from nUnten to nOben do
  if Erweiterung(Unten,Oben,f,g,[VorgegebeneKnoten[î],1],î) <> false then
    SpeicherlisteX:=[op(SpeicherlisteX),î]; #Stützstellen definieren                                   
    SpeicherlisteYAbs:=[op(SpeicherlisteYAbs),Erweiterung(Unten,Oben,f,g,[VorgegebeneKnoten[î],1],î)-TatsächlicherWert]; #Bestimmen des absoluten Fehlers von f für n=î
      if abs(TatsächlicherWert) > 10^(-10) then #Bestimmen des relativen Fehlers von f1 falls                                                          #dieser definiert ist
      SpeicherlisteYRel:=[op(SpeicherlisteYRel),abs(SpeicherlisteYAbs[-1]/TatsächlicherWert)];
    end if;
  end if;
end do;
if numelems(SpeicherlisteX)>0 then
  SpeichervektorX:=Vector[row](numelems(SpeicherlisteX),SpeicherlisteX);
  SpeichervektorYAbs:=Vector[row](numelems(SpeicherlisteYAbs),SpeicherlisteYAbs);
  PunkteAbsPZM:= plot(SpeichervektorX,SpeichervektorYAbs,style = point, color=blue, legend = ["PZM"]);
    #  Generierung des Punktgraphen, der sich aus den absoluten Fehlern von f ergibt
  if numelems(SpeicherlisteX)>1 then
    InterpolationsfunktionAbs:=Spline(SpeichervektorX,SpeichervektorYAbs,n);
      #  Splines aus Stützpunkten, die sich aus den absoluten Fehlern von f ergeben
    GraphAbsPZM:= plot(InterpolationsfunktionAbs, n=nUnten..nOben, color=blue);
      #  Generierung des Graphen, der sich aus dem Spline aus den absoluten Fehlern von f ergibt
  end if;
end if;

if abs(TatsächlicherWert) > 10^(-10) then
  # falls der relative Fehler definiert ist analoges Vorgehen für die relativen Fehler
  if numelems(SpeicherlisteX)>0 then
    SpeichervektorYRel:=Vector[row](numelems(SpeicherlisteYRel),SpeicherlisteYRel);
    PunkteRelPZM:= plot(SpeichervektorX,SpeichervektorYRel,style = point, color=blue, legend = ["PZM"]);
 
    if numelems (SpeicherlisteX)>1 then
      InterpolationsfunktionRel:=Spline(SpeichervektorX,SpeichervektorYRel,n);
      GraphRelPZM:= plot(InterpolationsfunktionRel, n=nUnten..nOben, color=blue);
    end if;
  end if;
end if;
NichtexistenzPZM:=nOben-nUnten+1-numelems(SpeicherlisteX);
SpeicherlisteX:=[]; #analoges Vorgehen für PY
SpeicherlisteYAbs:=[];
SpeicherlisteYRel:=[];
for î from nUnten to nOben do
  if Erweiterung(Unten,Oben,f,g,[-1,VorgegebeneKnoten[î],1],î-1) <> false then
    SpeicherlisteX:=[op(SpeicherlisteX),î]; #Stützstellen definieren                                   
    SpeicherlisteYAbs:=[op(SpeicherlisteYAbs),Erweiterung(Unten,Oben,f,g,[-1,VorgegebeneKnoten[î],1],î-1)-TatsächlicherWert]; #Bestimmen des absoluten Fehlers von f für n=î
      if abs(TatsächlicherWert) > 10^(-10) then #Bestimmen des relativen Fehlers von f1 falls                                                          #dieser definiert ist
      SpeicherlisteYRel:=[op(SpeicherlisteYRel),abs(SpeicherlisteYAbs[-1]/TatsächlicherWert)];
    end if;
  end if;
end do;
if numelems(SpeicherlisteX)>0 then
  SpeichervektorX:=Vector[row](numelems(SpeicherlisteX),SpeicherlisteX);
  SpeichervektorYAbs:=Vector[row](numelems(SpeicherlisteYAbs),SpeicherlisteYAbs);
  PunkteAbsPY:= plot(SpeichervektorX,SpeichervektorYAbs,style = point, color=purple, legend = ["PY"]);
    #  Generierung des Punktgraphen, der sich aus den absoluten Fehlern von f ergibt
  if numelems(SpeicherlisteX)>1 then
    InterpolationsfunktionAbs:=Spline(SpeichervektorX,SpeichervektorYAbs,n);
      #  Splines aus Stützpunkten, die sich aus den absoluten Fehlern von f ergeben
    GraphAbsPY:= plot(InterpolationsfunktionAbs, n=nUnten..nOben, color=purple);
      #  Generierung des Graphen, der sich aus dem Spline aus den absoluten Fehlern von f ergibt
  end if;
end if;

if abs(TatsächlicherWert) > 10^(-10) then
  # falls der relative Fehler definiert ist analoges Vorgehen für die relativen Fehler
  if numelems(SpeicherlisteX)>0 then
    SpeichervektorYRel:=Vector[row](numelems(SpeicherlisteYRel),SpeicherlisteYRel);
    PunkteRelPY:= plot(SpeichervektorX,SpeichervektorYRel,style = point, color=purple, legend = ["PY"]);

    if numelems (SpeicherlisteX)>1 then
      InterpolationsfunktionRel:=Spline(SpeichervektorX,SpeichervektorYRel,n);
      GraphRelPY:= plot(InterpolationsfunktionRel, n=nUnten..nOben, color=purple);
    end if;
  end if;
end if;
NichtexistenzPY:=nOben-nUnten+1-numelems(SpeicherlisteX);
print(display({GraphAbsGK,PunkteAbsGK,GraphAbsPZP,PunkteAbsPZP, GraphAbsPZM,PunkteAbsPZM, GraphAbsPY,PunkteAbsPY}, title= "Absoluter Fehler", titlefont=["ROMAN",18]));
if abs(TatsächlicherWert) > 10^(-10) then
  print(display({GraphRelGK,PunkteRelGK,GraphRelPZP,PunkteRelPZP, GraphRelPZM,PunkteRelPZM, GraphRelPY,PunkteRelPY}, title= "Relativer Fehler", titlefont=["ROMAN",18]));
end if;
Text("Häufigkeit der Nichtexistenz: GK ",NichtexistenzGK, ", PZP ",NichtexistenzPZP, ", PZM ", NichtexistenzPZM, ", PY ", NichtexistenzPY);
      
 end proc

 

An example of how it should not look like is this:

Plotting(-1,1,2*x^2+2,1,3,10)

 

On a side note, Maple's return is

Warning, `GraphRelGK` is implicitly declared local to procedure `Plotting`
Warning, `GraphRelPZP` is implicitly declared local to procedure `Plotting`
Warning, `GraphRelPZM` is implicitly declared local to procedure `Plotting`
Warning, `GraphRelPY` is implicitly declared local to procedure `Plotting`


even though I did declare them.

 

Any suggestions on that minor issue? And on how to construct a math table which allows for a symbol like - for nonexistence?

 

Thank you in advance!

V1 := [1.666666667, 1.983050847, 2.372881356, 2.768361582, 
    3.380681818, 3.977272727, 4.767045455, 5.755681818, 
    6.937500000, 8.244318182, 9.801136364, 0.2971428571, 
    0.6914285714, 1.085714286, 0.3942857143]
dV1 := [0.03315280331, 0.03866282527, 0.04508264551, 
   0.05165406892, 0.06212371278, 0.07219635124, 0.08557994498, 
   0.1023815798, 0.1225076192, 0.1447933406, 0.1713677762, 
   0.01380612592, 0.01872473080, 0.02454205309, 0.01488350319]
V2 := [17/10, 2, 12/5, 14/5, 17/5, 4, 24/5, 29/5, 7, 42/5, 10, 3/10, 7/10, 11/10, 2/5]
dV2 := [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Hey,

i have trouble adding error bars to my plots despite experimenting with it for hours. I tried using ErrorBars but i never get close to what i need. What i have is V1 (values for y) and V2 (values for x) to produce a ScatterPlot which works alright. What i need is something like this: .

For the errors in x and y-direction i have 2 lists dV1 (y errors) and dV2 (x errors).

This is my first post and i´m a bit in a rush so please excuse me for any mistakes i may have made.

how are please I want to help In some graphs in maple 

the graph in the picture

thank you 

)

Hi,

I will start off with the programming already accomplished. The first part of programming was salvaged from mathexchange whereby I am able to perform combinations with repititions.

 

>with(combinat):
choosing:=proc(n,m,k:=1)
local duplicated:=[seq(op(n),i=1..k)]:
return combinat:-choose(duplicated,m):
end proc:
>choosing([w,b,g],4,4);
[[b, b, b, b], [b, b, b, g], [b, b, b, w], [b, b, g, g], [b, b, g, w], [b, b, w, w], [b, g, g, g], [b, g, g, w], [b, g, w, w], [b, w, w, w], [g, g, g, g], [g, g, g, w], [g, g, w, w], [g, w, w, w], [w, w, w, w]]
 

 

the next step I'm hoping to accomplish is to receive a list giving me a count of each value from each set of combinations. For example, in the first set i have 4 counts of black (b), 0 counts of white (w) and 0 counts of grey (g).  the second set tells me i have 3 counts of b, 0 counts of w and 1 count of g, etc.

the purpose of this is to apply a formula to each set of values.

So I recently bought a new desktop with Windows 10 installed. The problem is hard to describe so I put a picture. This problem occurs randomly (Mostly occurs after I click the right button, when browsing the option in the pop-up toolbar).

When this problem happens, if I move my mouse to any toolbar which suppose to pop-up a toolbar, the pop-up toolbar wont disspear. And ultmately leads to the picture I showned above.

Sorry for the bad explaintion but it is just like I said, it is hard to describe the problem. This PC arrives around Christmas and I downloaded Maple last week. And it never have been normal. This issue also happens to NetLogo (A model simulation software).

I asked DELL's technique services and they did a remote control to help me fix the issue. However, the problem doesn't solved (They worked on this for about 3 hours). It seems the only choice I have is to reinstall the Windows. 

Does anyone have met this problem or know who met it before? Please let me know and I'm really appreciate it.

 

 

Is there a workaround for this?

restart;
int(sqrt(x)*sin(sqrt(3)*ln(x)/2),x)

The answer according to Mathematica is

Maple 2020.2 on windows 10

 

Dear all

I have a nonlinear PDE, I use a transformation depend on some paramaters I would like to find the scalling parameters so that the pde is invariant under the proposed transformation.

PDes_invariant_under_transformation.mw

Thak you for your help 

 

Here is what I'm trying to do. Say I have a Digraph G1 defined by:

with(GraphTheory):
G1:=Digraph([a,b,c],{[[a,b],2],[[b,c],3],[[c,a],4]});

I would like to produce the undirected graph G2, with the same weights:

G2:=Graph([a,b,c],{[{a,b},2],[{b,c},3],[{c,a},4]});

After looking in the GraphTheory package, I found UnderlyingGraph, which seems to do what I want.

Namely,

G3:=UnderlyingGraph(G1,weighted=true);

I had a first problem: there is a bug in the documentation, as the option is 'weights' in the documentation, whereas the source code shows it must be 'weighted'.

 

But then I had another problem, but maybe I didn't understand the purpose of UnderlyingGraph: apparently, I don't get G2. For instance:

 

DijkstrasAlgorithm(G1,a);
            [[[a], 0], [[a, b], 2], [[a, b, c], 5]]

DijkstrasAlgorithm(G2,a);
              [[[a], 0], [[a, b], 2], [[a, c], 4]]

DijkstrasAlgorithm(G3,a);
            [[[a], 0], [[a, c, b], 0], [[a, c], 0]]

The problem seems to come from the weight matrix, which is not symmetric (it is for G2):

WeightMatrix(G3);
                           [0  2  0]
                           [       ]
                           [0  0  3]
                           [       ]
                           [4  0  0]

Edges(G3,weights=true);

{[{a, b}, 0], [{a, b}, 2], [{a, c}, 0], [{a, c}, 4], [{b, c}, 0], [{b, c}, 3]}

 

However, G3 is undirected:

IsDirected(G3);

          false

So, the graph is undirected, but it has different weights for a-b and b-a. Weird.

Now, I am wondering what UnderlyingGraph is supposed to return. After looking at the source code, it seems the statement EW := EW0 + LinearAlgebra:-Transpose(EW0) builds a symmetric weight matrix, but for some reason it's not what is returned.

Is this a bug in the function? Or did I do something wrong? Is there a better way to achieve what I wanted?

 

>(solve(0 < M^2 - 4*m^2, M) assuming (0 < M, 0 < m))

>with(plots):

>inequal(0 < M^2 - 4*m^2, M > 2*m, m = 1 .. 5)

I know that it won't work:

Error, (in plots:-inequal) invalid input: Plot:-Inequality expects its 2nd argument, r1, to be of type name = range(And(realcons, Not(infinity))), but received 2*m < M

I even try

>inequal(0 < M^2 - 4*m^2, m = 1 .. 5, 2*m < M)

But is it possible to do it another way. Could it be an added functionality.

Of course, if I write values like this:

>inequal(0 < M^2 - 4*m^2, m = 1 .. 5, M = 2 .. 10)

I get a plot, a triangle.

 

Hi, 

I have always asked myself this question: why do the colon after the proc(...) statement generate an error if the following statement is local or global?
(the third example is here to show that no error occurs if local is omitted... the warning is of course obvious)

restart:
interface(version);
Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895

f := proc(x) local y: y:=x+1 end proc:

g := proc(x): local y: y:=x+1 end proc:
Error, unexpected `local` declaration in procedure body

h := proc(x): y:=x+1 end proc:
Warning, `y` is implicitly declared local to procedure `h`

TIA

plot(['h'(floor(n))[1], 'h'(floor(n))[2]],n=1..10);
Error, (in plot) ifactors takes an integer or a factored integer

 

h simply uses ifactors. I can calculate with it no problem, e.g., h(3), h(10)... but in plot it does not work. I've tried convert, Integer, etc and nothing works.

Calculation of these integrals takes much time.

Is there a way to reduce the time?

MY_SYSTEM.mw

 

Hi

can anyone help me to solve second order ode, I am unable to find the value of the involved constant of integration

 

ode_solution_help.mw

 

 

 

 

We consider an ellipse  E defined by the equation x²/a²+y²/b²=1. Either F1 and F2 its foci. 
We consider a point M of E  such the angle F1,M,F2 is equal to a given value phi.
Find F1M et F2M in function of a, b and phi . Then find the coordiinates x0 and y0 of M in function of a, b, and phi. Here is the begining of my code;

restart;
_EnvHorizontalName := x: _EnvVerticalName := y:
with(plots):
line := proc (x1, y1, x2, y2) options operator, arrow; (x-x1)*(y2-y1)-(y-y1)*(x2-x1) end proc:
Vdot := proc (U, V) add(U[i]*V[i], i = 1 .. 2) end proc:
dist := proc (M, N) sqrt(Vdot(expand(M-N), expand(M-N))) end proc:

ell := x^2/a^2+y^2/b^2 = 1: 
c := sqrt(a^2-b^2):
F1 := [c, 0]: F2 := [-c, 0]:
M := [a*cos(t), b*sin(t)]:
MF2 := simplify(expand(sqrt((c+a*cos(t))^2+(b*sin(t))^2)));
MF1 := simplify(expand(sqrt((c-a*cos(t))^2+(b*sin(t))^2)));
varphi := arccos((MF1^2+MF2^2-4*c^2)/(2*MF1*MF2));
f := unapply(varphi, t);
`max&varphi;` := f((1/2)*Pi);
diff(f(t), t);

a := 7: b := 5: t := (1/3)*Pi:
evalf(varphi);
evalf(MF1); evalf(dist(M, F1));
evalf(MF2); evalf(dist(M, F2));
MF1+MF2; evalf(%);
`max&varphi;`; evalf(%);
ELL := implicitplot(ell, x = -a-2 .. a+2, y = -2-b .. b+2, color = blue):
tp := textplot([[F1[], "F1"],[F2[],"F2"],[M[],"M"]], 'align' = {'above', 'left'}):
po := plot([F1,F2, M], style = point, symbolsize = 15, symbol = solidcircle, color = red):

display([ELL, tp, po], scaling = constrained): Would  you help me to answer the questions ? Thank you.

Hi,

I am studying nonlinear differential equations, and I want to compare software that gives exact solutions to software that gives numerical solutions.

In the attached Maple document, I try to solve a nonlinear ordinary differential equation numerically, but it seems like the numerical solver cannot solve this type of nonlinear ODE.  Are there any numerical solvers in maple that can find a solution to this equation?

 

Steve

Differential_equation_to_solve_numerically.mw

First 324 325 326 327 328 329 330 Last Page 326 of 2097