Axel Vogt

5936 Reputation

20 Badges

20 years, 252 days
Munich, Bavaria, Germany

MaplePrimes Activity


These are answers submitted by Axel Vogt

For the original question: it seems you are asking more a Math question than something about Maple and in general that is only true under some additional assumptions, as soon as the Sum consists of infinitely many terms (sorry, I do not have a counter example at hand).

If your Sum has only finitely many terms then it is (theoretical) no problem (but perhaps a numerical one).

May be you want to 'scan' through some books about Analysis (take basic ones or try Google to find something for free).

If you have some specific in mind then do not hesitate to post it.

why dont you simply enter you task into a classical sheet and upload that?

for me it unclear what you want to have entered and that should be prior to a pretty appearance

I prefer that the circle around m with radius r writes as m + r*exp(I*t):

 m + r*exp(I*t); subs(m=2,r=2, %);
 plot( [Re(%), Im(%), t=-Pi .. Pi] );
.16170364991273, 
.26384803654056+.13752205539014*I, .26384803654056-.13752205539014*I

I have not followed the other answers, but essentially (using 14 Digits) I just used your e4
in a fresh restart, took lhs - rhs and called it w (renaming u1 to be u).

Then rationalize(w); convert(%, rational) shows poles.

So I used rationalize(w); numer(%); convert(%, rational); W:=sort(%);

solve(evalf(W),u); gives it and it remains to care for the denominator (whether there is
some liftbale singularity).

Hope it is not too odd.

Say you have f := x -> 4*x^2-7*x+80; # or any other.

Then you want to have some s, which [for all x] satisfies f(s+x)=f(s-x).

And that means you have to solve for that s.

How would you do with paper and pencil? And then how you would do with Maple?

In that example you should find s = 7/8.

a := x->piecewise(x<0,x^2,2*x);
tmp:=codegen[makeproc](a(x),[x]);
tmp:=codegen[prep2trans](tmp);
CodeGeneration[C](tmp);
int tmp (int x)
{
  if (x < 0)
    return(x * x);
  else
    return(2 * x);
}

That also applies to the break condition in the while statement ...

