Axel Vogt

5821 Reputation

20 Badges

20 years, 229 days
Munich, Bavaria, Germany

MaplePrimes Activity


These are answers submitted by Axel Vogt

Using 'listtoalgeq' fails to propose a solution and 'listtodiffeq'
has difficulties with the initial conditions.

Recursion at least gives an answer, which however is not a solution:

  #with(gfun):
 
  L:=[seq(1/(n^2+1), n=1..10)];
  
  listtorec(L,u(n)); %[1]:
  rsolve(%,{u});
  op(%): evalc(%): simplify(%);

                 2            2
   [{(2 + 2 n + n ) u(n) + (-n  - 4 n - 5) u(n + 1), u(0) = 1/2}, ogf]


                                     1
                         u(n) = ------------
                                           2
                                2 + 2 n + n


Similar problems occure for K:=map ('x -> 1/x', L) and starting the
sequence in n=0 does not allow rsolve to find a solution.

So may be at http://www.research.att.com/~njas/sequences/ you can
find hints or literature (I think there is an off line version as
well).

The last I tried was 'Guess' and 'HyperG' - these older stuff from
Bruno Gauthier (based on a MMA solution by Krattenthaler) does not
work with Maple 11, it is said to be for Maple V (I filed that once
but never used it).

obviously you want a numerical solution and since finding code by 'exporting' from Maple does not I would search for decent code through the web, certainly there is some solid solution

PS: my impression is you already posted under different usernames - if so, you may want to re-think that

i know such things from (material) logistics, where coding on the (index) of databases is done through control breaks (? "Gruppenwechsel" in German), and if done on an index some provide the history (=frequency) - are you discussing some theoretic back grounds for this?

thx for nailing it down, that was worth the effort

May be that comes through a bug in 'simplify' or 'abs'.

Define I3:=PDEtools[dchange](x=1/u ,I1) with integrand p:=op(1,%) =
abs(-1/u*sin(u^2)+cos(u^2)*u) / u^2, which is your I2, but with the
absolute sign is not forgotten.

Now apply 'simplify' to I3:

  simplify(I3);

                    infinity
                   /               2         2   2
                  |          -sin(u ) + cos(u ) u
                  |          --------------------- du
                  |                    3
                 /                    u
                   1

which Maple evaluates to -1/2*sin(1) and that coincides with the
given value for I0 ( u=1/x shows it to - I0).



This leads to find the following bug: 

Both simplify(p) and simplify(p,symbolic) behave correct. However
they do not if using assumptions:

  q;


                      |        2              |
                      |   sin(u )        2    |
                      | - ------- + cos(u ) u |
                      |      u                |
                      -------------------------
                                  2
                                 u

  simplify(q) assuming 0<u;
  # plot(%,u=1 .. sqrt(2*Pi));

                              2         2   2
                        -sin(u ) + cos(u ) u
                        ---------------------
                                  3
                                 u

To be sure that this is not caused through the 'assuming' command
one produces the same error through 'assume':

  assume(0<v): eval(p, u=v): simplify(%);

                              2         2   2
                        -sin(v ) + cos(v ) v
                        ---------------------
                                  3
                                 v

Strange that eval(p, u=sqrt(v)), eval(p, u=v^2) or eval(p, u=(v+1))
work as expected.

Since it is not unlikely that IntegrationTools[Change] uses 'simplify'
that would 'explain' it and would not mean that the integration itself
has an error here: may be 'Change' wants to use information about the
range of integration.


In fact the reason might be in the 'abs' function:

  r:=(sin(v^2)+cos(v^2)*v^2)/v^3; # we have 0 < v
  s:=abs(r);
                                2         2   2
                           sin(v ) + cos(v ) v
                      r := --------------------
                                     3
                                    v


                                2         2   2
                           sin(v ) + cos(v ) v
                      s := --------------------
                                     3
                                    v

Which is false, just plot it. While eval(r, v=u); abs(%); works ok ...
only a minor comment:

  PDEtools[dchange](x=1/u ,I1);
  student[changevar](x=1/u ,I1,u);
seem not to ignore the absolute value.
Have not used VBA for a longer time ... First correct a 'feature' in Excel's
modulo function and then translate the EGCD given by Roman Pearce. The code
has just to be copied into a module of an Excel VBA project.


Function myMod(a As Long, p As Long) As Long
' check that for a=-20, p=7: Excel would return -6, we want positive numbers
myMod = (a) Mod p
If a < 0 Then
  myMod = myMod + Abs(p)
End If
End Function


