Axel Vogt

5821 Reputation

20 Badges

20 years, 228 days
Munich, Bavaria, Germany

MaplePrimes Activity


These are replies submitted by Axel Vogt

r:= sin(x)+x*cos(x) < 1/2;
f:= piecewise(r, sin(x), cos(x));

Int(f, x=-1..1); value(%); returns un-evaluated, it seems that a condition fct(x) is an issue

tst0:=abs(sin(x)+x*cos(x)) = 1/2;
solve(tst0, useassumptions) assuming 0<x,x<1; # no solution
fsolve(tst0, x=0..1); # gives a numerical value

In the standard interface (and on Win): menubar / File / Export as opens a dialog window.

There one chooses directory location, file name and file type. The file type can be selected from a list where RTF is the very last entry (scroll in case you can not see it).

It works the same way as exporting a sheet as PDF.

I export the file as *.rtf or as *.html which gives me reasonable quality for the pictures. Processing depends a bit on the text program.

As far as I understand (through the last link) it is an asserted solution for pricing amercan options (without dividend - hm ...),

www.alexbraunstein.com/Untitled.pdf, http://alexbraunstein.com/scripts/ and there  American Option Valuation code  in Phyton

I am not aware of the concurrent state of discussion but suggest you ask first at https://forum.wilmott.com/ and http://www.nuclearphynance.com/ (after having some some search on those forums).

Do you know or guess any (rough) value in the plotrange?

MP_220736.mws

I perhaps do not fully understand the question, but this may be the answer:

Digits:=15;

f := x-> exp(-(1/2)*x^2)/sqrt(2*Pi);
f(x)*f(y)*x*x*'abs'(x+y);
convert(%,piecewise,x):
convert(%, Heaviside): simplify(%); # <-----------
Int(%,x=-infinity..infinity,y=-infinity..infinity);
value(%); #lprint(%);               # almost immediately
evalf(%);

                             3/Pi^(1/2)

                         1.69256875064326

# I had no patients to wait for numerical evaluation of the integral (*)
 

Int(Int(1/2*F(1/2*v+1/2*u,-1/2*v+1/2*u),
  u = -infinity .. infinity),v = -infinity .. infinity);
task:=eval(%, F = '(x,y) -> (f(x)*f(y)*x^2)*abs(x+y)');

st:=time():
evalf(task);
`seconds needed` =time() - st;

                           1.69256875064327

                        seconds needed = 6.225

'piecewise' for that needs ~ 26 sec

(*) but one can manage it as follows
g := convert((f(x)*f(y)*x^2)*abs(x+y), piecewise, x):
g:=simplify(%);

task_2dim:= Int(g, x = -infinity .. infinity,y = -infinity .. infinity,
  method=_CubaCuhre, epsilon=1e-8); # accept some relative error

st:=time():
evalf(task_2dim);
`seconds needed` =time() - st;

                           1.69256875069424

                       seconds needed = 11.716

 

You may try to use 'Heaviside' instead (please note that Heaviside(0) has
to be defined in case it is needed):

f(x)*f(y)*x^2*abs(x+y); # the integrand
convert(%,piecewise,x);
convert(%, Heaviside);
simplify(%);        # just to avoid multiple calls
int(%,x=-infinity..infinity,y=-infinity..infinity);


                                  3
                                -----
                                  1/2
                                Pi

Perhaps (here) the best is to use a change of variables x+y=u, x-y=v.
I am not aware that Maple supports it directly (*), here it is:

Int(Int(F(x,y),y = -infinity .. infinity),
  x = -infinity .. infinity) =

Int(Int(1/2*F(1/2*v+1/2*u,-1/2*v+1/2*u),
  u = -infinity .. infinity),v = -infinity .. infinity)

where F = your original integrand.

For that also numerical evaluation is fast.

But as others already noted: no need to convert to piecewise here
(exhibiting a bug)

(*) PS: Using IntegrationTools[Change] refuses to give the new integration
bounds (since in general that formula expects a rectangle), but here we
have a linear transform, so this is the full plane again, a rectangle.

Yes.

A more invariant formulation is that hypergeom([1/3, 2/3],[3/2],w)
satisfies a cubic equation and task = picking a specific 'root'.
The equation follows from the ODE approach, this_2F1 = algebraic.


4*h^3*w-27*h+27:

0='eval'(%, h=hypergeom([1/3, 2/3],[3/2],w));
convert(%, StandardFunctions):
convert(%, expln): evala(%): # gives 0
is(%);

             3               |
     0 = (4 h  w - 27 h + 27)|
                             |h = hypergeom([1/3, 2/3], [3/2], w)


                                 true

On the other hand one has

4*h^3*w-27*h+27;
eval(%, w=27/4*z^2*(1-z));
S:=[solve(%, h)];
#plot(%, color=[red,blue,green]);

   S := [1/z,
          1/2*(+1-z+(-3*z^2+2*z+1)^(1/2))/(-1+z)/z,
         -1/2*(-1+z+(-3*z^2+2*z+1)^(1/2))/(-1+z)/z]

hypergeom([1/3, 2/3],[3/2],27/4*z^2*(1-z)):
'eval(%, z=2)'; convert(%, StandardFunctions): evala(%);

                                 1/2

"Hence" one has it as S[1] = 1/z

This is similar to the answers given by vv and Kitonum.

Plotting S "explains" why 1 < z (i.e. w < 0).

I forgot the definition, find it now in the post.
The f is for defining the DE.

The picture does not say "distance matrix". The shown distances / routes may be be weighted ('penalty, costs'). No ?

a := 0.76;
#a:=0.8;
eq1 := 2*cot(a*sqrt(2*E)) - (2*E-5.4)/(sqrt(E*(5.4-E)));
EQ:=convert(%, rational);
solve(%, E);
[allvalues(%)]; evalf(%);

# or RootOf(EQ, E); [allvalues(%)];

added: E=0 is a bit strange anyway ...

Sorry, I have no other suggestion.

I once played with connecting Maple and Excel, but I do not use it.

In your case I would work with functions and procedures, store them in some
*.mpl file (= pure ASCI text). Using "read" in Maple provides it. That avoids
the usage of modules amd should work for all versions.

If you have only a small amount of data then you can work with that directly.
If one has large data sets (say measured data) then you can use import/export
=read/write data files.

PS: you do not need "makeproc" for those 2 functions, you just write them down.

I do not understand it - if you do not have some special requests (high precision, complex values or similar, caring for singularities ... ) all that can be done in Excel using VBA. Where I guess that your "x(t)" is a function of t (and Excel can calculate it)

Your "GeometricData" are parameters - either being feed to the functions(s) itself or being set as 'globals' in VBA.

Note that "portable" is relative: you always would need to have Maple installed.

@Spinosaurus just try it as described, may be using the example covered by Kitonium and post you attempt.

First 22 23 24 25 26 27 28 Last Page 24 of 207