Reading such an error statement is puzzling when seeing it the first
first time really annoying, it should come with a hint :-(

Note, that 'is' can be very expensive. A weaker form would be to use
'signum' (together with _Envsignum0:=0) and in that case I would test
f(a) and f(b) for signs separately (and not the product).

Omitting refinements you can play with it as follows (make all your
modifications within the proc, like using 'is'):

bisec:=proc(f,A,B,eps)
  local a,b,m;
  a:=A; b:=B;
  while 0 < signum( abs(b-a) - eps ) do
    m:= (a+b)/2:

  # use one of the following 'if' statements or some 'is'
  #  if 0 < signum(f(a)*f(m)) then a:= m: else b:=m: end if:
    if signum(f(a)) <> signum(f(m)) then a:= m: else b:=m: end if:

    print('(a,m,b)' = a,m,b);
  end do:
  return (m);
end proc;

and then apply it to a 'symbolic situation':

f:= x-> x-2^(-x);
a:=1/sqrt(2)/2; b:=1; k:=32; eps:= 2^(-k);

x0:=timelimit(2, bisec(f,a,b,eps) );

Suggestion: write xLoop = 1 + I*j

for j from 1 to 7 do # no semicolon (!)
  x := 1 + I*j;
  x + I;
end do;

It is a complete VC2005 project, example_external_mul.zip, but you should be able to migrate it (have not cared for removing 'name decoration' for the exported function)

PS: If the board search works as promised, than you should be able to find examples for external calls posted by Alec (Mihailovs)

PPS: the uploader is bad configured, the correct file name has a 't' at the end, but is cut off - why restrict to 20 chars?

I do not think the approach to the problem makes sense beyond examples,
but here is a way:

Your recursion is x(n+1) = a(n)*(1-x(n))*x(n), a(n+1) = w+a(n) and you
let it start in 0.

Then you have initial values a(0) = alpha, x(0) = xi and some w.

The recursion for a is shifting by w and has a closed form

  rsolve({a(n+1) = w+a(n), a(0)=alpha}, {a});
  simplify(%);
 
                         {a(n) = alpha + w n}

and therefore your recursion is x(n+1) = (alpha + w*n)*(1-x(n))*x(n),
which can be written as procedure to give you results after n steps:

For saver coding first express x(n) in terms of x(n-1)

  x(n+1) = (alpha + w*n)*(1-x(n))*x(n);
  eval(%, n=n-1);

          x(n) = ((n - 1) w + alpha) (1 - x(n - 1)) x(n - 1)

and then write the recursion down as

  R:= proc(xi,alpha, w , n::nonnegint)
  local x0, x1;
  option remember;                # look up the help for this option
  if n=0 then return xi end if;   # initial value
  x0:= R(xi,alpha, w, n-1);       # this stands for x(n-1);
  x1:= ((n-1)*w+alpha)*(1-x0)*x0; # we just did that
  return x1;
  end proc;

Do a check for the first few steps, to check for coding errors by

  R(xi,alpha, w , 1);
                          alpha (1 - xi) xi

  R(xi,alpha, w , 2);

        (w + alpha) (1 - alpha (1 - xi) xi) alpha (1 - xi) xi

But be aware, that it will 'explode' in size very soon, for = 20:

  'R(xi,alpha, w , 20)';
  length(%);             # length in characters
  evalf[2](%/80/60);     # ~size in printed pages

                                5900.

This says: after already 20 steps the expression would be 5900 pages
long, covering several books. And trying to handle it with Maple is
likely to crash it soon, for n=25 you get 190000 pages. Forget n=100.
You need Math for that (do not ask me), not a computer system.

The following is an Excel script (I used such ~ 10 years ago)

It loads and saves 2 URLS and reports times and finally loads a local page and saves it. It only uses system DLLs for WIN. And thus should allow to analyze time needed by Maple queries.

PS: I also tried to use the DLL from Maple, which works, however not for the parametric URLs (no idea why not, but that's a question for adult users ...)

Option Explicit

Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
  "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _
  szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Sub UrlSave()
Dim Url1, Url2, Url3 As String, Destination1, Destination3 As String
Dim ReturnValue As Long
Dim st
  Url1 = "http://www.google.com/finance/historical?q=INDEXEURO:.FCHI&histperiod=daily"
  Url2 = "http://www.google.com//finance/historical?q=NASDAQ:MSFT"
  Url3 = "d:\temp\w.htm"
 
  Destination1 = "d:\temp\google.htm"
  Destination3 = "d:\temp\google_copy.htm"
 
  st = Timer
  ReturnValue = URLDownloadToFile(0, Url1, Destination1, 0, 0)
  st = Timer - st

  If ReturnValue <> 0 Then
    MsgBox ("Unable to load URL")
  Else
    MsgBox ("URL saved, time needed [sec]: " & st)
  End If
 
  st = Timer
  ReturnValue = URLDownloadToFile(0, Url2, Destination1, 0, 0)
  st = Timer - st

  If ReturnValue <> 0 Then
    MsgBox ("Unable to load URL")
  Else
    MsgBox ("URL saved, time needed [sec]: " & st)
  End If
 
  st = Timer
  ReturnValue = URLDownloadToFile(0, Url3, Destination3, 0, 0)
  st = Timer - st

  If ReturnValue <> 0 Then
    MsgBox ("Unable to load URL")
  Else
    MsgBox ("URL saved, time needed [sec]: " & st)
  End If
 
End Sub

PS: can not remember the origin of the code, but Google on "moniker"
should give lots around that.

PPS: the issue using Maple with that API may be related to cookies,
for example a ping for the URLs fails

For testing I 'monitored' download time for both

http://www.google.com/finance/historical?q=INDEXEURO:.FCHI&histperiod=daily and
http://www.google.com//finance/historical?q=NASDAQ:MSFT

and on my slow connection here at home it is almost 2 sec for downloading the page (no gifs and I think the scripts in the page are not executed for this), which more or less would give those 8 sec for 4 calls (one only could speed up by doing it in parallel, since the channel certainly allows much more).

For that I used a pure Windows function, urlmon.dll.

If you want to know Maple's timing you can try to access a *local* file (for example: store those 2 Google pages), where you have to be 'sure' that the call does not trigger anything, which would make the machine or system think it should call to www again (not sure, that this is guaranteed by the calls).

In some sense it is not too surprising, if the data vendor sets some limitations

PS: how idiotic by the board software to place alex' answers below mine only because his one has 2 thumbs down, really a logical idioty

With Excel there is 'nothing' to code (just some configuring a sheet for such a query), see its help.

Exporting or processing data is a different thing, in any system I would guess.

And most of the time is spent on retrieving data from the web (you have to look up some Excel sites, but I guess if you feed various sheets in a book they are done non-exclusively).

query_example.zip

Edited: or better and more general one may wish to consider downloader programs like the old 'wget' (have not checked for Google) or similar writing to files, to be processed by what ever.

You have to enforce y(0) = 1, y(1) = 5 and what you want is named "Dirac" in Maple:

restart;
y(n)-3*y(n-1)-4*y(n-2)=delta(n)+2*delta(n-1);
rec:=eval(%, delta=Dirac);
rsolve({rec ,y(0) = 1,y(1) = 5}, y(k));

                                  k      k
                              (-1)    6 4
                            - ----- + ----
                                5      5

PS: I would use "recursion", "rsolve" and "delta function" as tags
PPS: Robert was faster ...

If I read it correctly, then you try to find the points, where a quadric
and cubic intersect in dim = 2.

But you do not even say over what you are working (i.e. where your parameters live).

May be 'Groebner' can help you (see the help pages, difficult to use).

But my feeling is: that is a bit too general, it should heavily depend
on the parameters (and the ring) and as an example: let the quadric be
degenerated to be a line or a constant (or worse think of the cubic).


Perhaps I would try first to reduce the quadric to their normal forms
(char not 2) and transform the cubic to the same coordinates.

Not sure what it means, that the cubic is of pure degree = 3.

First 50 51 52 53 54 55 56 Last Page 52 of 93