Carl Love

Carl Love

28015 Reputation

25 Badges

12 years, 300 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

You asked about solving this system of equations, or one very similar to it, a few days ago here. I thought that I had convinced you to use fsolve instead of an ad hoc method based on the Jacobian.  You even said "It works like magic." So why aren't you using fsolve?

Addressing the length-of-output issue: The message is not an error message. The output still exists in Maple's memory, and you can still work with it; Maple's GUI just won't print it on the screen.

Assuming that you want to implement a Newton's method, you're going about it all wrong. The first rule of numerical linear algebra: Never invert a matrix; always solve a linear system instead.

Please post your worksheet. I don't get any decimal point. I get this:

inttrans[laplace](diff(diff(f(t),t), t), t, s);

Try doing a restart and doing the command again.

In your dsolve command, include the option output= listprocedure. So, you'll have

reseni:= dsolve(..., output= listprocedure):

Then

Reseni:= eval(dvars, reseni):

Now Reseni is a list of procedures, which can be used as a list-valued procedure, returning a list of pure numbers.

Reseni(tend);

restart:
F:= [sin, cos, tan]:
V:= [0, Pi/6, Pi/4, Pi/3]:
M:= Matrix(nops(F), nops(V), (i,j)-> F[i](V[j]));

M1:= < < `F/V`|``|`<|>`(V) >, `<|>`(``$nops(V)+2), < < F >|< [``$nops(F)] >| M > >;

ssid:= Spread:-CreateSpreadsheet();

Spread:-SetMatrix(ssid, M1);

Your problem is that the with command does not work in procedures. In a procedure, the alternative to with is ?uses . In the procedure's declarations, either immediately before or immediately after the locals, put the statement

uses LinearAlgebra, Student:-MultivariateCalculus;

I see that you have some old, deprecated linalg commands in your procedure. You should replace those with equivalent commands from LinearAlgebra. In particular, there's ?LinearAlgebra,GaussianElimination or ?LinearAlgebra,ReducedRowEchelonForm . Column swapping can now be done with simple indexing:

MM:= M1[.., [5,2..4,1]];

How about

A, B:= Matrix(6, symbol= a), Matrix(6, symbol= b);

nops([StringTools:-SearchAll]("5", sprintf(cat("%d"$2013), $(1..2013))));
                              601

plots:-polarplot([cos(t), sin(t)], t= 0..Pi);

Why do you say that the roots are not real? You can't tell until you plug in values for a1, a2, a3, b1, b2, b3. Just because the symbolic solution has an I in it does not mean that the numerical solution will be non-real. For example:

p:= x^3-x^2-2*x+1;
                        3    2          
                       x  - x  - 2 x + 1
fsolve(p);
     -1.24697960371747, 0.445041867912629, 1.80193773580484
solve(p);
                     (1/3)                                   
1 /            (1/2)\                    14               1  
- \-28 + 84 I 3     /      + -------------------------- + -,
6                                                 (1/3)   3  
                               /            (1/2)\           
                             3 \-28 + 84 I 3     /           
                        (1/3)                                    
  1  /            (1/2)\                    7                1   
- -- \-28 + 84 I 3     /      - -------------------------- + - +
  12                                                 (1/3)   3   
                                  /            (1/2)\            
                                3 \-28 + 84 I 3     /            

             /                     (1/3)
  1    (1/2) |1 /            (1/2)\     
  - I 3      |- \-28 + 84 I 3     /     
  2          |6                         
             |                          
             \                          

                               \                          (1/3)
                 14            |    1  /            (1/2)\     
   - --------------------------|, - -- \-28 + 84 I 3     /     
                          (1/3)|    12                         
       /            (1/2)\     |                               
     3 \-28 + 84 I 3     /     /                               

                                                 /  
                 7                1   1    (1/2) |1
   - -------------------------- + - - - I 3      |-
                          (1/3)   3   2          |6
       /            (1/2)\                       |  
     3 \-28 + 84 I 3     /                       \  

                     (1/3)                             \
  /            (1/2)\                    14            |
  \-28 + 84 I 3     /      - --------------------------|
                                                  (1/3)|
                               /            (1/2)\     |
                             3 \-28 + 84 I 3     /     /

Erik wrote:

I need to declare a parameter, which is a vector of lists.

Usually there's no actual "need" to declare a parameter to have a very specific type, but doing so can help with debugging.

Example of element:

< [3,7,2,4], [-3,6,8,0], [-5,8,4,2]>

There is a quirk (bug perhaps?) with the `<,>` Vector constructor such that the above creates a 3x1 Matrix with list entries rather than a Vector. It can be converted to a Vector with convert(..., Vector).

Vector has n components and each list has k components. I tried declaring it like:

boxVector:=Vector(n,datatype=list());

When you create it like that you need to subvert the default fill, 0, because 0 is not a list. Like this:

boxVector:= Vector(n, fill= [], datatype= list);
or
boxVector:= Vector(n, fill= [0], datatype= list(integer));
or
boxVector:= Vector(n, fill= [0$k], datatype= [integer$k]);

To do type checking, you can compare against the type 'Vector'(list)'Vector'(list(integer)), or 'Vector'([integer$k]).

Pass the remaining equations to fsolve. It will probably use something like Newton's Method, but if it uses something else... so what? as long as you get the solution.

Assign your output to a variable, let's say out.

out:= %:

Then

sprintf("%q", out)[1..1000];

will show the first 1000 characters of the output.

I don't see any problem with the existence of commands to make plots look exactly like you want. You don't have to use them if you don't want to.

Just replace * with `&ast;`. If you want to see it clearly, you can increase the font size with axesfont= [TIMES, ROMAN, 14], or any point size that you want.

plot(x^2, x= -1..1, tickmarks= [[1/2=x^`&ast;`], [1='a']], axesfont= [TIMES,ROMAN,14]);

If you don't want to see a symbol attached to assumed variables, then issue the command:

interface(showassumed= 0);

Regarding your differential equation, it would be best if you did not use I as a variable, as it is reserved for the imaginary unit. (If you really want to use I, there is a way around that.) Here, I use J.

diffeq:= diff(J(b), b) - 2*J(b)*b = -sqrt(Pi)*exp(-2*a*b);

Differential equations are solved in Maple with dsolve, which handles this one quite readily:

dsolve(diffeq);

You wrote:

When I first tried the integration w.r.t. the parameter b (with the assumptions), I could not get the solution shown above. Should I take away the assumptions (which is only logical when differentiang wrt it)? Actually, I got the solution above only after I started formulating this question for this newsgroup. The reason why I started with the assumption is that I did not want any compex solutions (which I got for another problem). So, the question is really if it is possibe to relax the assumptions just for the sake of differentiating the integral?

As far as I can tell, the assumptions make no difference.

The mathematical constant Pi is spelled with a capital P in Maple. If you use a lowercase p, then you get an ordinary variable that prints as the Greek letter. (So there is often no way to visually determine from the output whether the Pi was entered correctly.)

ex:= sqrt(x*y*z)/(x*y*z):
simplify(ex, symbolic);

applyrule(1/sqrt(a::algebraic)*1/sqrt(b::algebraic)= 1/sqrt(a*b), %);

 

First 353 354 355 356 357 358 359 Last Page 355 of 395