Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

How to let sqrt(5*x+5+y) become sqrt(5*(x+1)+y) automatically?

Dear all,

Following the comments I am editing this post:

I have a function F of variables (r1,r2,theta1,theta2,r,theta,a). r1, r2,theta1,theta2 are function of r,  theta and a. I want to take derivative of F with respect to a. r and theta are independent of a . I expressed everything in terms of 'a' as a function of 'a' at first. Then I use diff(F, a). I see there is an error in the final expression G .There is a restriction that theta1 should lie between -Pi to Pi and theta2 between 0 to 2*Pi. I speculate this is the source of error. Work sheet is attached. Reason: value of G: integration in 0 to pi/4 gives some  value but for 0 to pi it evaluates to zero and so is the case with 0 to 2*Pi. As "G "physically represents energy it must be a positive value.
 


restart;

theta1 := unapply(arctan(r*sin(theta)/(r*cos(theta)-a)), a);

proc (a) options operator, arrow; arctan(r*sin(theta)/(r*cos(theta)-a)) end proc

(1)

 

## theta1 -->[-Pi,Pi] and theta2-->[0,2*Pi]

NULL

theta2 := unapply(arctan(r*sin(theta)/(r*cos(theta)+a)), a);

proc (a) options operator, arrow; arctan(r*sin(theta)/(r*cos(theta)+a)) end proc

(2)

``

r1:=unapply(sqrt((r*cos(theta)-a)^2+r^2*(sin(theta))^2),a);r2:=unapply(sqrt((r*cos(theta)+a)^2+r^2*(sin(theta))^2),a);

proc (a) options operator, arrow; ((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2) end proc

 

proc (a) options operator, arrow; ((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2) end proc

(3)

sigma12:=0;sigma22:=sigma;

0

 

sigma

(4)

plot(arctan(tan(x)), x = (1/2)*Pi .. Pi)

 

## I have to use a constraint that

assume(theta1(a) < Pi, theta1(a) > -Pi, theta2(a) > 0, theta2(a) < 2*Pi, a>0,r>0)

u1:=(1+nu)*sigma22*sqrt(r1(a)*r2(a))*(4*(1-2*nu)*cos((theta1(a)+(theta2(a)))/2)-4*r*(1-nu)*cos(theta)/sqrt(r1(a)*r2(a))-2*r^2/(r1(a)*r2(a))*(cos((theta1(a)+(theta2(a)))/2)-cos(2*theta-theta1(a)/2-(theta2(a))/2)))/(4*E)+(1+nu)*sigma12*sqrt(r1(a)*r2(a))*(2*(1-2*nu)*sin((theta1(a)+(theta2(a)))/2)-2*r*(1-nu)*sin(theta)/sqrt(r1(a)*r2(a))+1*r^2/(r1(a)*r2(a))*sin(theta)*cos(theta-theta1(a)/2-(theta2(a))/2))/(E);

 

(1/4)*(1+nu)*sigma*(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)*(4*(1-2*nu)*cos((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-4*r*(1-nu)*cos(theta)/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)-2*r^2*(cos((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-cos(2*theta-(1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a))))/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2)))/E

(5)

NULL

u2:=(1+nu)*sigma*sqrt(r1(a)*r2(a))*(8*(1-nu)*sin((theta1(a)+(theta2(a)))/2)-4*r*(nu)*sin(theta)/sqrt(r1(a)*r2(a))-2*r^2/(r1(a)*r2(a))*(sin((theta1(a)+(theta2(a)))/2)+sin(2*theta-theta1(a)/2-(theta2(a))/2)))/(4*E)+(1+nu)*sigma12*sqrt(r1(a)*r2(a))*((1-2*nu)*cos((theta1(a)+theta2(a))/2)+2*r*(1-nu)*cos(theta)/sqrt(r1(a)*r2(a))-1*r^2/(r1(a)*r2(a))*sin(theta)*sin(theta-theta1(a)/2-theta2(a)/2))/(E);

 

(1/4)*(1+nu)*sigma*(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)*(8*(1-nu)*sin((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-4*r*nu*sin(theta)/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)-2*r^2*(sin((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))+sin(2*theta-(1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a))))/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2)))/E

(6)

 

## get u_r and u_theta as u[1] and u[2]

u[1] := u1*cos(theta)+u2*sin(theta);

