MaplePrimes Questions

 

Question

Find t1,t2,t3,...t9 in Matrix
Matrix(3, 3, {(1, 1) = 1+t1, (1, 2) = t2, (1, 3) = t3, (2, 1) = t4, (2, 2) = 1+t5, (2, 3) = t6, (3, 1) = t7, (3, 2) = t8, (3, 3) = t9})

osys := (1/2)*(-x-x*t1-y*t2-y*t3+sqrt(x^2+2*x^2*t1+2*x*y*t2+2*x*y*t3+x^2*t1^2+2*x*t1*y*t2+2*x*t1*y*t3+y^2*t2^2+2*y^2*t2*t3+y^2*t3^2-4*x*t4*y*t9-4*x^2*t4*t7-4*x*t4*y*t8-4*y^2*t9-4*y*x*t7-4*y^2*t8-4*y^2*t5*t9-4*y*t5*x*t7-4*y^2*t5*t8-4*y^2*t6*t9-4*y*t6*x*t7-4*y^2*t6*t8))/(x*t4+y+y*t5+y*t6) = (-x+sqrt(x^2-x*y-2*y^2))/(2*y+x)
sys1 := subs(x=0, osys);
sys2 := subs(y=0, osys);
sys3 := subs(x=1, osys);
sys4 := subs(y=1, osys);
sys5 := subs(x=2, osys);
sys6 := subs(y=2, osys);
sys7 := subs(x=3, osys);
sys8 := subs(y=3, osys);
sys9 := subs(x=4, osys);
solve([sys1, sys2, sys3, sys4, sys5, sys6, sys7, sys8, sys9],[t1,t2,t3,t4,t5,t6,t7,t8,t9]);

 

since i have only one equation osys, to find t1..t9, i substitute some values into x and y to get enough equation to solve this , however, the result is not expected below

 

then i try without x= 0 or y = 0 , i failed

sys1 := subs(x=3,subs(y=2, osys));
sys2 := subs(x=5,subs(y=1, osys));
sys3 := subs(x=1,subs(y=5, osys));
sys4 := subs(x=1,subs(y=2, osys));
sys5 := subs(x=2,subs(y=5, osys));
sys6 := subs(x=5,subs(y=2, osys));
sys7 := subs(x=2,subs(y=1, osys));
sys8 := subs(x=3,subs(y=5, osys));
sys9 := subs(x=5,subs(y=3, osys));
solve([sys1, sys2, sys3, sys4, sys5, sys6, sys7, sys8, sys9],[t1,t2,t3,t4,t5,t6,t7,t8,t9]);

 

 

solution : Matrix(3, 3, {(1, 1) = 2, (1, 2) = 0, (1, 3) = 0, (2, 1) = 1, (2, 2) = 1, (2, 3) = 1, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1})

 t1 = 1

t2 = 0

t3 = 0

t4 = 1

t5 = 0

t6 = 1 

t7 = 0

t8 = 0

t9 = 1

Trying to write a procedure to just reduce the vales of x.. 

restart: 

proc_r:= proc(x :: numeric) 

local x0:

x := x0: 

 

#reducing the value to between -Pi and Pi

 

do 

 if ( x0 <= evalf(Pi) ) then 

  break: 

 end if: 

 

 x0 := x0 - 2*evalf(Pi)

end do: 

 

do 

 if (x0 >= evalf(-Pi) ) then

  break: 

 end if:

 

 x0 := x0 + 2*evalf(Pi)

end do: 

 

#using the symmetry of sin to reduce to between -Pi/2 and Pi/2 

 

 if (x0 <= evalf(Pi/2) ) then  

 break:

end if: 

x0 := evalf(Pi) - x0:

 

if (x0 >= evalf(-Pi/2) ) then 

 break:

end if: 

x0 := evalf(-Pi) - x0:

 

return x0:

 

end proc:

 

proc_r(7);  

 

Error, (in proc_r) illegal use of a formal parameter

 

Why do i get this error message... 
How do i fix it? 

Hi there!

I wrote a piece of code which spits out the numerical datapoints (x,y(x)) corresponding to a function y(x). So that the result is accurate, I need quite a lot of data points - currently I am working with 5k.

In order to work with this function later, I interpolated it with a Spline. For instance, I would like to sample the function values on a fifferent grid, etc.. However the evaluation of this function really takes up hell of a lot of time, and the reason seems to be, that it, being a spline on 5k nodes, is simply a huge expression.

