MaplePrimes Questions

There is code at Maple app center  here  called "A Simple Expression Parser" which generates the actual tree structure of an expression. I tested it a little and it seems to work correctly on what I tried so far.

My question if some Graph expert could take the output of the above and generate an actual tree graph from it, to make it easier to see, similar to Mathematica TreeForm command which would make it much more useful.

I will show 2 examples, and the code from the above application and what the final graph should look like,. The code is (formatted a little to make it easier to read)

#code from https://www.maplesoft.com/applications/view.aspx?SID=4808
Op := proc(x) 
    if 1 < nops(x) and not type(x, function) then 
       [whattype(x), op(x)]; 
    elif type(x, function) then 
       [op(0, x), op(x)]; 
    else 
        x; 
    fi; 
end proc;

Parse := proc(expr) 
   local tmp, i; 
   tmp := Op(expr); 
   for i from 2 to nops(tmp) do 
       if 1 < nops(tmp[i]) or type(tmp[i], function) then 
          tmp := subsop(i = Parse(tmp[i]), tmp); 
       end if; 
   od; 
   RETURN(tmp); 
end proc;

ps. I do not think using name Parse above is good idea, since I see it is an inert form of Maple build in command.

Now, lets look at this

first example 

expr:=sin(x)+x*y + 1/x;
Parse(expr)

The above says the tree is rooted at `+` with three branches. The first is sin(x), the second is a tree rooted at `*` with two leafs x,y, and the third branch is roots at `^` with two leafs x,-1. Physically it looks like this

Second example

expr := sin(x)*(x + y) + 1/x;
Parse(expr)

Which physically will look like

So it is possible in theory to make a TreeForm command in Maple, using this Parse() command. May be using Graph package in Maple? by reading the output from the Parse() command, and generating nodes and arcs along the way.

How hard will such a task be? I never used the Maple 's Graph package.  

Could may be  someone may be give this an attempt? I never understood why Maple do not have a build in similar command to TreeForm. It is very useful to understanding expressions.

 

Suppose you do this

save something, afile.m;

and that later someone else does this

read afile.m;

Let's assume that this person does not know the names of the variables you have saved.
A way to get these names could be

before := { anames('user') };
read file.m:
after := anames('user') minus before minus {'before'}


I thought after would only contain something, but it also contains all the elements of before, just as if  
anames('user') minus before was not effective (see PS below)
Exemple

restart:
interface(version)
Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 

   21 2015 Build ID 1097895
a:=1:
before := {anames('user')};
                              {a}
b:=2:
after := {anames('user')} minus before minus {'before'}
                         {a, b}



How can I obtain the set of the new user-asigned names?

PS: Why does displaying  before give the value assigned to and not a itself?

before
                              {1}



Thanks in advance

The square root of x+8-square root of x+9-square root of 2x+4

I encountered a weird error while computing a set of integrals.

Here is my complete code in a .mw file
 

Download Inflow_distribution_for_forward_flight_(teetering_rotor).mwInflow_distribution_for_forward_flight_(teetering_rotor).mw

 

At the bottom I have an error message :"Error, Got internal error in Typesetting:-Parse : "invalid subscript selector". 

Hello,

 

When I try to get the magnitude of the transfer function in the uploaded file, I get this error:

Error, invalid input: `simpl/abs` expects its 1st argument, a1, to be of type algebraic, but received [0.15000e8/(-0.2137457857e-6*f^2+(2.909554620*I)*f-(0.1565896548e-13*I)*f^3+0.152600e8)]
 

How do I get the magnitude and phase of this transfer function so I can plot it as a function of frequency, f?  If you can show me how to plot it, that would help a lot as well.

 

Thank you,

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/temp.mw .
 

Download temp.mw

Hi experts, I need your help to find higher-order prolongation(extended infinitesimals) with the help of infinitesimals. rhelp1.mw

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/help1.mw .
 

Download help1.mw

in MAPLE. I have attached a worksheet please check it.

Kindly help me to find it

Thank you.

In general, the Graph6 format is a graph format supported by major math software, so I used it as a transitional format.

with(GraphTheory):
g:=Graph(Matrix(42, 42, [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])):
s:=ConvertGraph(g,'graph6')

 


 

When I try to read this graph6 string with Mathematica or Sagemath, unfortunately there are unrecognized problems.  Later, I found that when copying, there would be missing the backslash . 

"ihChWC@?gE_@?@?A_@g?@??C??j?@l??E??Ao?? (miss \ when copy)???m??@I??DF??E`O??GM??@?g??S@o?@g@O??G?w??C?I??D?@o?@g?D???_?M??@??I??D??FK?E_?@Q??G??N??@???CPCOaGa????"

I'm trying to figure out this problem of copying strings.

 

 

 

 

hall*effect;
                          hall effect
Vh = B*I/qnd;
                                 I B
                            Vh = ---
                                 qnd
The Hall voltage represented as VH is given by the formula:    VH=IBqnd  Here,    I is the current flowing through the sensor    B is the magnetic Field Strength    q is the charge    n is the number of charge carriers per unit volume    d is the thickness of the sensor.;


B = 0.5*Unit('T');
q = Unit('e');
                        B = 0.5 Unit(T)
                          q = Unit(e)
n = 0.15*100000.*Unit('C')/Unit('L');
d = 10*micron;
                           15000. Unit(C)
                       n = --------------
                              Unit(L)    
                         d = 10 micron
I = 0.1*10^(-5)*Unit('A');
                      I = 0.000001 Unit(A)
Vh;
                               Vh

getting error in solution?

 

Please resolve

