## Why is map slower than ~?...

Asked by:

For a list containing at least one element,

F~(list0); # element-wise

is (almost) equivalent to

map(F, list0);

However, it seems that in practice, using ~ can be faster than its equivalent map version.
Here is a typical test:

 > restart;
 > w := [$](0 .. 1e4): x := [$](0 .. 2e3): y := [$](0 .. 3e2): z := [$](0 .. 4e1):
 >

# Compute a generalized outer product of  and  without using the inefficient ArrayTools:-GeneralOuterProduct.

 >

memory used=282.53MiB, alloc change=0.59GiB, cpu time=21.67s, real time=7.41s, gc time=17.33s

 >

memory used=230.48MiB, alloc change=-4.00MiB, cpu time=23.26s, real time=8.67s, gc time=17.71s

 > evalb(p2 = p4);

 >

Download ~_and_map.mw

But I cannot find any explanations in Comparison of element-wise operators and map function or Difference between 'map' and '~' (element-wise operation). Does anyone know why?

## Showing steps in solving a system of nonlinear equ...

Asked by:

I used ‘solve’ command in Maple to solve the following system of two variables with two nonlinear equations:

where

The denominators are nonzero and positive, and all parameters , , , ,  and  are positive real numbers. The solution was easily obtained, that is

Is there any way that I can follow the steps? The issue is that I need to verify whether there is not an alternate solution.

## problem translating string to latex. Using standar...

Asked by:

The standard way of writing quotes and double quotes in LaTeX is with  and ''

So a string should be translated to Latex using the_string' '  and not the_string"  which is what Maple does.

see for example this

For example, Maple translates  "regular" to

"\text{regular\"}"

It should be

"\text{regular' '}"

i.e. instead of closing it on the RIGHT with string quote  \"  it should close it with two upticks, like this ' '

Hard to see the differene here, so here is screen shot

s:="regular";
latex(s,output=string);
lprint(%)

The difference will show up depending on what font one is using. Here is an example below where when using different font, the effect is now visible.

\documentclass[12pt]{book}
\usepackage{amsmath}

\usepackage[T1]{fontenc}
\usepackage{mlmodern}

\begin{document}