Is there a better way to do this? Are other fitting functions than a spline maybe better suited?

Thanks for help!

 

I have defined the following procedure, S(x,a,b,s), in Maple with the goal of creating an exportable two column, multi-row array, containing the least positive real root of a high order polynomial f(x,y)=0 in the 2nd column, and a parameter y in the first column.

The procedure takes four numerical arguments (x,a,b,s) and varies parameter y from the initial non-negative value of a, by stepsize s, until the value min(b,1) is reached.

Unfortunately, the output 4x2 array only has the last calculated [y,solution] entries in the first row. Successive rows are filled with zeros.

Is there anyone kind enough to point out the error in the way I have defined this procedure? Many thanks in advance. Procedure is:

S := proc (x, a, b, s
   global Ry;
   for y from a by s to b while y < 1
     do R := Array(1 .. ceil((min(b, 1)-a)/s), 1 .. 2, [[y, FindMinimalElement(select(type, [fsolve(f(x) = 0)], positive))]])
     end do;
     end proc;

I have a nested list a := [[1,2,3],[4,5,6],[7,8,9]]: and would like to apply a function f to the 1st elements in nested list, e.g. [[f(1),2,3],[f(4),5,6],[f(7),8,9]]. How can I achieve this?

Thanks in advance.

what is the difference between endomorphism and identity map?

http://mathfaculty.fullerton.edu/mathews//n2003/hornermod.html

i find a program above, 

if no general method, how about specific to convert it

if have general method, how is it?

I have defined a function by doing

 

f:= (x1,x2,x3) -> sum( [complicated expression], [summation ranges]),

 

which Maple converts to an explicit polynomial in x1,x2,x3.

 

However, it seems Maple does not quite think of f as this polynomial, but always remembers the original definition of f. How should I do in order for Maple to really define f to be this explicit polynomial?

 

 

I'm trying to animate transparency, here's are the plots:

A :=tranz-> plot3d(-2/sqrt(x^2+y^2)+5/sqrt((x-1.6)^2+y^2), x = -5 .. 5, y = -5 .. 5, view = [-5 .. 5, -5 .. 5, -5 .. 5], transparency = tranz) end proc;
B := sphere([0, 0, 0], 2*(1/10), color = magenta, style = patchnogrid):
C := sphere([1.6, 0, 0], 5*(1/10), color = green, style = patchnogrid);
E := plot3d(0, x = -5 .. 5, y = -5 .. 5, view = [-5 .. 5, -5 .. 5, -5 .. 5], style = wireframe, shading = zgrayscale):

here I am displaying them without a problem:

display(A(.5), B, C, E, scaling = constrained, view = [-5 .. 5, -5 .. 5, -5 .. 5], axes = normal)

here I am trying to animate the transparency in plot A to no avail :( :

animate(display, [A(tranz), B, C, E, scaling = constrained, view = [-5 .. 5, -5 .. 5, -5 .. 5], axes = normal], tranz = 0.1 .. 0.9)
Error, (in plot3d) expecting option transparency to be of type {"default", realcons} but received tranz

if you guys could help me find where I'm going wrong I'd be super grateful :D

thanks everyone.

Best,

-Mike

I have an equation with the following structure:

sin(a)-sin(b)=0;

Maple can solve this:

solve(%,[b]);

[[b=a]]

so it misses the 2nd solution (b=π-a). I can use the allsolutions qualifier:

solve(%,[b],allsolutions);

and now Maple returns an expression that, while correct, is really not conducive to further work without fairly massive substition work (_Z10 has to be 0 and the solutions wanted have _B10 0 and 1). In a classroom settng this is not helpful. Try as I might using the options to solve I have not found a way to make this into a list of the two solution I want without extensively mucking around with the expression. Is there any way to coerce solve to return something simpler?

I really want something like

[b=a,b=π-a]

TIA,

Mac Dude.

 

hello,

restart:

ODE:=diff(T(z),z$2)+A1*(S-1/L+1/L*exp(-L*z))*diff(T(z),z)+A2*T(z)=0;

bcs:=T(0)=1,T(infinity)=0;

bcs:=T(0)=1,T(A3)=0;

dsolve({ODE,bcs});

where, A1, A2, A3, L, S are all constants.

i get an exact solution but is there any way around to get a more compact solution?

 

 

Greetings to all.

At the following Math.Stackexchange Discussion a certain constant was computed in relation to a Master Theorem Type recurrence being solved. This prompted me to try to identify it by the use of the eponymous command. What follows is the content of the Maple session. You may want to read the post in order to get an understanding of what the constant means and how its exact value is calculated.

> fsolve(2/2^a+1/4^a=1, a);
                                   1.271553303

> identify(%);
                                   1.271553303

> identify(%,all);
                                 1/2    1/2
                              2 2      3
                      arcsech(------ + ---- - 1/6 Zeta(5))
                                7       6

> evalf(log[2](1+sqrt(2)));
                                   1.271553303

My questions/observations are:

  • Why does the algorithm fail to spot as simple a constant as the one above or am I just not invoking it correctly?
  • If that last formula were true the author of this code would certainly win a prize for calculating a closed form expression for an odd integer zeta function value! (To be fair here I did notice that the spurious identification disappears when the number of working digits is increased and I do understand that the identification depends critically on the number of digits.)

In concluding I would like to say, why the complicated formula and not the simple one? Let me congratulate you just the same on providing this very useful command. I have worked on pandigital approximations which are slightly related and I understand that adding an operation like the logarithm to an integer base up to some max base value can dramatically increase the search space and may not always be feasible.

Best regards,

Marko Riedel

I want to use maple to solve the following recursive inhomogenous equation:

Xn+2 - 5xn+1 6xn = 4n+1

I thought I could write like this:

 

 but it doesn't work. I get the error message

"Error, (in rsolve/single) equation false = 0 does not involve function F()"

How should I write in order to solve it?

Data.xlsx

XY.mw

XYZ.mw

 

Hello,

I'm using the Global Optimization Toolbox to solve some examples and fit equations to a given data, finding "unknown" parameters. I generated the data on Excel, and I already know the values of these parameters.

The XY case is (there is no problem here, I just put as a example I follow):

> with(GlobalOptimization);
> with(plots);

> X := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "I5:I25");
> Y := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "J5:J25");

