Maple 2019 Questions and Posts

These are Posts and Questions associated with the product, Maple 2019

Dear MaplePrimes community,

I am currently struggling to use the simplify-command in my toolbox for symbolic generation of robot dynamics.

I created a procedure which calls the simplify command with some extra checks. There are symbolic expressions in the term to be simplified that also occur in the workspace of the worksheet calling the procedure.

The simplify command (called from within the procedure) shall regard them as symbolic expressions unaware of the content of the variable in the workspace. Nevertheless, the simplifications are performed with the global variables, even though they are declared local to the procedure.

Minimal example: The variable "l1" stands for "length 1" in a mechanic problem as well as "length of the expression"

restart:
with(LinearAlgebra): with(ArrayTools): with(codegen): with(CodeGeneration): with(StringTools):
read proc_simplify2:
T := m2*(l1+l2)*(qD2)^2: # dummy-expression for kinetic energy
l1 := length(T);
T_simpl := simplify2(T):
l2 := length(T_simpl);

Code for the file proc_simplify2:

simplify2 := proc (Term)
  # Simplify a term. Additionally check if the simplification is advantageous.
  # In some cases the term gets longer after the simplification. Then discard.
  # Give the local procedure variable a long name. They must not be identical in Term.
  local simplify_tmpvar_c1, simplify_tmpvar_c1sum, simplify_tmpvar_c2, \
        simplify_tmpvar_c2sum, simplify_tmpvar_nms, simplify_tmpvar_k, Term2:
  # Assume all contents of the Term to be local variables to this procedure
  # Otherwise, variables like "l1" can be overwritten by occurences in the calling worksheet.
  simplify_tmpvar_nms:=convert(indets(Term,name),list): # get list of symbols
  for simplify_tmpvar_k from 1 to ColumnDimension(simplify_tmpvar_nms) do
    if simplify_tmpvar_nms[simplify_tmpvar_k] = Pi or simplify_tmpvar_nms[simplify_tmpvar_k] = 0 then
      next: # 0 and Pi can not be variables
    end if:
    eval(sprintf("local %s;", String(simplify_tmpvar_nms[simplify_tmpvar_k]))); # assume local
   end do:

  # Get computational effort before simplification
  simplify_tmpvar_c1:=add(cost~(Term)): 
  simplify_tmpvar_c1sum := diff(simplify_tmpvar_c1,functions)+ \
                           diff(simplify_tmpvar_c1,additions)+ \
                           diff(simplify_tmpvar_c1,multiplications)+\
                           diff(simplify_tmpvar_c1,divisions):
  # Perform simplification. Attention: tries to use global variables to simplify the expression (see above)
  Term2 := simplify(Term):
  # Get effort after simplification
  simplify_tmpvar_c2:=add(cost~(Term2)): 
  simplify_tmpvar_c2sum := diff(simplify_tmpvar_c2,functions)+\
                           diff(simplify_tmpvar_c2,additions)+\
                           diff(simplify_tmpvar_c2,multiplications)+\
                           diff(simplify_tmpvar_c2,divisions):
  if simplify_tmpvar_c2sum > simplify_tmpvar_c1sum then
    # The simplification was not successful. Take old version.
    Term2 := Term:
  end if:
  return Term2:
end proc:

I would be glad for suggestions how to define the symbolic expressions in Term as local to the procedure or perhaps a better way to perform simplifications. As my program extends over several worksheets and the user may define an input file, I would not like to have to control all names of temporary variables that may occur at some point in the project. Until I tried to use the simplify-command, there was no problem regarding variable names. Is it perhaps possible that the variables are now only declared local in the for loop and not in the procedure?

I am newcommer in Maple. I am using Maple 2019. Just a simple question;

solve(x^2-3*x+4=0, x);

gives

1.50000000000000 + (9.09238836013723*10^(-59))*I, 1.50000000000000 - (9.09238836013723*10^(-59))*I

instead I need to show in the forms of radiacal. I have also the problem in dsolve command;

dsolve(2*diff(y(x),x$2)+3*diff(y(x),x)+4*y(x),y(x));

with the result

y(x) = (2.73949338633639*10^(-116) + (2.73949338633639*10^(-116))*I)*_C1 + (1. + (2.73949338633639*10^(-116))*I)*_C2

Thanks indeed in advance

Sayed

Hi.

I'm working on an electronics project currently. In that project I have been trying to solve a system of inequalities, as shown by the picture from Maple below:

restart;

R__1 := 1;
lign1 := V__i/(R__4*(1/R__1 + 1/R__2 + 1/R__3 + 1/R__4)) = C*(k__1 - R/R__C + R);
lign2 := V__i*(1/R__1 + 1/R__4)/(1/R__1 + 1/R__2 + 1/R__3 + 1/R__4) = C*(k__2 - R/R__C + R);
lign3 := V__i*(1/R__2 + 1/R__4)/(1/R__1 + 1/R__2 + 1/R__3 + 1/R__4) = C*(k__3 - R/R__C + R);
lign4 := V__i*(1/R__3 + 1/R__4)/(1/R__1 + 1/R__2 + 1/R__3 + 1/R__4) = C*(k__4 - R/R__C + R);
lign5 := V__i*(1/R__1 + 1/R__2 + 1/R__4)/(1/R__1 + 1/R__2 + 1/R__3 + 1/R__4) = C*(k__5 - R/R__C + R);
lign6 := V__i*(1/R__1 + 1/R__3 + 1/R__4)/(1/R__1 + 1/R__2 + 1/R__3 + 1/R__4) = C*(k__6 - R/R__C + R);
lign7 := V__i*(1/R__2 + 1/R__3 + 1/R__4)/(1/R__1 + 1/R__2 + 1/R__3 + 1/R__4) = C*(k__7 - R/R__C + R);
solve({lign1, lign2, lign3, lign4, lign5, lign6, lign7}, [R__4, R__2, R__3, R__C, R, C, V__i]);