\text{regular"}

\text{regular''}

\end{document}

The first one above is what Maple generates, the second one is what it should have been. Compiling with luatex gives this pdf, You can see clearly the difference now

It is important to note that this behavior shows depending on font used. For example, this code

\documentclass[12pt]{book}
\usepackage{amsmath}
\begin{document}

\text{regular"}

\text{regular''}

\end{document}


When compiled gives

So to be safe, it is better to always use the standard   ....' '   and not  .... \" because it then works the same for different fonts being used.

So, would it be possible to make Maple generate quoted string using the standard latex by closing it with ' ' instead of \"  ?

## how to make singular use same letter Z for integer...

Asked by:

the command singular can return results with _Z or _N as it says in help

The singular function may return expressions prefixed by _Z or _N, representing the integers and positive integers, respectively.

But it changes these letters by adding different number at the end for each call., Yet they all mean the same thing, which is an integer:

singular(1/sin(x),x)
{x = Pi*_Z1}

singular(x/sin(x),x)
{x = Pi*_Z2}

singular(x^2/sin(x),x)
{x = Pi*_Z3}


This makes it little hard when I try to make union of these results to only keep the unique singular points, since they are different symbols, yet they are really the same: integer times Pi.

Is there an option to tell Maple to use _Z for everything? And not keep adding new numbers each time it is called?

May be clear some internal memory table after each call?  Otherwise, I have to add more code to parse all these results and convert all _Znnn to just _Z  if it is there in each result, after each call is made.

Same issue for _N

Update

Additional example to try/test against

expr:=1/(sin(x)*cos(x)*tan(x));
s := singular(expr, x);

expr:=1/((x-1)*sin(x));
s := singular(expr, x);

expr:=1/(sin(x)*cos(x-Pi/3)*tan(x));
s := singular(expr, x);


In all the outputs above, I'd like to have same _Z show up. This will make it easier for postprocessing later on. Best solution will be to tell Maple itself not to change _Z if possible, otherwise one will need to add code to do this afterwords for all possible cases.

## Mapping Neutral Operator Over List...

Asked by:

Is there a way to map a neutral operator "&^" over a list L := [a,b,c,d], so that the output is a &^ b &^ c &^ d.

I can do this with a loop, but I'm wondering if there is already a built-in function for this.

## Why does LinearAlgebra:-Eigenvectors(A) give a rel...

Asked by:

Consider the task of finding the eigenvalues and eigenvectors of a simple 2x2 matrix.

Usually I can insert the contents of a Maple worksheet here, but for some reason the following worksheet cannot be inserted: Eigenvectors.mw

In that worksheet I try to use LinearAlgebra:-Eigenvectors(A). The eigenvalues contain a complex term, even though they are real for the given matrix. It's not clear what criteria are used in selecting a specific eigenvector for each eigenvalue.

I then show a more manual calculation.

I was expecting to obtain a simpler solution to this problem using LinearAlgebra:-Eigenvectors(A). Is this expectation unjustified? I am asking primarily from the perspective of a user of the software.

It would be interesting to know the answer from the perspective of someone who knows the ins and outs of the implementation of the software as well, but as a user my initial expectation is a more digestible result that doesn't rely on knowing such implementation details.

## guide on solving and graphing?...

Asked by:

hi,

What command can I use to solve the attached equation and draw its graph?

 (1)

Download Ode_equation.mw

## Why can't the commands in these document blocks be...

Asked by:

ODE for electrical circuit (right click on Documentblock, unselect show command does not work. Command still visble)

 (1)

ODE for motor (toggle Documentblock, unselect show command is only effective on equations  3 and 4)

 (2)

Isolate  and taking the derivative

 (3)

 (4)

Download Document_Block_hide_command.mw

## error with in diff...

Asked by:

dear all

am trying to do a task that Find all the roots of the equation (or three roots if there are more than three roots in the equation) by Newton's method f(x) = e^x^2 sin(x-5) accuracy = 10^-5 maple

and i wrote this code on maple

f := x -> exp(x^2)*sin(x - 5);
df := x -> evalf(diff(f(x), x));
x0 := -1.0;
tol := 0.00001;
for i to 3 do
x := x0;
n := 0;
while tol < abs(f(x)) do
x := x - f(x)/df(x);
n := n + 1;
end do;
printf("Root %d: %.5f (found in %d iterations)\n", i, x, n);
x0 := x + 1.0;
end do;
f := proc (x) options operator, arrow; exp(x^2)*sin(x-5) end proc

df := proc (x) options operator, arrow; evalf(diff(f(x), x))

end proc

x0 := -1.0

tol := 0.00001

x := -1.0

n := 0

am getting an error message

" Error, (in df) invalid input: diff received -1.0, which is not valid for its 2nd argument "

hope you can help me with this issue

## strange characters in Maple's code editor on .mpl ...

Asked by:

in Maple 2023 one can do File->Open and select an .mpl file and that will automatically open in new window using code editor.  see Maple2023-CodingTools.pdf

One problem I saw right away on windows 10, is that the diagonstic window has funny character at the end of the messages. Here is screen shot

To see if you reproduce this, here is the code I used. Simply save this in foo.mpl file and then use Maple file->open to open it (must use 2023 only for this to work)

A_class :=module()
option object;

#my variable
export c::integer;

export a::integer;

end module;


That is not all. If I simply shift the code up so the starting line in the file is not empty as above, the funny characters change to something else

Yet, it is the same exact code.  Can any one confirm this problem, and how to fix it so one can read the variable name?

I think I will stick to using notepad++ for my .mpl files for now.

## External linking error...

Asked by:

I have some c# function that i want to use in maple, and I doing all according to this arcticle : https://www.mapleprimes.com/posts/38019-Calling-Out-To-C-From-Maple
but i still get this:
Any ideas what i should do?

## Task insertion doesn't work anymore....

Asked by:

Hi MaplePrimes,

I've updated to the 2023 version of Maple. After the update I chose to remove older version folders in Windows.

Since then I cant't use my tasks any longer. I've re created the tasks and the are also shown in the Task Palette, but clicking on a task results in nothing. I can though create a new Task and after the creation all my tasks can then be used again.

Its like Maple doesn't recognize the correct Help Database from the beginning. I've reinstalled Maple 2023 two or three times to try to reset the whole installation to something from scratch. Nothing that I do seems to produce the desired result. Does anybody out there have a solution or suggestion to a probable solution?

I don't know of any file that I could attach to exemplify my problem. It's not a math/maple problem relating directly to the maple code language. My tasks themselves work fine once inserted in a document. It's the insertion itself that's the problem.

Thanks.

## How to obtain more accuracy at discontinuous point...

Asked by:

Consider the worksheet below containing a function that I came across while studying Apostol's Calculus.

At the origin, this function has a defined directional derivative in all directions. It is not, however, continuous at the origin. We can see this by consider all points on the parabola x=y^2 except for the origin. The function takes on the value 1/2 on all such points but has value 0 at the origin and is thus discontinuous there.

My question is about a 3d plot of this function.

The plot seems a bit inaccurate because the ridge at the top extends all the way to the origin.

If I hadn't done the calculations to know this, this plot would not give me this information.

Is there a way to avoid this problem? Ie, to get more accuracy at points such as the origin here?

 > f := (x,y) -> piecewise(x=0, 0, x <> 0, x*y^2/(x^2+y^4))
 (1)
 > plot3d(f,-1..1,-1..1)
 > f(y^2,y)
 (2)
 >

Download DiscontScalarField3d.mw

## Trouble getting Mantissa and Exponent...

Asked by:

Not getting Mantissa or Exponentb See Bottom

|\^/|     Maple 2022 (X86 64 LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2022
\  MAPLE  /  All rights reserved. Maple is a trademark of
<____ ____>  Waterloo Maple Inc.
|       Type ? for help.
# eqno = 10
> it := solve({
> 83.0 =  (57.9467777777778) * C_prev  + (-1.001) * C_ksteps  + (-67.1782222222222) * C_fat  + (-91.8695555555555) * C_carb  + (-24.4021555555556) * C_prot  + (-11.5003777777778) * C_fiber  + (-3.21432222222223) * C_sugar  + (-14.1697111111111) * C_saturated  + (-1.61272222222222) * C_fasted  + (1.01),
> 153.0 =  (-11.1222222222222) * C_prev  + (-1.001) * C_ksteps  + (99.9887777777778) * C_fat  + (22.2444444444444) * C_carb  + (48.3705444444444) * C_prot  + (17.2283222222222) * C_fiber  + (-5.21632222222223) * C_sugar  + (9.15358888888888) * C_saturated  + (0.389277777777778) * C_fasted  + (1.01),
> 84.0 =  (-17.1282222222222) * C_prev  + (-1.001) * C_ksteps  + (49.9387777777778) * C_fat  + (17.2394444444444) * C_carb  + (7.72994444444445) * C_prot  + (5.01612222222222) * C_fiber  + (29.8186777777778) * C_sugar  + (10.6550888888889) * C_saturated  + (1.39027777777778) * C_fasted  + (1.01),
> 78.0 =  (-8.11922222222223) * C_prev  + (0.) * C_ksteps  + (-23.1342222222222) * C_fat  + (16.2384444444445) * C_carb  + (-26.1038555555556) * C_prot  + (-12.7015777777778) * C_fiber  + (31.8206777777778) * C_sugar  + (6.05048888888888) * C_saturated  + (-1.61272222222222) * C_fasted  + (1.01),
> 87.0 =  (-8.11922222222223) * C_prev  + (3.003) * C_ksteps  + (-19.1302222222222) * C_fat  + (28.2504444444444) * C_carb  + (-16.4942555555556) * C_prot  + (-5.09397777777778) * C_fiber  + (6.79567777777777) * C_sugar  + (14.7591888888889) * C_saturated  + (-0.111222222222222) * C_fasted  + (1.01),
> 87.0 =  (37.9267777777778) * C_prev  + (-4.004) * C_ksteps  + (-48.1592222222222) * C_fat  + (-83.8615555555555) * C_carb  + (-6.08385555555555) * C_prot  + (0.611722222222222) * C_fiber  + (-58.0691222222222) * C_sugar  + (-20.0756111111111) * C_saturated  + (-1.61272222222222) * C_fasted  + (1.01),
> 133.0 =  (-17.1282222222222) * C_prev  + (3.003) * C_ksteps  + (-56.1672222222222) * C_fat  + (15.2374444444444) * C_carb  + (13.4356444444444) * C_prot  + (3.01412222222222) * C_fiber  + (13.8026777777778) * C_sugar  + (-12.2678111111111) * C_saturated  + (-0.111222222222222) * C_fasted  + (1.01),
> 78.0 =  (-11.1222222222222) * C_prev  + (1.001) * C_ksteps  + (52.9417777777778) * C_fat  + (-2.78055555555555) * C_carb  + (5.82804444444444) * C_prot  + (-0.589477777777777) * C_fiber  + (-39.5506222222222) * C_sugar  + (-0.0556111111111198) * C_saturated  + (4.39327777777778) * C_fasted  + (1.01),
> 84.0 =  (-23.1342222222222) * C_prev  + (0.) * C_ksteps  + (10.8997777777778) * C_fat  + (79.3014444444444) * C_carb  + (-2.28005555555555) * C_prot  + (4.01512222222222) * C_fiber  + (23.8126777777778) * C_sugar  + (5.95038888888888) * C_saturated  + (-1.11222222222222) * C_fasted  + (1.01) },
> [C_prev, C_ksteps, C_fat, C_carb,
>  C_prot, C_fiber, C_sugar, C_saturated,
>  C_fasted]);
16                              18
it := [[C_prev = -0.7676394482 x 10  , C_ksteps = 0.1095758760 x 10  ,

16                             16
C_fat = 0.7856937061 x 10  , C_carb = -0.5792833066 x 10  ,

17                             17
C_prot = -0.1954662069 x 10  , C_fiber = 0.3025217874 x 10  ,

15                                  17
C_sugar = 0.7496058869 x 10  , C_saturated = -0.1779505040 x 10  ,

18
C_fasted = -0.1062355291 x 10  ]]

> C_prev_V := it[1][1];
16
C_prev_V := C_prev = -0.7676394482 x 10

> C_prev_M := SFloatMantissa(C_prev_V);
16
C_prev_M := C_prev = -0.7676394482 x 10

> C_prev_E := SFloatExponent(C_prev_V);
16
C_prev_E := C_prev = -0.7676394482 x 10

> quit;
memory used=2.3MB, alloc=8.3MB, time=0.03

## is it possible to identify mserver.exe in task man...

Asked by:

I always run with the option "create a new engine for each document". which is a very nice feature in Maple.

The problem is that, when I have say 5 worksheets open and running, and one of them them hangs, I need to kill mserver.,exe from the task manager which is running this worksheet.

most of the times I end up killing the wrong mserver.exe. I can sometimes guess by the CPU it is using. But if I have two running with high CPU it is not possible guess.

There is no ID or anything associated with the name. It will be nice if each process has in its name an ID which is also displayed in the worksheet bottom bar so one knows. This ID could be simply some random number. So the display will show  mserver-13847,exe ,   mserver-82739,exe and so on. And this name will be automtically displayed at the bottom bar of the worksheet where all time used, cpu used and memory used and so on is now displayed.  This will be a nice feature to add to Maple.

If this is not possible, how about just displaying the PID (process ID)  of the mserver.exe connected to the worksheet in the bottom bar? This will also work, as task manager/details lists a processes with the PID there, so it will make it easy to find.

Meanwhile, while waiting for Maple 2033 to hopefully implement this feature, does anyone know of a method to help find which mserver.,exe is connected to which specific worksheet?

Windows 10.

 First 91 92 93 94 95 96 97 Last Page 93 of 2297
﻿