> XY := zip( (X, Y) -> [X, Y] , X, Y);
> fig1 := plot(XY, style = point, view = [.9 .. 3.1, 6 .. 40]);


> Model := A+B*x+C*x^2+D*cos(x)+E*exp(x):
> VarInterv := [A = 0 .. 10, B = 0 .. 10, C = -10 .. 10, D = 0 .. 10, E = 0 .. 10];

> ModelSubs := proc (x, val)

    subs({x = val}, Model)

    end proc;


> SqEr := expand(add((ModelSubs(x, X(i))-Y(i))^2, i = 1 .. 21));
> CoefList := GlobalSolve(SqEr, op(VarInterv), timelimit = 5000);

> Model := subs(CoefList[2], Model):

 

I could find the right values of A, B, C, D and E. 

 

My problem is in the XYZ case, where I don't know how to "write" the right instruction. My last attempt was:

> with(GlobalOptimization);
> with(plots);

> X := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "Q5:Q25"); X2 := convert(X, list);
> Y := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "R5:R25"); Y2 := convert(Y, list);
> Z := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "S5:S25"); Z2 := convert(Z, list);
> NElem := numelems(X);

> pointplot3d(X2, Y2, Z2, axes = normal, labels = ["X", "Y", "Z"], symbol = box, color = red);

 

> Model := A*x+B*y+C*sin(x*y)+D*exp(x/y);

> VarInterv := [A = 0 .. 10, B = 0 .. 10, C = 0 .. 10, D = 0 .. 10];

> ModelSubs:=proc({x,y},val)

subs({(x,y)=val},Model)

end proc:
Error, missing default value for option(s)

> SqEr := expand(add((ModelSubs(x, y, X(i), Y(i))-Z(i))^2, i = 1 .. NElem));
> CoefList := GlobalSolve(SqEr, op(Range), timelimit = 5000);
Error, (in GlobalOptimization:-GlobalSolve) finite bounds must be provided for all variables

 

My actual problem involves six equations, six parameters and four or five independent variables on each equation, but I alread developed a way to solve two or more equations simultaneously.

Thanks

Hi guys! Maple noob here.

I want to get an array of the sums of each and every row of a matrix which I imported from Excel. I can't manage to work my way around with LinearAlgebra-Add, Sum and eval. Maple always shows me the table and not the scalar I am looking for.

I'd also like to know how to tell Maple how to do something on a certain interval of cells of the matrix.

I hope I have been clear and you can help me out :D

Cheers from Italy!

First 1466 1467 1468 1469 1470 1471 1472 Last Page 1468 of 2426