(1/4)*(1+nu)*sigma*(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)*(4*(1-2*nu)*cos((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-4*r*(1-nu)*cos(theta)/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)-2*r^2*(cos((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-cos(2*theta-(1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a))))/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2)))*cos(theta)/E+(1/4)*(1+nu)*sigma*(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)*(8*(1-nu)*sin((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-4*r*nu*sin(theta)/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)-2*r^2*(sin((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))+sin(2*theta-(1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a))))/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2)))*sin(theta)/E

(7)

u[2] := -sin(theta)*u1+cos(theta)*u2;

-(1/4)*sin(theta)*(1+nu)*sigma*(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)*(4*(1-2*nu)*cos((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-4*r*(1-nu)*cos(theta)/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)-2*r^2*(cos((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-cos(2*theta-(1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a))))/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2)))/E+(1/4)*cos(theta)*(1+nu)*sigma*(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)*(8*(1-nu)*sin((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-4*r*nu*sin(theta)/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2))^(1/2)-2*r^2*(sin((1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))+(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))+sin(2*theta-(1/2)*arctan(r*sin(theta)/(r*cos(theta)-a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a))))/(((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2)*((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2)))/E

(8)

Diff_ur := simplify(diff(u[1], a));

(1/2)*sigma*(1+nu)*a*(-(-2*cos(theta)*a*r+a^2+r^2)^(1/2)*(2*cos(theta)*a*r+a^2+r^2)^(1/2)*r^2*cos(theta)*(a-r)*(a+r)*cos(2*theta+(1/2)*arctan(r*sin(theta)/(-r*cos(theta)+a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))+(-2*cos(theta)*a*r+a^2+r^2)^(1/2)*(2*cos(theta)*a*r+a^2+r^2)^(1/2)*r^2*sin(theta)*(a^2+r^2)*sin(2*theta+(1/2)*arctan(r*sin(theta)/(-r*cos(theta)+a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))+((a^2*r^2-r^4)*(2*cos(theta)*a*r+a^2+r^2)^(1/2)*(-2*cos(theta)*a*r+a^2+r^2)^(1/2)-4*(-2*cos(theta)*a*r+a^2+r^2)*(2*cos(theta)*a*r+a^2+r^2)*(-4*r^2*(nu-3/4)*cos(theta)^2+(3*nu-5/2)*r^2+a^2*(nu-1/2)))*cos(theta)*cos((1/2)*arctan(r*sin(theta)/(-r*cos(theta)+a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-sin(theta)*((2*cos(theta)*a*r+a^2+r^2)^(1/2)*r^2*(a^2+r^2)*(-2*cos(theta)*a*r+a^2+r^2)^(1/2)-4*(-2*cos(theta)*a*r+a^2+r^2)*(2*cos(theta)*a*r+a^2+r^2)*(-4*r^2*(nu-3/4)*cos(theta)^2+(a^2+r^2)*(nu-1)))*sin((1/2)*arctan(r*sin(theta)/(-r*cos(theta)+a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a))))/((-2*cos(theta)*a*r+a^2+r^2)^(3/2)*(2*cos(theta)*a*r+a^2+r^2)^(3/2)*((-2*cos(theta)*a*r+a^2+r^2)^(1/2)*(2*cos(theta)*a*r+a^2+r^2)^(1/2))^(1/2)*E)

(9)

``

 

Diff_ut := simplify(diff(u[2], a));

-(1/2)*sigma*(1+nu)*a*(-(-2*cos(theta)*a*r+a^2+r^2)^(1/2)*(2*cos(theta)*a*r+a^2+r^2)^(1/2)*r^2*sin(theta)*(a^2+r^2)*cos(2*theta+(1/2)*arctan(r*sin(theta)/(-r*cos(theta)+a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))-(-2*cos(theta)*a*r+a^2+r^2)^(1/2)*(2*cos(theta)*a*r+a^2+r^2)^(1/2)*r^2*cos(theta)*(a-r)*(a+r)*sin(2*theta+(1/2)*arctan(r*sin(theta)/(-r*cos(theta)+a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))+sin(theta)*((2*cos(theta)*a*r+a^2+r^2)^(1/2)*r^2*(a^2+r^2)*(-2*cos(theta)*a*r+a^2+r^2)^(1/2)-4*(-2*cos(theta)*a*r+a^2+r^2)*(-4*r^2*(nu-3/4)*cos(theta)^2+(a^2+r^2)*(nu-1/2))*(2*cos(theta)*a*r+a^2+r^2))*cos((1/2)*arctan(r*sin(theta)/(-r*cos(theta)+a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))+((a^2*r^2-r^4)*(2*cos(theta)*a*r+a^2+r^2)^(1/2)*(-2*cos(theta)*a*r+a^2+r^2)^(1/2)-4*(-2*cos(theta)*a*r+a^2+r^2)*(-4*r^2*(nu-3/4)*cos(theta)^2+(3*nu-2)*r^2+a^2*(nu-1))*(2*cos(theta)*a*r+a^2+r^2))*sin((1/2)*arctan(r*sin(theta)/(-r*cos(theta)+a))-(1/2)*arctan(r*sin(theta)/(r*cos(theta)+a)))*cos(theta))/((-2*cos(theta)*a*r+a^2+r^2)^(3/2)*(2*cos(theta)*a*r+a^2+r^2)^(3/2)*((-2*cos(theta)*a*r+a^2+r^2)^(1/2)*(2*cos(theta)*a*r+a^2+r^2)^(1/2))^(1/2)*E)

(10)

``

# find the limiting case

Att := limit(Diff_ut*r*sin(2*theta), r = infinity);

(2*a*sigma*cos(theta)^3*sin(theta)^2*nu+2*a*sigma*cos(theta)*sin(theta)^4*nu+2*a*sigma*cos(theta)^3*sin(theta)^2+2*a*sigma*cos(theta)*sin(theta)^4-8*a*sigma*cos(theta)*sin(theta)^2*nu^2-6*a*sigma*cos(theta)*sin(theta)^2*nu+2*a*sigma*cos(theta)*sin(theta)^2)/(((cos(theta)^2+sin(theta)^2)/cos(theta)^2)^(1/2)*E)

(11)

Arr := limit(Diff_ur*r*(1-cos(2*theta)), r = infinity);

(-16*a*sigma*cos(theta)^6*nu^2-16*a*sigma*cos(theta)^4*sin(theta)^2*nu^2-6*a*sigma*cos(theta)^6*nu-6*a*sigma*cos(theta)^4*nu*sin(theta)^2+10*a*sigma*cos(theta)^6+10*a*sigma*sin(theta)^2*cos(theta)^4+28*a*sigma*cos(theta)^4*nu^2+20*a*sigma*cos(theta)^2*sin(theta)^2*nu^2+10*a*sigma*cos(theta)^4*nu+4*a*sigma*cos(theta)^2*sin(theta)^2*nu-18*a*sigma*cos(theta)^4-16*a*sigma*sin(theta)^2*cos(theta)^2-12*a*sigma*cos(theta)^2*nu^2-4*a*sigma*sin(theta)^2*nu^2-4*a*sigma*cos(theta)^2*nu+2*a*sigma*sin(theta)^2*nu+8*a*sigma*cos(theta)^2+6*a*sigma*sin(theta)^2)/(cos(theta)*((cos(theta)^2+sin(theta)^2)/cos(theta)^2)^(1/2)*E)

(12)

G := (1/8)*(int(Arr+Att, theta = 0 .. Pi/2))*sigma*4;

-(1/8)*Pi*a*sigma^2*(4*nu^2-nu-5)/E

(13)

simplify(G)

-(1/8)*Pi*a*sigma^2*(4*nu^2-nu-5)/E

(14)

 


Download Derivative_implicit_maplePrime.mw

 

Thanks,

Hi,

 

Is there any way to add arrows to the parametrics plot to show the direction they are going? Thanks. 

Hi,

How would I tell maple to solve for the variable t? The answer should be 4. 

[t-2,(t-2)^2]

[(3t/2)-4,(3t/2)-2]

I need to set them equal to eachother and then solve for t. 

 

Thanks!

Suppose that n is a positive integer number and [k1,k2,...,kn] is a list of non-negative integer numbers. 

My Question: How to create the procedure proc([k1,k2,...,kn]) such that the output of this procedure is in the following form:

For i1 from 0 to k1 do

for i2 from 0 to k2 do

......................

for in from 0 to kn do

i1+i2+...+in

end do; end do;...end do;

This application describes the motion of a pendulum attached to a moving pivot, all in 2D.

https://www.maplesoft.com/applications/view.aspx?SID=4888

 
How can this situation be generalized to a pendulum attached to a pivot which moves along a 3D spacecurve?

The Joint Mathematics Meetings are taking place next week (January 16 – 19) in Baltimore, Maryland, U.S.A. This will be the 102nd annual winter meeting of the Mathematical Association of America (MAA) and the 125th annual meeting of the American Mathematical Society (AMS).

Maplesoft will be exhibiting at booth #501 as well as in the networking area. Please stop by to chat with me and other members of the Maplesoft team, as well as to pick up some free Maplesoft swag or win some prizes.

This year we will be hosting a hands-on workshop on Maple: A Natural Way to Work with Math

This special event will take place on Thursday, January 17 at 6:00 -8:00 P.M. in the Holiday Ballroom 4 at the Hilton Baltimore.

 

There are also several other interesting Maple related talks:

MYMathApps Tutorials

MAA General Contributed Paper Session on Mathematics and Technology 

Wednesday January 16, 2019, 1:00 p.m.-1:55 p.m.

Room 323, BCC
Matthew Weihing*, Texas A&M University 
Philip B Yasskin, Texas A&M University 

 

The Logic Behind the Turing Bombe's Role in Breaking Enigma. 

MAA General Contributed Paper Session on Mathematics and Technology 

Wednesday January 16, 2019, 1:00 p.m.-1:55 p.m.
Room 323, BCC
Neil Sigmon*, Radford University 
Rick Klima, Appalachian State University 

 

On a software accessible database of faithful representations of Lie algebras. 

MAA General Contributed Paper Session on Algebra, I 

Wednesday January 16, 2019, 2:15 p.m.-6:25 p.m.
Room 348, BCC
Cailin Foster*, Dixie State University 
 

Discussion of Various Technical Strategies Used in College Math Teaching. 

MAA Contributed Paper Session on Open Educational Resources: Combining Technological Tools and Innovative Practices to Improve Student Learning, IV 

Friday January 18, 2019, 8:00 a.m.-10:55 a.m.
Room 303, BCC
Lina Wu*, Borough of Manhattan Community College-The City University of New York 
 

An Enticing Simulation in Ordinary Differential Equations that predict tangible results. 

MAA Contributed Paper Session on The Teaching and Learning of Undergraduate Ordinary Differential Equations 

Friday January 18, 2019, 1:00 p.m.-4:55 p.m.
Room 324, BCC
Satyanand Singh*, New York City College of Technology of CUNY 
 

An Effort to Assess the Impact a Modeling First Approach has in a Traditional Differential Equations Class. 

AMS Special Session on Using Modeling to Motivate the Study of Differential Equations, I 
Saturday January 19, 2019, 8:00 a.m.-11:50 a.m.

Room 336, BCC
Rosemary C Farley*, Manhattan College 
Patrice G Tiffany, Manhattan College 

 

If you are attending the Joint Math meetings this week and plan on presenting anything on Maple, please feel free to let me know and I'll update this list accordingly.


See you in Baltimore!

Daniel

Maple Product Manager

Hello,

I will explain my problem on a simple function and some data.

mg:=78.54*7.85*1e-9*1000*9.81;l:=10000;l0:=12000;h:=0;H := 28.399;
eta:=mg*l/(2*H);
zeta:=arcsinh(mg*h/(2*H*sinh(eta)))-eta;
z:=H/mg*(cosh(mg/H*x+zeta)-cosh(zeta));
plot(z,x=0..l);

Above is a definition of an initial plot. Now I would like to draw a new plot in which every x coordinate is shifted horizontally by a function:

deltax:=H*arcsinh(x)-x;

As you see I can't use translate or scale so I've tried to use a transform function but I can't do it the right way.

I would be grateful for any ideas.

 

Greetings,

Iza

Hi!

I have a rather long Maple code and want it to be executed multiple times with a parameter changed each time.

Surely this can be done with the loop structure, but it seems the whole loop structure must be contained into one single execution group, which makes it to be a little inconvenient, since the code is too long.

 

So is there any alternative way to realize this utility?

 

Best regard and thanks!

I have a function defined which maps x to a polynomial.

The coefficients are highly precise floating point numbers, which is necessary since it needs to be accurate, however when I try to print the function it looks like a massive mess.

I tried to use print(evalf[4](f)); in an attempt to simplify it however this evaluation seems to have no effect on how it is displayed.

As I said, I can't use evalf when defining the function since it needs high precision.

Is there a way to do this without creating a clone of the function with the coefficients evaluated, just to print it on screen?
 

Hi,

I'm trying to find a way to write in maple syntax a circle approximated with tangents; I'm not sure how to evaluate an equation that yields multiple functions as an output. I am able to do it in Derive6.1 and Desmos; however, I am not able to do it with maple.  Can someone people help me with the proper syntax? I'll leave a picture for what I want to be able to do in Maple.  I am trying to do with with vectors (parametrically).  

 

https://www.desmos.com/calculator/qpvldqadgb

 

Thanks

Hi there!

Basically I want to compare graphs in one coordinate system, however one of the graphs is set to 0 everywhere if the values of the y-coordinates differ too much from the values of the other graph. The procedure is below, how can I get around that?

I have already checked that all the values are calculated correctly and are displayed properly if the values of the other graph

are close enough.

Unfortunately I dont know how to send pictures.

Thanks, Daniel

 

PlottingVergleich:=proc(Unten2,Oben2,f2Nr1,G2Nr1,f2Nr2,G2Nr2,UntenN,ObenN)::plot;
local SpeichervektorX, #speichert die Stützstellen
SpeichervektorYAbs1, SpeichervektorYAbs2, #speichert die Stützwerte des späteren Splines aus den                                                 #absoluten Fehlern von f2Nr1 bzw. f2Nr2
SpeichervektorYRel1, SpeichervektorYRel2, #speichert die Stützwerte des späteren Splines aus den                                                 #relativen Fehlern von f2Nr1 bzw. f2Nr2
i2, #Laufvariable
InterpolationsfunktionAbs1,InterpolationsfunktionAbs2, #speichert den Spline aus den absoluten Fehlern                                                        #von f2Nr1 bzw. f2Nr2
InterpolationsfunktionRel1,InterpolationsfunktionRel2, #speichert den Spline aus den relativen Fehlern                                                        #von f2Nr1 bzw. f2Nr2
GraphAbs1,GraphAbs2, #speichert den Graphen aus dem Spline aus den absoluten Fehlern                                        #von f2Nr1 bzw. f2Nr2
GraphRel1,GraphRel2, #speichert den Graphen aus dem Spline aus den relativen Fehlern                                        #von f2Nr1 bzw. f2Nr2
PunkteAbs1,PunkteAbs2, #speichert den Punktgraphen aus den absoluten Fehlern                                                  #von f2Nr1 bzw. f2Nr2
PunkteRel1,PunkteRel2; #speichert den Punktgraphen aus den relativen Fehlern                                                  #von f2Nr1 bzw. f2Nr2
with(CurveFitting):
with(plots):
SpeichervektorX := Vector[row](ObenN-UntenN+1);
SpeichervektorYAbs1 := Vector[row](ObenN-UntenN+1);
SpeichervektorYRel1 := Vector[row](ObenN-UntenN+1);
for i2 from UntenN to ObenN do
  SpeichervektorX[i2-UntenN+1] := i2; #Stützstellen definieren
  SpeichervektorYAbs1[i2-UntenN+1] := GaußKronrodQuadraturKurz(Unten2, Oben2, f2Nr1, G2Nr1, i2)-(int     (f2Nr1*diff(G2Nr1,x), x = Unten2 .. Oben2)); # Bestimmen des absoluten Fehlers von f2Nr1 für n=i2
  if (int(f2Nr1*diff(G2Nr1,x),x= Unten2..Oben2) <> 0) and (int(f2Nr2*diff(G2Nr2,x),x= Unten2..Oben2)     <> 0) then  #Bestimmen des relativen Fehlers von f2Nr1, falls dieser für beide Funktionen definiert                #ist
    SpeichervektorYRel1[i2-UntenN+1] := abs(SpeichervektorYAbs1[i2-UntenN+1]/(int(f2Nr1*diff(G2Nr1,x),     x = Unten2 ..    Oben2)))
  end if;
end do;
InterpolationsfunktionAbs1 := Spline(SpeichervektorX, SpeichervektorYAbs1, n); #Generierung des
   #  Splines aus Stützpunkten, die sich aus den absoluten Fehlern von f2Nr1 ergeben
GraphAbs1 := plot(InterpolationsfunktionAbs1, n = UntenN .. ObenN, color = green, legend = ["f1"]);
   #  Generierung des Graphen, der sich aus dem Spline aus den absoluten Fehlern von f2Nr1 ergibt
PunkteAbs1 := plot(SpeichervektorX, SpeichervektorYAbs1, style = point, color = orange);
   #  Generierung des Punktgraphen, der sich aus den absoluten Fehlern von f2Nr1 ergibt  
if (int(f2Nr1*diff(G2Nr1,x),x= Unten2..Oben2) <> 0) and (int(f2Nr2*diff(G2Nr2,x),x= Unten2..Oben2)     <> 0) then
   # falls der relative Fehler für beide Funktionen definiert ist analoges Vorgehen für die relativen     #Fehler
  InterpolationsfunktionRel1 := Spline(SpeichervektorX, SpeichervektorYRel1, n);
  GraphRel1 := plot(InterpolationsfunktionRel1, n = UntenN .. ObenN, color = green, legend = ["f1"]);
  PunkteRel1 := plot(SpeichervektorX, SpeichervektorYRel1, style = point, color = orange);
end if;

 

SpeichervektorYAbs2:=Vector[row](ObenN-UntenN+1);
SpeichervektorYRel2:=Vector[row](ObenN-UntenN+1);
for i2 from UntenN to ObenN do
  SpeichervektorX[i2-UntenN+1]:=i2;  
  SpeichervektorYAbs2[i2-UntenN+1]:= GaußKronrodQuadraturKurz(Unten2,Oben2,f2Nr2,G2Nr2,i2)-int           (f2Nr2*diff(G2Nr2,x),x= Unten2..Oben2); # Bestimmen des absoluten Fehlers von f2Nr2 für n=i2
  if (int(f2Nr1*diff(G2Nr1,x),x= Unten2..Oben2) <> 0) and (int(f2Nr2*diff(G2Nr2,x),x= Unten2..Oben2)     <> 0) then  #Bestimmen des relativen Fehlers von f2, falls dieser für beide Funktionen definiert ist
    SpeichervektorYRel2[i2-UntenN+1]:= abs(SpeichervektorYAbs2[i2-UntenN+1]/
    int(f2Nr2*diff(G2Nr2,x),x= Unten2..Oben2));
  end if;
end do;
InterpolationsfunktionAbs2:=Spline(SpeichervektorX,SpeichervektorYAbs2,n); #Generierung des
   #  Splines aus Stützpunkten, die sich aus den absoluten Fehlern von f2Nr2 ergeben
GraphAbs2:= plot(InterpolationsfunktionAbs2, n=UntenN..ObenN, color=red, legend = ["f2"]);
   #  Generierung des Graphen, der sich aus dem Spline aus den absoluten Fehlern von f2Nr2 ergibt
PunkteAbs2:= plot(SpeichervektorX,SpeichervektorYAbs2,style = point, color=blue);
   #  Generierung des Punktgraphen, der sich aus den absoluten Fehlern von f2Nr2 ergibt  
print(display({GraphAbs1,PunkteAbs1,GraphAbs2,PunkteAbs2}, title= "Absoluter Fehler",titlefont=["ROMAN",18])); # Ausgeben des Verleichsgraphen der absoluten Fehler
if (int(f2Nr1*diff(G2Nr1,x),x= Unten2..Oben2) <> 0) and (int(f2Nr2*diff(G2Nr2,x),x= Unten2..Oben2) <> 0) then # falls der relative Fehler definiert ist analoges Vorgehen für die relativen Fehler
  InterpolationsfunktionRel2:=Spline(SpeichervektorX,SpeichervektorYRel2,n);
  GraphRel2:= plot(InterpolationsfunktionRel2, n=UntenN..ObenN, color=red, legend = ["f2"]);
  PunkteRel2:= plot(SpeichervektorX,SpeichervektorYRel2,style = point, color=blue);
  print(display({GraphRel1,GraphRel2,PunkteRel1,PunkteRel2}, title= "Relativer Fehler", titlefont=       ["ROMAN",18])) # Ausgeben des Verleichsgraphen der relativen Fehler, falls diese definiert sind
end if;
 print(SpeichervektorYAbs1,SpeichervektorYAbs2);
 print(GraphAbs1);
 print(PunkteAbs1)
end proc

 

I'm trying to create a list containg the indices of another list, ordered corresponding to the descending size of the first list.

Say I have the list L := [8 7 9 12];

I want to find the list i = [4 3 1 2]

I know this could be done one element at the time by doing some iterative loop:
i := [];
for j from 1 to size(L) do
    member(max(L),L,'index');
    i := [op(i),index];
    subsop(index=NULL,L);
end do;

But I was wondering if anyone knew any fancy tricks to do this more concisely(and without destroying the original list)?

i want to solve an integration as a funstion of T, but it return the integral unevaluated, but when i change the place of "numeric option" it returns sth. what is the problem ?
 

restart:with(RealDomain):

simplify((2/pi)^(1/2)*(int((exp(-32.74123792568-0.8916456579806e-1*ln(4.852623952*10^9*v^2)))*exp(-v^2/(2*T))*v^3, v = 2 .. 100,numeric,AllSolutions)))

2^(1/2)*(1/pi)^(1/2)*(int(exp((-34.72985611*T-.1783291316*ln(v)*T-.5*v^2)/T)*v^3, v = 2 .. 100, AllSolutions))

(1)

simplify((2/pi)^(1/2)*(int((exp(-32.74123792568-0.8916456579806e-1*ln(4.852623952*10^9*v^2)), numeric)*exp(-v^2/(2*T))*v^3, v = 2 .. 100)), AllSolutions);

.2419366578*exp((-32.74123793*T-5000.000000)/T)*((1.000000000*T+2.000000001)*exp(4998./T)-.5022352314*exp(5000./T)*T-.4977647690*T-2488.823845)*(1/pi)^(1/2)*2^(1/2)*T

(2)

 

NULL


 

Download int.mw

I'm attempting to find the eigenvectors of a matrix without using the eigenvector function.

The matrix in question is a covariance matrix:

XCov:=Matrix([[4048/5, -817/5, -122/5], [-817/5, 921/10, -1999/10], [-122/5, -1999/10, 8341/10]]);

I've already found the eigenvalues by solving for lambda:

 det := Determinant(XCov-lambda*IdentityMatrix(3));
  lambda := solve(det=0.0, lambda);

(Yes I'm reusing the eigenvalue variable for the set of eigenvalues once they've been found😏)

Anyway, I've now set up the first eigenvector I want to find as:
e1 := Vector([e11,e12,e13]);


Now, the equation to find this first eigenvector is XCov . e1 = lambda[1] . e1
I first tried putting whats on the left in a variable called eigscale(what the vector is translated to by the matrix):

eigscale := Multiply(XCov,e1);
Which returns a vector:
eigscale = [(4048/5)*e11-(817/5)*e12-(122/5)*e13,
                  -(817/5)*e11+(921/10)*e12-(1999/10)*e13,
                  -(122/5)*e11-(1999/10)*e12+(8341/10)*e13]

Each component of this vector must equate to the corresponding component in the right vector:

lambda[1]*e1 = [7.943520930*e11, 7.943520930*e12, 7.943520930*e13]

At first I tried setting these vectors equal to each other and using a solve but of course it didnt like the equations being in a vector format. So I then seperated out each equation and gave the solve function a system of equations as it expects:

solve(eigscale[1] = lambda[1]*e1[1], eigscale[2] = lambda[1]*e1[2], eigscale[3] = lambda[1]*e1[3], [e11,e12,e13]);

But again, solve fails to solve them. The reason this time(I believe) is because it can't find an exact value for e11, e12 & e13.
When solving for an eigenvector we get
e11 = e11,
e12 = Ae11,
e13 = Be11 + Ce12

I was wondering if there was a way to do a partial solve to find the components in terms of each other?

Failing that, I'm aware I can do it manually through row operations but I believe that would require changing the format so that each equation is a component of a single vector:
eigsolve := Vector([eigscale[1] = lambda[1]*e1[1], eigscale[2] = lambda[1]*e1[2], eigscale[3] = lambda[1]*e1[3]]);

Since row operations cannot be performed on a equation of vectors (again, I believe).

Help appreciated!

First 728 729 730 731 732 733 734 Last Page 730 of 2224