MaplePrimes Questions

I am using GenerateMatrix to construct a matrix out of a set of 6 equations with 6 variables.  The output of Generate Matrix is not sorted correctly.  Where am I going wrong? Is this a bug?

restart

NULL``

with(LinearAlgebra)

NULL

NULL

The command GenerateMatrix is not sorting my set of equations properly.

NULL

NULL

Define a set of 6 equations.

equation_set := [5964.000000-770.0000000*T__1+750.0000000*T__2 = 0, 20*T[1]-770.0000000*T[2]+750.0000000*T[3]+100.0000000 = 0, 20*T[2]-770.0000000*T[3]+750.0000000*T[4]+100.0000000 = 0, 20*T[3]-770.0000000*T[4]+750.0000000*T[5]+100.0000000 = 0, 20*T[4]-770.0000000*T[5]+750.0000000*T[6]+100.0000000 = 0, 5900.787944-770.0000000*T[6]+750.0000000*T[5] = 0]

[5964.000000-770.0000000*T__1+750.0000000*T__2 = 0, 20*T[1]-770.0000000*T[2]+750.0000000*T[3]+100.0000000 = 0, 20*T[2]-770.0000000*T[3]+750.0000000*T[4]+100.0000000 = 0, 20*T[3]-770.0000000*T[4]+750.0000000*T[5]+100.0000000 = 0, 20*T[4]-770.0000000*T[5]+750.0000000*T[6]+100.0000000 = 0, 5900.787944-770.0000000*T[6]+750.0000000*T[5] = 0]

(1)

NULL

NULL

NULL

This is what each one looks like individually.

equation_set[1]

5964.000000-770.0000000*T__1+750.0000000*T__2 = 0

(2)

equation_set[2]

20*T[1]-770.0000000*T[2]+750.0000000*T[3]+100.0000000 = 0

(3)

equation_set[3]

20*T[2]-770.0000000*T[3]+750.0000000*T[4]+100.0000000 = 0

(4)

equation_set[4]

20*T[3]-770.0000000*T[4]+750.0000000*T[5]+100.0000000 = 0

(5)

equation_set[5]

20*T[4]-770.0000000*T[5]+750.0000000*T[6]+100.0000000 = 0

(6)

equation_set[6]

5900.787944-770.0000000*T[6]+750.0000000*T[5] = 0

(7)

NULL

The variables used in the above set of equations.

variables_set := [T[1], T[2], T[3], T[4], T[5], T[6]]

[T[1], T[2], T[3], T[4], T[5], T[6]]

(8)

variables_set[1]

T[1]

(9)

A, b := GenerateMatrix(equation_set, variables_set)

Matrix(%id = 36893490238808803916), Vector[column](%id = 36893490238808803796)

(10)

This output seems wrong because a row of zeros appears in A``.  The first entry of the column vector contains the full equation. Thus, it seems GenerateMatrix didn't sort the set of equation properly.  I tried re-writing the  offending equation  as 5964.000000-770.0000000*T__1+750.0000000*T__2 = 0,but maple just changes it back on evaluation.NULL


 I think the output should look like:


A, b := Matrix(6, 6, {(1, 1) = -770.0000000, (1, 2) = 750.0000000, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (2, 1) = 20, (2, 2) = -770.0000000, (2, 3) = 750.0000000, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (3, 1) = 0, (3, 2) = 20, (3, 3) = -770.0000000, (3, 4) = 750.0000000, (3, 5) = 0, (3, 6) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 20, (4, 4) = -770.0000000, (4, 5) = 750.0000000, (4, 6) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 20, (5, 5) = -770.0000000, (5, 6) = 750.0000000, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 750.0000000, (6, 6) = -770.0000000}), Vector(6, {(1) = -5964.000000, (2) = -100.0000000, (3) = -100.0000000, (4) = -100.0000000, (5) = -100.0000000, (6) = -5900.787944})

NULL

I rename the matrix and column vector and use LinearSolve to find a solution for T.

AA := Matrix(6, 6, {(1, 1) = -770.0000000, (1, 2) = 750.0000000, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (2, 1) = 20, (2, 2) = -770.0000000, (2, 3) = 750.0000000, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (3, 1) = 0, (3, 2) = 20, (3, 3) = -770.0000000, (3, 4) = 750.0000000, (3, 5) = 0, (3, 6) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 20, (4, 4) = -770.0000000, (4, 5) = 750.0000000, (4, 6) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 20, (5, 5) = -770.0000000, (5, 6) = 750.0000000, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 750.0000000, (6, 6) = -770.0000000})