Here's a picture as well:

However, the solution is simply that V_i = 0 and C=0, which is not really helping me. Am I doing something wrong here or is my system of equalities simply unsolvabe?

 

Hi all,

For some range of my model parameter, the numerical integration fails to give a numerical answer rather a symbolic expression. Any idea why?

Please see this attached.NumericInt.mw.

Hi, 

I'm pretty new to Maple and am currently trying to figure out this error I have. I tried to load this package http://www.math.lsa.umich.edu/~jrs/software/SF2.4v.txt via the command: 

read "//Users//boe//Desktop//Maple//MapleFiles//SF.txt"; 

however, I got "Warning, `SF` is implicitly declared local to procedure" in return. I also couldn't call any function defined in the package after running the command (I assume it's because of the local to procedure thing). I looked into the source code, and IF I understand correctly, SF is only used as the name of the package and in the line "SF:=table():". I tried modifying to "global SF:=table():", but it doesn't seem to help. 

I have a friend who ran the same command (with the modification to the reading path) with the original source file, but he had no issue using the package. The only difference is that I'm using Maple 2019 while he's using some older version, so I'm assuming version difference is the cause. (or maybe there's some setting to my maple I need to do?)

Any help would be greatly appreciated!

Hi, after solving an equation and inserting it in the original equation the result is not equal to zero!!

What is the problem?

in the attached file below I obtained 'q' and then I put it in the eq (3), but the result is not zero!!

Please help me.

555.mw

I keep getting this datatype float[8] error, can some1 please help me. 
upload the mw file here faq.mw

Also i have a working for lopp and want to make a procedure. 
Any suggestions will be helpful as well. Thanks.

This is a given set of equations (from a classifier problem in deep learning):

I tried to replicate the expression in Maple, but it was unsuccessful. 

Q_MaplePrime20200417.mw

Would you tell me how to make it work?

Then, please let me know how to refer to a previous result (equation number) in the current expression. 

The last line above (and the attached Maple document) shows my attempt, It did not work. 

Thank you/Be healthy!

 

 

Hi,

I am using Direct Search Optmization package for a procedure using Search command and everytime I run it it'll give me a different answer. same procedure, same code, when executed few times every time it generates a different answer. Can anyone help me with this ? 

I'm using Maple2019.

Here is my code:

with(geometry);
point(o, 0, 0);
point(A, 0, 1);
point(d, 0, 2);
point(F, 0.8944271920, 1.4472135960);
line(lOD, [o, d]);
line(lAF, [A, F]);
alpha := FindAngle(lOD, lAF);
 =
                      alpha := 2.034443936


FindAngle is supposed to return the smaller angle between two lines.

Here it is greater than Pi/2

How can that be ?

Thank you for your advice

Hello, I was wondering about the following.

cos(Pi/2^n) can be converted to a radical for each integer n, because cos(Pi/2)=0 is known and successively

cos(x)=sqrt( (1+cos(2x))/2 )

so in principle radical expressions should exist for all integers n. But maple only converts cos(Pi/8) to a radical, but not cos(Pi/16) and higher powers. Is there a simple way without writing an own program to obtain these radical expressions using convert(*,radical)?

restart;
with(LinearAlgebra):
with(VariationalCalculus):
# Energie cinetique/potentiel
T := 0.5*m*(diff(r(t),t)^2+r(t)^2*diff(theta(t),t)^2)+(1/6)*m[0]*l^2*diff(theta(t),t)^2;
Ve := 0.5*k*(r(t)-r[o])^2;
Vg := -m*g*r(t)*cos(theta(t)) - 0.5*m[o]*g*l*cos(theta(t));
# Lagrangien
L := T - (Ve + Vg);
E := EulerLagrange(L,t,[theta(t),r(t)]);
EQ1:=simplify(E[1]);
EQ2:=simplify(E[2]);
dsolve({EQ1,EQ2,D(theta)(0)=0,D(r)(0)=0,theta(0)=0,r(0)=10},{r(t),theta(t)});
dsolve({EQ1,EQ2},{r(t),theta(t)});

Hello ! 

I'm currently trying to learn some advanced mechanics with the Lagrangian method. I'm ok with the physics part. I can solve small problems by hand but when I try it on maple, it won't work.

The equations I'm using have no mistakes, I'm following a book step by step. 

What I'm stuck with is to get a formula of theta and r that are only function of time (t) to then be able to plot it. And I need dsolve to work to get that.

 

 

 

 

As of last week using Maple 2019, and now with Maple 2020, I have begun to have issues trying to export rendered plots using plot3d. Even trying a simple example such as:

plot3d(x^2+y^2, x=0..1, y=0..1); 

will return the correct 3D plot, but right-clicking the plot closes the program immediately. Has anyone else experienced a similar issue? 

I am trying to graph x^(1/2) and (x^2/8) revolving around the y-axis using the ring method but I have not been able to do it. I only get the shell method. I have adjusted the functions to read x=y^2 and x=sqrt(8y). The bounds for this method is 0 to 2. No matter the commands I have tried I have not been able to get the washer method to show. I do not want to use the tutor program.

Can someone help me with the following question?

 

I would like to plot the function f(x)=a*x*(1-x)+x*ln(x)+(1-x)ln(1-x) in the interval [x1,x2], where x1 and x2 are points that satisfy the following: df/dx(x=x1)=df/dx(x=x2)=0 and f(x1)=f(x2), where a is some parameter that is greater than 0.

I guess I need to use here fsolve, but I am not sure how.

First 17 18 19 20 21 22 23 Last Page 19 of 44