MaplePrimes Questions

Hi everyone!

I am trying to count the number of operations (addition, subtraction, multiplication, division) in object "A".  I have donea lot of searching around, but haven't been able to find out how to do this.  Some help would be appreciated!

Count_the_number_of_operations_in_A.mw

Hi everyone!

I am trying to build a matrix using for loops.  I have been unable to construct a matrix using one "double" for loop using variables i and j.

Instead, I have 5 "single" for loops.  Could someone show me how to do this using a "double" loop over i and j (rows and colums)?

Thanks so much!

How_to_do_this_using_one_double_loop.mw

applyrule is useful but seems limited. I can't do operation such as expand in the RHS of the rule.

For example, I wanted to applyrule that says to take sin(x::anything) and change it to cos(expand(x)), but it does not expand x. 

It seems because in the RHS of the rule, at the instance applyrule sees expand, x remains a symbol and not evaluated. So there is nothing to expand. It gets evaluated at later time, but by then too late for expand to do anything, it is gone. Just a guess.

But is there a trick to allow one to do more things in RHS of applyrule, such as expand or simplify? This would make applyrule much more useful. Otherwise, as it is, applyrule is of limited use. 

I know I can use evalindets ofcourse for this. 

#expand does not work in RHS of applyrule
e1:=sin(2*sqrt(a*b)*(t+mu));
applyrule( sin(x::anything) = cos(expand(x)), e1);

sin(2*(a*b)^(1/2)*(t+mu))

cos(2*(a*b)^(1/2)*(t+mu))

#but other operations worksheetdir
e1:=sin(2*sqrt(a*b)*(t+mu));
applyrule( sin(x::anything) = cos(x^2), e1);

sin(2*(a*b)^(1/2)*(t+mu))

cos(4*a*b*(t+mu)^2)

expand(2*sqrt(a*b)*(t+mu))

2*(a*b)^(1/2)*t+2*(a*b)^(1/2)*mu

#I could do this ofcourse
evalindets(e1,'specfunc'(sin),X->sin(expand(op(1,X))));

sin(2*(a*b)^(1/2)*t+2*(a*b)^(1/2)*mu)

 

 

Download apply_rule.mw


Using other software, there is no such problem using other operations on RHS of a rule

You see, expand worked on RHS of rule. 

I'd like to do same thing using applyrule in Maple. Is there a trick to allow this?

Maple 2024.1

Hi,

When I enter this command into maple and press enter, nothing is produced.  That's the "first" problem.  However, what I am trying to do is to figure out how many calculations (multipication, addition, subtraction, division) are performed for each variable that "solve" is designed to solve.  Basically, how many math operations are performed when calculating A?

Thanks for your help!

Count_operations.mw

What is the name of the procedure that provides the information about which steps Maple is using to solve an equation? 

I ask because I think pdsolve is caught in a loop, but I can't see what it is trying.