Matrix(%id = 36893490238866723772)

(11)

``

bb := Vector(6, {(1) = -5964.000000, (2) = -100.0000000, (3) = -100.0000000, (4) = -100.0000000, (5) = -100.0000000, (6) = -5900.787944})

Vector[column](%id = 36893490238885708252)

(12)

NULL

NULL

T := LinearSolve(AA, bb)

Vector[column](%id = 36893490238857651132)

(13)

NULL

Download GenerateMatrix_Improper_Sorting.mw

Hello

I want to declare 'd' as a constant.

Please tell me how to declare 'd' as a constant.

intersection de deux droites l1 et l2 telles que l1 sous forme parametrique est [57/5 + 20*t, -21/5 - 40*t, 20*t] et de la meme façon

 l2 [249/100 - 120*t, 471/100 - 80*t, 200*t]. t est le parametre  . maple donne pour l'intersection de l1 et l2 le point P de coordonnes

 [249/100, 471/100, 0] que je ne trouve pas .expliquez moi ce resultat et merci beaucoup.

I have a big matrix which is computed in a worksheet, now I have to use this matrix in another worksheet. Could you recommend some ways of healthy transferring of quantities between worksheets?

here is logical_circuit.msim

i cannot connect the output of the left two AndGates to the input of the right AndGate. They are both digital signal connectors, why cannot be connected?

with(plots);
with(LinearAlgebra);
A := Matrix([[2, 1, 0, 0, 3], [0, 2, 1, 0, 0], [0, 0, 2, 1, 0], [0, 0, 0, 2, 1], [0, 0, 0, 0, 2]]);
sparsematrixplot(A, matrixview, color = "Red", symbol = "cross");

How do I change the plot to show other symbols? Even though I write for example "cross" I still get the default box.

Also, is there a way in which I can let the color depend on the number in the matrix? Right now it just shows all non-zero entries.

restart:
digits := 20;
unprotect(D);
G := 0.04361098108*x^2 + 0.4810001561*x*y + 1.326278064*y^2 - 0.7320831383*x - 2.656083763*y + 1 = 0
f := (x, y) -> lhs(G);
coeffs(f(x, y));
A, B, C, D, E, F := coeffs(f(x, y));
A := coeff(f(x, y), x, 2);
B := coeff(coeff(f(x, y), x), y);
C := coeff(f(x, y), y, 2);
D := coeff(coeff(f(x, y), x, 1), y, 0);
E := coeff(coeff(f(x, y), y, 1), x, 0);
F := tcoeff(f(x, y));
expand(B^2 - ((4*A) . C));
                          digits := 20

   f := proc (x, y) options operator, arrow; lhs(G) end proc

  1, -0.7320831383, 1.326278064, 0.04361098108, 0.4810001561, 

    -2.656083763


A, B, C, D, E, F := 1, -0.7320831383, 1.326278064, 0.04361098108, 

  0.4810001561, -2.656083763


                       A := 0.04361098108

                       B := 0.4810001561

                        C := 1.326278064

                       D := -0.7320831383

                       E := -2.656083763

                             F := 1

                               0.


with(geometry):
_EnvHorizontalName := 'x': _EnvVerticalName := 'y':
conic(co,f(x,y),[x,y]):
detail(co);
                 /                            
   GeometryDetail\["name of the object", co], 
   ["form of the object", ellipse2d], 
   ["center", [1.212351672 ^(10, 10), -2.198412833 ^(10, 9)]], 
   ["foci", [[2.424703344 ^(10, 10), -4.396825668 ^(10, 9)], 
   [0.1787052775, 0.9855002601]]], 
   ["length of the major axis", 2.464245740 ^(10, 10)], 
   ["length of the minor axis", 66579.62094], 
   [                                               2
   ["equation of the ellipse", 1. + 0.04361098108 x 
                                      2                 
    + 0.4810001561 x y + 1.326278064 y  - 0.7320831383 x
                       ]\ 
    - 2.656083763 y = 0]/;
   "_noterminate";

G is a parabola with B^2-4*A*C=0 or an ellipse ? A =1 or F=1 ? Thank you for youy answer. 

I need the Infinitesimals(Lie group analysis) of the system of PDE. I have attached below the system of PDE in MAPLE given below.MAPLE_Help.mw

Thank you

I have code which in module which does this

           DEtools:-kovacicsols(ode,func)