t3 :=2:R := 0.5:M:=0.5 :

EQ:={diff(F(x), x $ 4) +2*R*(   F(x)*diff(F(x), x $ 3) + G(x)*diff(F(x), x)  ) + 2*R*t3*(  2*diff(F(x), x $ 2)*diff(F(x), x $ 3) + diff(F(x), x)*diff(F(x), x $ 4) + 3*diff(G(x), x )*diff(G(x), x $ 2) )=0,
diff(G(x),x$2) - 2*R*( diff(F(x),x)*G(x)- F(x)*diff(G(x), x)  ) - 2*R*t3*(  diff(F(x),x$2)*diff(G(x),x) - F(x)*diff(G(x), x $ 2) ) =0};

IC:={ F(0)=0,  F(1)=0,   G(0)=1,  G(1)=0, D(F)(0)=0, D(F)(1)=M};
sol:= dsolve(EQ union IC,numeric,maxmesh=1024,initmesh=512,output=Array([0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]));


Q1.mw

I have

f:=a^6*o + a^5*i + a^4*u + a^3*q + a^2*t + a

and

f1:=7*a^6*p + 6*a^5*o + 5*a^4*i + 4*a^3*u + 3*a^2*q + 2*a*t + 1

I want to divide two functions f/f1 to produce a result.

a^2*t+ a^3*(-2*t^2 + 2*q)+ a^4*(4*t^3 - 7*t*q + 3*u)(-8*t^4 + 20*t^2*q - 6*q^3 - 10*t*u + 4*i)*a^5+a^6*(16*t^5 - 52*t^3*q + 33*t*q^3 + 28*t^2*u - 13*i*t - 17*u*q + 5*o)+O(a^7)

 

I have tried collect and asympt, the result is not satisfactory.

 

Hi,

If I use a package  that I don't wnt to load, is these two is the best way to proceedcontains

  • alias (P= package): 
  • macro (P= package):
     

Thanks in advance

restart;
with(plots); with(LinearAlgebra);
_EnvHorizontalName := 'x';

_EnvVerticalName := 'y';

x1,y1,x2,y2,x3,y3:=0,-3,3,1,5,-2:   
A := [x1, y1]: B := [x2, y2]: C := [x3, y3]:

Barycentre := proc (A, B, t) description "Barycentre de 2 points A(1) et B(t) dans le rapport t";
return [(1-t)*A[1]+t*B[1], (1-t)*A[2]+t*B[2]] end proc;
ellip := proc (r1, r2) local a, b, c, d, e, f, D, E, F, eq1, eq2, eq3, eq4, eq5, eq6, x0, y0, EE, r3, sol, Ff, Tg;
global A, B, C;
r3 := -1/(r2*r1);
D := Barycentre(C, B, 1/(1-r1)); E := Barycentre(A, C, 1/(1-r2)); F := Barycentre(B, A, 1/(1-r3));
Ff := proc (x, y) options operator, arrow; a*x^2+2*b*x*y+c*y^2+2*d*x+2*e*y+f end proc;
Tg := proc (x0, y0, x, y) options operator, arrow; a*x*x0+b*(x*y0+y*x0)+c*y*y0+d*(x+x0)+e*(y+y0)+f end proc;
eq1 := Ff(D[1], D[2]);
eq2 := Ff(E[1], E[2]);
eq3 := Ff(F[1], F[2]);
eq4 := Tg(F[1], F[2], x1, y1);
eq5 := Tg(D[1], D[2], x2, y2);
eq6 := Tg(E[1], E[2], x3, y3);
sol := op(solve([eq1, eq2, eq3, eq4, eq5, eq6], [a, b, c, d, e]));
assign(sol);
EE := subs(f = 1, Ff(x, y) = 0) end proc;

ellip(-1, -7); tri := plot([A, B, C, A], color = blue):
 
po := plot([A, B, C], style = point, symbolsize = 15, symbol = solidcircle, color = red);
tp := textplot([[A[], "A"], [B[], "B"], [C[], "C"]], 'align' = {'above', 'left'});
x := 'x'; y := 'y';
ELL := seq(implicitplot(ellip(-7/11-(1/11)*j, -1/17-3*j*(1/17)), x = 0 .. 5, y = -3 .. 1, color = ColorTools:-Color([rand()/10^12, rand()/10^12, rand()/10^12])), j = 1 .. 17);
display([tri, ELL, po, tp], view = [-.5 .. 5.5, -4 .. 1.5], axes = none, scaling = constrained, size = [500, 500]);
Explore(implicitplot(ellip(r1, r2), x = 0 .. 5, y = -3 .. 1), parameters = [r1 = -2.18 .. -.7, r2 = -3 .. -.23]);
Can you tell me why this last instruction does't work ? Thank you.
 

Hi guys ,

 

I have the equation dt=(L/r)*(1 - a^3/r^3)^(-1/2) dr which want to integrate on both side and then solve in terms of r.(L and a are constants). I know the answer (r=a (cosh(3t/2*L)^2/3),but it seems maple can not produce it!

 

Mathematical almost compute it corectly! altough i think  tanh-1, should be cosh^-1(x/a)^3/2

 

I would appreciate if someone can help me

 

 

 

Thanks so muchproblem.mw

Why does Maple write

restart;
eq:=x-infinity=0;

as 

 

 

Hi sir, I hope everyone are good in Covid situation.

I wish to obtain the dual branch solution as given in the Article.

Please help me to obtain the dual branch solution in Maple.

The article is here. akbar2014_(1).pdf

Thank you..

First 176 177 178 179 180 181 182 Last Page 178 of 2210