(I can't think of this name at the moment. And Google Gemini returns nonsense. So, I am hoping that by answering this question, Google Gemini will be "trained.") 

What is the idea  of getting equation (48),(49), and (50)

I find thus equation of course i use a little bit seperation by hand, i have 11 equation but i can't get results of parameters i don't know why my code is a little bit old i think and i don't know there is another technique for finding them or not here is the file of mp, thanks for any help

F_P_Correct.mw

for apear each part  remove (:)

Change the length of the pendulum to achieve the analysis of the pendulum frequency change, but I scan the frequency of the two images do not correspond to each other, what is the problem?

sweep.mw

I need to automatically extend or truncate a colour list to suit number of points in plottools:-point plot.
extending the list the colour sequence could be repeated or if the is too awkard just add black.
I can't figure out how to select the list of colours to put into a new list to modify.

This will be inside a plotting procedure.

restart

with(ListTools)

[BinaryPlace, BinarySearch, Categorize, Classify, Collect, Deal, DotProduct, Enumerate, FindMaximalElement, FindMinimalElement, FindRepetitions, Flatten, FlattenOnce, Group, Interleave, InversePermutation, Join, JoinSequence, LengthSplit, MakeUnique, Occurrences, Pad, PartialSums, Reverse, Rotate, Search, SearchAll, SelectFirst, SelectLast, Slice, Sorted, Split, Transpose, Unpermute]

(1)

L:=[[1,2],[3,4],[-5,6],[-3,-2]]

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

(2)

qty:=nops(L)

4

(3)

styles:=[symbol=solidcircle,colour=[red,green,blue,orange],symbolsize=12]

[symbol = solidcircle, colour = [red, green, blue, orange], symbolsize = 12]

(4)

 

plots:-display(plottools:-point(L,styles[]))

 

#Need to extend or truncate the list of colours to match the number of points
#styles can be copied to styles 1,2 etc
#the extended list would be a repeatition of the colour sequence given
#would need to look for color or colour;

has(styles,colour); #how to select colour our into a seperate list?

true

(5)

#too few point for the colours;
L1:=[[1,2],[3,4],[-5,6]]

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

(6)

plots:-display(plottools:-point(L1,styles[]))

Error, (in Plot:-Structure:-Points) number of colors must match number of points

 

#too many point for the colours;
L2:=[[1,2],[3,4],[-5,6],[-3,-2],[6-1],[0,1]]

[[1, 2], [3, 4], [-5, 6], [-3, -2], [5], [0, 1]]

(7)

plots:-display(plottools:-point(L2,styles[]))

Error, (in plottools:-point) incorrect arguments for creating points structure, try providing the dimension option

 
 

 

Download 2024-09-06_Q_Extend_or_Truncate_List_of_Colours.mw

Hello

in this example Untitled.mw Maple 2022 on MacOs  'finds' a minimum bigger than the maximum.

It looks like something is wrong...

Best Nicola

How do I mute the action of an accent applied to a symbol so that the accented symbol is itself an inert object? See the attached example.

How_do_I_make_an_accented_symbol_inert.mw
 

As a newbie in Maple2024, my next step is to try to solve a Diophantine equation. Attempts with isolve failed. It is the famous task B3 from the IMO of 1988:

If for integers x and y the fraction (x^2+y^2)/(1+x*y) is a positive integer, then it is actually a square number.

The solution is well known. But I would like to learn how to use Maple using this example and would like some advice.

Best regards, Alfred_F

I was trying to odetest one of my solutions to this ode when I got this internal Maple error I have not seen before.

Is this a legitimate error? my solution could be wrong ofcourse but strange to get internal error in this case.

Does this happen on earlier versions of Maple?

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1798 and is the same as the version installed in this computer, created 2024, August 29, 14:22 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

sol:=Intat(1/(u^n/((1/((a*g(x)+b)^n)/(f(x)^n)*diff(g(x),x)*f(x))^(-n-1))/((f(x)*diff(g(x),x))^(-2*n+1))/((1/((a*g(x)+b)^n)/(f(x)^n)*diff(g(x),x)*f(x)*(diff(f(x),x)*diff(g(x),x)+f(x)*diff(diff(g(x),x),x))-(-1/((a*g(x)+b)^n)/(f(x)^n)*diff(g(x),x)^2*f(x)*n*a/(a*g(x)+b)-1/((a*g(x)+b)^n)/(f(x)^n)*diff(g(x),x)*n*diff(f(x),x)+1/((a*g(x)+b)^n)/(f(x)^n)*diff(diff(g(x),x),x)*f(x)+1/((a*g(x)+b)^n)/(f(x)^n)*diff(g(x),x)*diff(f(x),x))*f(x)*diff(g(x),x)-f(x)*diff(f(x),x)/((a*g(x)+b)^n)/(f(x)^n)*diff(g(x),x)^2*n)^n)/(n^(-n))-u+1),u = a/f(x)/(a*g(x)+b)*y(x))-ln(a*g(x)+b)+_C1 = 0;

Intat(1/(u^n/(((diff(g(x), x))*f(x)/((a*g(x)+b)^n*f(x)^n))^(-n-1)*(f(x)*(diff(g(x), x)))^(-2*n+1)*((diff(g(x), x))*f(x)*((diff(f(x), x))*(diff(g(x), x))+f(x)*(diff(diff(g(x), x), x)))/((a*g(x)+b)^n*f(x)^n)-(-(diff(g(x), x))^2*f(x)*n*a/((a*g(x)+b)^n*f(x)^n*(a*g(x)+b))-(diff(g(x), x))*n*(diff(f(x), x))/((a*g(x)+b)^n*f(x)^n)+(diff(diff(g(x), x), x))*f(x)/((a*g(x)+b)^n*f(x)^n)+(diff(g(x), x))*(diff(f(x), x))/((a*g(x)+b)^n*f(x)^n))*f(x)*(diff(g(x), x))-f(x)*(diff(f(x), x))*(diff(g(x), x))^2*n/((a*g(x)+b)^n*f(x)^n))^n*n^(-n))-u+1), u = a*y(x)/(f(x)*(a*g(x)+b)))-ln(a*g(x)+b)+_C1 = 0

ode:=diff(y(x),x)-f(x)^(1-n)*diff(g(x),x)*y(x)^n/((a*g(x)+b)^n)-diff(f(x),x)*y(x)/f(x)-f(x)*diff(g(x),x) = 0;

diff(y(x), x)-f(x)^(1-n)*(diff(g(x), x))*y(x)^n/(a*g(x)+b)^n-(diff(f(x), x))*y(x)/f(x)-f(x)*(diff(g(x), x)) = 0

odetest(sol,ode,y(x));

Error, (in PDEtools/NumerDenom) invalid input: PDEtools/NumerDenom expects its 1st argument, ee, to be of type Or(algebraic,table,rtable), but received {Intat(1/(u^n*(f(x)^(1-n)*diff(g(x),x)*(a*g(x)+b)^(-n))^n*(f(x)*diff(g(x),x))^(2*n)*n^n-u*(a*g(x)+b)^n*f(x)^n*(a*n*f(x)^(2-n)*diff(g(x),x)^3*(a*g(x)+b)^(-n-1))^n+(a*g(x)+b)^n*f(x)^n*(a*n*f(x)^(2-n)*diff(g(x),x)^3*(a*g(x)+b)^(-n-1))^n),u = _Z) = Intat(1/(u^n*(f(x)^(1-n)*diff(g(x),x)*(a*g(x)+b)^(-n))^n*(f(x)*diff(g(x),x))^(2*n)*n^n-u*(a*g(x)+b)^n*f(x)^n*(a*n*f(x)^(2-n)*diff(g(x),x)^3*(a*g(x)+b)^(-n-1))^n+(a*g(x)+b)^n*f(x)^n*(a*n*f(x)^(2-n)*diff(g(x),x)^3*(a*g(x)+b)^(-n-1))^n),u = _Z)}

 

 

Download internal_error_PDEtools_NumerDenom_sept_4_2024.mw

Is there a way to re-index an existing dataframe? See attachment for example.

how_do_i_re-index_a_dataframe.mw

So I have this Maple document that I worked on yesterday, and now when I open it it just opens as the start-up screen where I can choose between document and worksheet mode. I can see that the file is much larger (900 kb) than an empty document, so it should definitely have the data still in there, but opening it with a text editor I couldn't manage to fix my issue. Does anyone have any tips? I have a back-up of the file (from the restore backup menu), but most of the content is not there, so it would be very helpful to get this one fixed.

Exercises.mw
Thanks in advance, 
Kristian.

First 10 11 12 13 14 15 16 Last Page 12 of 2363