GPY

80 Reputation

5 Badges

9 years, 312 days

MaplePrimes Activity


These are replies submitted by GPY

@Markiyan Hirnyk 

How have the coefficients for the terms in f been determined?

@Thomas Richard 

if this vector is a part of a matrix, would I not need to specify the row-column in prices in order to get the cumulative sum? I basically need to compute the cumulative sum for each of the column vectors in my matrix which is defined as prices. 

@GPY 

but that seems like a redundant check

@GPY 

I realized that I needed the first condition to check if its a perfect cube and corrected it to 

if iroot(cubeprod,3)=i but it still doesn't invoke the function

@Carl Love 

for i from 1 to 10 do
cubeprod:=i^3;
if irem(cubeprod,3)=0 and irem(cubeprod,2)<>0 then
cubesum(cubeprod);
end if;
end do;

This just returns :

cubeprod=1
8
27
64
125
216
343
512
729
1000

 

@Carl Love 

It doesn't work with x3:= x^3 +3x^2 +3x -2 but works with x3:=x^3. The only issue is that in some cases it displays [9,10] and [10,9] as two different pairs while it shows [12,1] and not [1,12] as explained in the question to which I've attached the link.

http://www.mapleprimes.com/questions/203601-Procedure-Whose-Input-Is-An-Integer

@Carl Love 

If I had to emulate this algorithm for the taxicab numbers instead, would I be able to do so by changing the inequalities and some of the inbuilt functions such as isqrt()? Then, if x is given, x2=x^3, newx=x+1

newx^3=(x+1)^3=x^3+3x^2+3x+1=x^3 + 3*(x^2)+3(x+1)-2

=> x2=x2+3x^2+3x-2?

@tomleslie 

I guess I am sort of confused as to what exactly the 

ListTools[Search](k,ans) does; if I need to find the smallest integer n such that x^2+y^2=n has 6 solutions(6 representations) how is n=0? 

 

@tomleslie 

I've invvoked a function 

firstCount:=proc(k::nonnegint)
local ans:=quadsumstats(100);
return ListTools[Search](k,ans);
end proc;

and called it on 

firstCount(1)

firstCount(2)

... firstCount(6) and got the output as 0,0,0,1,0,0 where quadsumstats(100) is the array that you had mentioned earlier

@tomleslie 

for part 2.) I've been told that I need to find, for a given k, the smallest integer n that can be expressed as the sum of two squares in k different ways.

@Carl Love 

Can you explain why you've set x2 as x2:=x2 + 2*x -1?

@Carl Love 

Thanks Carl! If I had to subsequently use this initial velocity value to find the range of angles needed to hit a home run to "Right Field" given v_x=v0 cos(alpha) and v_y=v0sin(alpha) would I have to solve the system of differential equations including these equations again and then invert it to get alpha?

@Preben Alsholm 

F:=-((C_d)*rho*Pi*(r)^2*v*v)/2;
m:=0.145;
v0:=65;
g:=9.81;
v_x:=diff(x(t),t);
v_y:=diff(y(t),t);
d2v_x:=-((C_d)*rho*Pi*(r^2)*(v_x)*sqrt((v_x)^2 +(v_y)^2))/(2*m);
d2v_y:=-((C_d)*rho*Pi*(r^2)*(v_y)*sqrt((v_x)^2 +(v_y)^2))/(2*m)-g;
sys_ode:=v_x,v_y,d2v_x,d2v_y;
ic2:=x(0)=0,y(0)=0,D(x)(0)=v0/sqrt(2),D(y)(0)=v0/sqrt(2);
#dsolve({sys_ode,ic2},type=numeric);
dsn1:=dsolve({v_x,x(0)=0},numeric);
dsn1(1);
dns2:=dsolve({v_y,y(0)=0},numeric);
dns2(1);
dns3:=dsolve({d2v_x,D(x)(0)=v0/sqrt(2)},numeric);
dns3(1);
dns4:=dsolve({d2v_y,D(y)(0)=v0/sqrt(2)},numeric);
dns4(1);

on running this code, I get the following error/warning and output:

 

"proc(x_rkf45) ... end;
[t = 1., x(t) = HFloat(0.0)]
proc(x_rkf45) ... end;
[t = 1., y(t) = HFloat(0.0)]
Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)
Error, (in DEtools/convertsys) unable to convert to an explicit first-order system
dns3(1)
Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)
Error, (in DEtools/convertsys) unable to convert to an explicit first-order system
dns4(1)"


I seem to have defined the initial conditions for the velocities as you had suggested but have not been able to get it to work..

I've got a vector xmin=[xnew,ynew,znew] and minmat:=(A.xmin-b). Now, when I type in a statement as follows:

with(Optimization):
Minimize(norm(minmat,3));

I get an error saying the norm contains absolute values that are not differentiable at 0 and hence the NLPSolve function that runs at the back to get the minimum values of xnew,ynew,znew fails.

"Error, (in Optimization:-NLPSolve) abs is not differentiable at 0"

I used the same method for another matrix and was able to get the minimum values and so, don't really understand why it has failed in this case

@Carl Love 

I've replicated the code you provided and the animation seems to get stuck at a particular frame, without updating dynamically; including a "restart" statement didn't seem to fix it

1 2 Page 1 of 2