Where ode is some ode and func is y(x).  When I step in the debugger, I get exception at this. It says

       DBG> DEtools:-kovacicsols(ode,func)
       Error, `DEtools` does not evaluate to a module

Same exact code works OK from worksheet as expected.   SO for some reason, inside this module it does not see DEtools and I have no idea why.

Then I tried with :-  before DEtools, but this did not help. it gives

DBG> :-DEtools:-kovacicsols(ode,func)
Error, `table([(dperiodic_sols)=proc () `DEtools/init`() <> 0; `ODEtools/intfactor`(_passed); end etc...
` does not evaluate to a module

In a worksheet, it all works OK

ode:=diff(diff(y(x),x),x) = (-3/16/x^2-2/9/(x-1)^2+3/16/x/(x-1))*y(x);
func:=y(x);
DEtools:-kovacicsols(ode,func)

Gives the solution with no error.

Any suggestion what could be the cause and what to try next? I never seen anything like this. I am running this code using 

interface(warnlevel=4);
kernelopts('assertlevel'=2):

I am able to make a MWE. It seems this always happens in the debugger.  But if  I let it run, it works somehow. Only when I try to step into it, it gives error. Here is MWE

interface(warnlevel=4);
kernelopts('assertlevel'=2):
foo:=proc(ode,func)
   local result;
    DEBUG();   
    result:=DEtools:-kovacicsols(ode,func);
    return result;
  end proc;

And now

ode:=diff(diff(y(x),x),x) = (-3/16/x^2-2/9/(x-1)^2+3/16/x/(x-1))*y(x);
func:=y(x);
foo(ode,y(x))

Now in the debugger if I do DEtools:-kovacicsols(ode,func) or if I stepin the call, I get the error. But I hit the continue botton, I do not get the error and it gives solution. 

Why this happens?

Maple 2021.2 on windows 10

 

 

 

as the cuts show,  i build a simple  system to check how does the "edge with init" work? The switch is "ideal opening switch". the rising edge is always "0" while the voltage is always 1v, it seems that the "edge with init" doesn't work. Please give me some explaintion of the problem. 

here is thetest.msim

 

@acer,
In the past, you had shown how to use take a given sparse A matrix and store the LU components and use the same factorization for multiple backsolves at https://www.mapleprimes.com/posts/41191-Solving-Sparse-Linear-Systems-In-Maple#comment200817

When PDEs are solved, we are calling the A matrix at every time step (with some discretizations in x) and the factorization is done and stored at every time step (this is time-consuming and memory-consuming). Is it possible to call UMFPACK using only the sparse storage and entries? The main routine seems to provide the option 

https://people.sc.fsu.edu/~jburkardt/f77_src/umfpack/umfpack.html

This would mean that the pattern is found only once for the Jacobian at t= 0, then only the non-zero sparse entries (vector/row, not a matrix) are updated at every time step.

To be clear, what I am asking for is create a random sparse matrix (say 4x4 or 10x10)
create a b Vector.

Solve AZ =b with method = SparseDirect. (This should internally create and store R, CC, X as at https://people.sc.fsu.edu/~jburkardt/f77_src/umfpack/umfpack.html)

Store R, CC, X and update only X for a different A matrix with the same sparsity pattern and solve for Z using stored (R, CC), and updated X.

j'ai deux spheres concentriques s1 et s2  de centre O(-1,-1,-1) de rayon respectivement 3 et 2. mais maple donne que FindAngle(s1,s2)=arcos(31/12). comment expliquez ceçi et merci beaucoup.

PDETWOSTEPVARIAMETHOD.mwPDETWOSTEPVARIAMETHOD.mw

Pls i need help to correct this iteration code, I wrote but is not given the correct answer. find attached the worksheet

Hi again everybody,
I hope this can help in some classrooms.

This procedure has some warnings.  Someone else can clean it up.
Also, the ithprime() command can make it a bit slicker.
I did work with prime constelations project, and you can see my web page at mattanderson.fun  .

Refference oeis.org/A40 .
Some prime constelations, and k-tuples, are not of 'general intrest' yet, so they are not in the OEIS encyclopedia YET!

But prime numbers are exciting.  I like doing calculations.

Hopefully someone in the next generation will take up an intrest and do what I did.

pairs_procedure.mw

pairs_procedure.pdf

I wish the best on all of you.

Regards,

Matt C. Anderson

which kind of input is DeepLearning:-Optimizer(GradientDescent()) suppose to take? Nummeric value or function?

First 217 218 219 220 221 222 223 Last Page 219 of 2308