MathyMaple

25 Reputation

5 Badges

10 years, 130 days

MaplePrimes Activity


These are replies submitted by MathyMaple

@Carl Love 
ABSOLUTELY BRILLIANT!

I'm taken back by the difference. I was using lists and then taking entries with that list, I'll be using (and learning more about) tables.

Thankyou so much Carl Love for taking the time and effort to post this! I'm starting to think I want to learn more about coding. I'm also learning of the code people post so its much appreciated!

thankyou all so much for helping, not just with your time but your expertise.

@roman_pearce 
haha that is awesome, at first I thought "but arent you using a set and not a list" so I thought I would lose the ordering, but then realised maple only orders if its looking at numbers,

I learnt that it wont really matter which I use because I wont have more than 50k entries but I will still be using a set and not a list as you said to get faster than linear search.

thanks roman_pearce

@Stephen Forrest 
thanks so much
I'm new to maple and just learning, the showstat code is awesome!

also after I asked my last question I actually made a big list and member was instant and now I know that 

ListTools just uses member, so I'll just stick with member


you guys are awesome for helping!

@vv 
thankyou :)

@Kitonum 
thankyou Kitonum, that was useful reading
the post you referred to does suggest using ListTools:-Search(...)

thanks

@Preben Alsholm 

thanks Preben, this looks like exactly what im after,
I just have one naive question
I thought loading packages are slower than build in code like member

is the code you suggested a more efficient way?

I know how member works, it goes through each element until it hits the one you want, how does the code you suggested work?

thankyou

@Markiyan Hirnyk 

thanks but Preben already hinted to that alternative below. My main reason to stick with sum as apposed to add is to keep it looking symbolic as apposed to computing code, since I'm coming from a maths background. really did learn alot here and I thankyou greatly. :)

@ecterrab 

thankyou for your explanation, I had the same problem here
http://www.mapleprimes.com/questions/203535-Double-Summation-Is-Incorrect-BUG

I understand the reaons now but would like to point out that using a command such as nops(X) for a limit in the summation would not be evaluated (using 

Physics:-Setup(redefinesum = true)

I'm guessing your supressing any commands

this is what I used 

j:=0

X := [1, 2, 3, 4];

sum('sum(X[i]^(j+k), i = 1 .. nops(X))'*a[k], k = 0 .. 2);

for now I can just swap the summations and it works

@Markiyan Hirnyk 
shocked at how helpful you guys are! that post was very informative, after reading that I tried this

j:=0

X := [1, 2, 3, 4];

sum('sum(X[i]^(j+k), i = 1 .. nops(X))'*a[k], k = 0 .. 2);

 # from the post you mentioned this should work and supress the evaulation till the end
but I get the output 
a[0]+a[1]+a[2] # answer should of course be 4*a[0]+10*a[1]+30*a[2]

I rather not use

sum('sum'(X[i]^(j+k), i = 1 .. nops(X))*a[k], k = 0 .. 2);
#since I lose the summation symbol

but from the post provided by yourself, this should work (the single quotes around sum() )

-------------------------------------------------------------------------------------------
using 

Physics:-Setup(redefinesum = true);
it works but does not evaluate nops(X) (where I placed the limits), so that is not an option.

anything you can think of why

sum('sum(X[i]^(j+k), i = 1 .. nops(X))'*a[k], k = 0 .. 2);

 does not give correct output? I don't want to take more of your time, since Im happy to switch the summation so if its not clearly evident I would say my answer has been solved (thanks to you guys) :)

@Alejandro Jakubi 
Thankyou for your response! this community is really helpful thankyou all

@Markiyan Hirnyk 
Thanks Markiyan I've learnt alot of your replys to other members. but I'm not sure what I was meant to be looking at. must be late and brain freeze. but thanks for the effort! I'm sure to come back if/when I need help :)

@Preben Alsholm 

Using your first exmaple (A,B combine) I get 3a[0] but the correct answer is 4a[0], from a maths perspective.

however your second example is very detailed and clear, I now understand the reason thanks to your explanation. so maple is simplyfyinf earlier than I would have liked and I'm loosing a term. 

I'm an undergradute mathematics student and have read the help page and understood that add comand is more suited to this but I wanted to use symbols (so more readable from a maths tutor/students), hence sum command. I was working in 2d math and if I looked at it in 1dmath I would have broke it down myself so thanks for that I'll use that to see what maple does in the future. I really wanted to use the form that gives the wrong term, since that is basically copied from textbook but the other form will do.

Thankyou for your quick response and for your help :)
P.s. is there any way to tell maple not to evaulate and hence simplyfy 0^k=0 I tried placing '' around k but it doesnt work. not really a big thing but I'm curios. thanks again :)

Page 1 of 1