Function invMod(m As Long, p As Long)
' returns invers modulo p using the extended GCD algorithm (Knuth?)
Dim a As Long, b As Long, q As Long, t As Long, x As Long, y As Long

a = p
b = m
x = 1
y = 0
While Not (b = 0)
  t = b
  q = Application.WorksheetFunction.Floor(CDbl(a / t), 1)
  ' CodeGeneration[VisualBasic] is not aware of that VBA, it uses VB
  b = a - q * t
  a = t
  t = x
  x = y - q * t
  y = t
Wend
If (y < 0) Then
  y = y + p
End If
invMod = y
End Function


Sub tst_invMod()
' test, to be displayed in the debug window
Dim a As Long, p As Long, b As Long, ab As Long, j As Long

p = 23 ' prime
For j = 1 To p - 1
  a = j
  b = invMod(a, p)
  ab = myMod(a * b, p)
  Debug.Print a & "^(-1) mod(" & p; ") = " & b, _
    "a*b mod(" & p & ") = " & myMod(a * b, p)
Next j
End Sub


The largest (signed) integer of type long is 2^31 in VBA. Taking
p = prevprime(2^31) = 2147483647, a = prevprime(p) = 2147483629
one immediately gets a^(-1) = 119304647, which equals Maple's answer.

The ugly worksheet & search method is limited to p < 65536 and
should be quite slow. 

but a fixed correlation does not make sense, it is known to by stochastic & clustered

portfolio simualtion is a field of its own, especially if one has assets of different types (say credit + equity)

it is minor a question of Maple or not ...

here some reading www.nuclearphynance.com/User%20Files/2/Dispersion%20-%20A%20guide%20for%20the%20clueless%201.1.pdf

and as a side remark: the subprime crisis shows how much it is worth to believe in models and simulation :-)

it means that one has to sum over the roots of the equation, which is a polynomial of degree 3 - so they are 'explicitly' known

and usually (depending on your setting) will supress those complicated answers, you can enforce it to show them by 'allvalues'

so may use allvalues(%):  evala(%):  simplify(%,size); to see the result

I played with it, using Digits:=14, here is my hack:

  F:=lhs(eq1)-rhs(eq1); 
  RootOf(F,lambda, 1e-10 .. 10 ); 
  R:=unapply(%,alpha);

Then plot(R(alpha), alpha=0..6) has a some 'jumping' just below 5
and in other plot ranges.

Looking at the Taylor series by MultiSeries:-series(%, lambda, 3)
lets me try to kick off the solution lambda=0 by re-defining

  G:=F/lambda^(1/2*alpha-1/2) # same zeros as F

Proceeding similar for G still gives a similar problem. So try better:

Now up to 1st Order MultiSeries:-series(G, lambda, 2) = 0 is solved
by alpha. And one can guess that there are 2 regimes: lambda ~ alpha
below 2 and lambda ~ alpha/3 for large values.

Thus I try:

  S:=proc(a)
    global G, lambda;
    eval(G, alpha=a);
    fsolve(%, lambda=a/4);
  end proc;

Then some test

  S(2); 
                           2.5064979940915
  S(25.3);
                           9.5380145635235

and the following plots smoothly:

  plot('S'(a), a=0..20);

what does it contain? i do not want to download huge things + install + clicking through topics ...

well, I would not want to test it on my own PC, but if i have some time may be i will try to install and test it at work (this usually means to buy some icecream for the admins and otherwise keep them busy by complaining formatting problems while printing letters on various printers through the company or so ...)

in former times i used to change system times for testing several Excel solutions (to see, whether they work correctly beyond certain date switches having a complicated trading calendar) or old sheets (having time values to be set only through system time, back from a productive environment) or Word macros (dito) or compiled DLLs (similar).

That would totaly mess up any Maple installation , no?




I prefer to have Sum and use lhs(%) - rhs(%) with is(%=0):  

  y*(Sum(a[n]*y^(n-2)*n*(n-1), n = 0 .. infinity)) 
  - 
  (Sum(a[n]*y^(n-1)*n*(n-1), n = 0 .. infinity));
  combine(%);
  simplify(%);
                                  0


For the database: twice continuously differentiable may be needed to work *properly* (but have not looked it up).
At least you can try to approximate your function by such things?

The other is more work and related to the (by numerical errors only?) above example: you could try to sum the
squares of the components of your equations. And try to use a minimizer, since a minimum =0 gives a zero,
the minimzer should allow to search not only locally. But I am to lazy to do that.

First 79 80 81 82 83 84 85 Last Page 81 of 92