MaplePrimes Posts

MaplePrimes Posts are for sharing your experiences, techniques and opinions about Maple, MapleSim and related products, as well as general interests in math and computing.

Latest Post
  • Latest Posts Feed
  • Following an idea of Peter Jäckel ("Probably the most complicated trivial issue in financial mathematics: how to compute Black's implied volatility robustly, simply, efficiently, and fast") it is shown, how an initial guess has to be taken to backout volatility from given option prices - with an astonishing good quality. The original uses more numerical computations, which I replace by Lambert's W function, Maple is of great help for that. In a second part the guess is refined to a numerical solution using Newton's method, where only some steps are needed to achieve machine precision: Through Lambert's function and an appropriate scaling about 3 steps are enough by using a higher order method.
    In Maple 11 I use 'Maple notation' (as opposed to the new option '2-D Math Notation'), partly because I'm used to that from Maple 9.5, and partly because only in 'Maple notation' tabbing can be used (to format longer codes nicely). But it seems to me that Maple 11 cannot get the formatting correctly. An example: 1. Type the following code (where the second line is tab-indented):
    for a from 1 to 4 do
    	print (a):
    end do:
    
    2. Copy-paste this code to a new execution group. Now the problem is the following: Pressing the End-button on the keyboard, the end of the print-line (in the copy-pasted code) cannot be reached. Only after having manually removed the tab-indentation and reinserted it again can the end of the line be reached.
    Consider the following two codes: Code 1:
    restart:
    with(LinearAlgebra):
    M1,M2 := Vector(2,fill=Matrix(4,4))$2:
    M1[1] := M1[1] + IdentityMatrix(4):
    M2[1] := M2[1] + IdentityMatrix(4):
    M1[1];
    
    Code 2:
    restart:
    with(LinearAlgebra):
    M1,M2 := Vector(2,fill=Matrix(4,4)),Vector(2,fill=Matrix(4,4)):
    M1[1] := M1[1] + IdentityMatrix(4):
    M2[1] := M2[1] + IdentityMatrix(4):
    M1[1];
    
    According to my knowledge they ought to give identical output: the 4-dimensional identity matrix. But they don't. The first code gives twice that, as if M1[1] and M2[1] reference the same object in memory. The second code gives the correct answer.
    It's a new day, but not a new problem. Yesterday I asked about solving inequalities with abs. Today I am looking at solving an equation with abs. Try the following:
    restart;
    q :=  sin(x)/x - 1:
    test4 := y -> [ y,
                    solve( q=y, x ),
                    [solve( abs(q)=y, x )],
                    fsolve( q=y, x ),
                    fsolve( abs(q)=y, x ) ]:
    test4(  0  );
    test4( 0.1 );
    test4( 0.5 );
    test4( 1/2 );
    test4(  1  );
    
    [                         /sin(x)           \                -13]
    [ 0,   0, [0],      fsolve|------ - 1 = 0, x|, 1.869896012 10   ]
    [                         \  x              /                   ]
    
    I have a project where I'm trying to establish the identification of systems of equations (usually 10 or so equations). The systems can be under- exactly- or over-determined. If over-determined, I would like to know what constraints would need to be made to identify the system. For example, with the system: x + y = a x - y = b 2x + 2y = c Is there a way to have Maple return that c = 2a? Also, in some cases when the system is under-determined I get parametric solutions but in other cases I get {} (which is the same result returned for over-determined equations). Does anyone know
    Quick, what numbers x satisfy:
    abs( x-2 ) < 1
    
    How does Maple answer this?
    solve( abs( x-2 ) < 1, x );
                             RealRange(Open(0), Open(2))
    
    Now, change the RHS to 1. (floating-point 1):
    solve( abs(x-1) < 1., x );
               RealRange(1., Open(2.)), RealRange(Open(0.), Open(1.))
    
    Of course, these two intervals can be combined to the one interval. Maple 10 did not have this problem. (I will explain what Maple 11 is doing later, I want the next paragraph to appear in the truncated version of this post.) This issue is important for those of us trying to use Maple in the classroom. While it's not difficult to explain what is going on, the point is that this is not the mathematics I am trying to teach and these issues are a distraction.
    Run the following two pieces of code plot(3*arctan((-1+x)*x/(-2+x))/x, x = 0 .. 1) int(3*arctan((-1+x)*x/(-2+x))/x, x = 0 .. 1) There seems to be a bug in "int" I am using Maple 10.
    I've submitted to Maplesoft some suggestions for Help pages in Maple 11.01. A copy is online, and comments on it would be welcomed: View 4119_HelpSuggestions--1101.mw on MapleNet or Download 4119_HelpSuggestions--1101.mw
    View file details Note that the document is “live”—i.e. if the cursor is on an italicized word (preceded by “?”), and you press Enter, then the Help page comes up.
    Can anyone explain how to write a 10 consecutive sequence of odd x^3 natural numbers?

    The functionality to extend and augment the context-sensitive menus is quite nice. I especially like the submodule ContextMenu:-Test whose exports allow one to programmatically test the results and new menus.

    But what about installing menus with items whose type checks relate to locals?

    Here's a simple example.

    > newCM:=ContextMenu:-New():
    > newCM[Entries][Add]("local to global", "convert(%EXPR,`global`)", `local`):
    > newCM[Entries...

    Hi, again. Another applied problem arose today which requires me to compute all the roots of a polynomial with real coefficients. The degree needs to be left arbitrary. I only see vague references on the internet to the very abstract, symbolic "formula" (if one wishes to call it that) for all the roots of a polynomial in terms of siegel (siegal? seagel?) elliptic modular functions. No one ever seems to try to use it. The only person I know who ever wrote out the formula was Hiroshi Umemura, professor from Nagoya University in Japan. I actually contacted him once, back in 1994. But
    What does a return statement mean within a module's body, but not within ModuleApply, ModuleLoad, or ModuleUnload procedures?

    Is the disappearance of the return line, and the u:=3 line that follows it, some sort of automatic simplification? I'm not even sure what such a return statement is supposed to mean, in a module's body but not in ModuleApply et al.

    > module() local u; u:=2; return; u:=3; end:
    > convert(%,string);
    "module () local u; u := 2; end module"

    When I mention automatic simplification here I mean things like the disappearance of the if..then..fi for the following procedure creation. I also wonder where in the help-pages that simplification is documented.
    I need help with a problem. There are 24 square tables, but the tables must be formed as rectangles. i.e. two together. How many combinations can be made with the 24 tables. What is the maximim number of people to sit at the tables using what combination What is the least number of people to sit at the tables using what combination.
    Consider the following:
    restart;
    abs(x)/x;
                                              |x|
                                              ---
                                               x 
    simplify( (1) );
                                              |x|
                                              ---
                                               x 
    simplify( (1) ) assuming x>0;  # OK
                                               1
    simplify( (1) ) assuming x=0;  # OK
                                               0
    simplify( (1) ) assuming x>=0; # Uh-oh
                                               1
    
    Simplification of trigonometric expressions is one area where computer algebra systems have yet to catch up with human experience. Experienced Maple users know that Maple prefers powers of cosine to powers of sine and powers of secant to powers of tangent. This is adequate for many situations. There are a variety of tools available within Maple that can be used to put expressions into another form. One example is convert( ..., sincos ). This conversion replace all trigonometric terms with an equivalent term involving only sine and cosine (and all hyperbolic terms with equivalent terms involving only sinh and cosh). Until now, there has been no analog for secant and tangent.
    First 227 228 229 230 231 232 233 Last Page 229 of 306