## How can this Maple application be generalized from...

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?

## How to transform a function plot by "shifting" hor...

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

## Multiple Execution of Maple Code with a Varied Par...

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!

## Evalf on Function Coefficients?...

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?

## Multiple Tangent Lines...

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).

Thanks

## Display command for comparing graphs ...

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

## Best Way to Find List Order...

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)?

## problem with int...

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)))
 (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);
 (2)
 >

## How to Partially Solve a System of Equations...

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!

## How to find out intervals of a variables where fun...

Hello Everyone,

I have been working on a multi variable expression. I would like to have the intervals where the function is monotonically increasing. I am trying to study any available method for multivariable expressions.

I came across various papers and sites which are explicitly mentioned single variable equations. finding out the critical points and studying the sign of the first derivative. Same cannot be applied for the multi variable expression.

https://www.math24.net/monotonic-functions/

above link explain for single variable functions. I would be grateful if someone could explain me a method or idea  which helps me out in solving for multivariable functions

## Fitting system of odes by Optimization...

```restart;
Digits := 25;

# Setup.
de := diff( x(t), t ) = a * y(t), diff( y(t), t ) = b * x(t);
ic := x(0) = 1, y(0) = 0;
sol := dsolve( { de, ic } ):

# Sample values for specific parameter values.
a0, b0 := 1.0, 0.25:
T := evalf( [ seq( i, i=1..5 ) ] ):
X := [ seq( eval['recurse']( x(t), [ op( sol ), a = a0, b = b0 ] ), t=T ) ]:
Y := [ seq( eval['recurse']( y(t), [ op( sol ), a = a0, b = b0 ] ), t=T ) ]:

# Numerical solution.
sol := dsolve( { de, ic }, 'numeric', 'range'=min(T)..max(T), 'abserr'=1e-15, 'maxfun'=0, 'parameters'=[a,b] ):

# Procedure to return values for specific time and parameter values.
u := proc( t, a, b )
sol( 'parameters' = [ ':-a' = a, ':-b' = b ] ):
try
return eval( [ x( ':-t' ), y( ':-t' ) ], sol( t ) ):
catch:
return 10000:
end try:
end proc:

# Procedure to return objective function.
r := proc( a, b )
local A, t, p, q, x, y:
A := ListTools:-Flatten( [ seq( u( t, a, b ), t=T ) ] -~ zip( (x,y) -> [x,y], X, Y ) ):
return foldl( (p,q) -> p + q^2, 0, op(A) ):
end proc:

# Find parameter values for bet fit.
Optimization:-Minimize( 'r'(a,b), a=-10..10, b=-10..10 );
```

I was provided the code above by Maple support, to fit a model to data using the Optimization package. I have tried to adapt this to a situation where one might only have the X variable data and so the model should only fit to that data.  I did this by deleting the , y( ':-t' ) in the try catch statement and then having the zip statement read as zip( (x) -> [x], X).

When I try to run that code, I get the error:

Error, (in Optimization:-NLPSolve) invalid input: zip uses a 3rd argument, b, which is missing

Anybody have an idea how to solve this?

Jo

## Physics Package: Projectors between disjointed/com...

Hi,

I try to define the action of projectors of two discrete basis onto a general state. This works as expected when I define the projector by myself. However, when using the "Projector" command, I get a not fully simplified result; see below. It seems like there is a confusion with dot/tensor product.  Can somoeone help?

Best,

Henrik

 (1)

 (2)

 (3)

 (4)

 (5)

 (6)

## hidden characters in worksheet...

Two lines that look the same, produce different results. The first lines gives an error message, but the next line that looks the same, does not.

copying and pasting both lines in Notepad reveals the difference:

Determinant*(R1 . B+R2 . B+R3 . B+R4 . A)

Determinant(R1 . B+R2 . B+R3 . B+R4 . A)

It seems that there is a hidden character (the asterisk) in the first line that produces the error.

In the worksheet itself you cannot see the asterisk, but using the arrow keys you can notice that there is another character.

It's hard to debug your code if there are hidden characters.

 >
 >
 (1)
 >
 >
 >
 >
 >
 (2)

## how to plot a nested for loop ?...

i want to generate grid for a C_D nozzle but i dont know ho to plot it. please help me how to plot.

restart;
alpha := 0;
beta := 2;
Imax := 11;
Jmax := 11;
L := 10;
`&Delta;&zeta;` := L/(Imax-1);

`&Delta;x` := `&Delta;&zeta;`;
`&Delta;&eta;` := 1/(Jmax-1);

printlevel := 2;
for i to Imax do for j to Jmax do x[i] := `&Delta;&zeta;`*(i-1); eta[j] := `&Delta;&eta;`*(j-1); z := (eta[j]-alpha)*ln((beta+1)/(beta-1))/(1-alpha); H[i] := 3+2*tanh(x[i]-6); H1[i] := 0; H2[i] := -H[i]; y[i, j] := -H[i]*(2*beta/(exp(z)+1)-beta-2*alpha)/(2*alpha+1); Y[i, j] := (H1[i]+(-H1[i]*x[i]+H2[i])/L)*eta[j] end do end do;

## simplification of arguments...

If I have an expression like this

f:=ln((1-x)^2*(x+1)^2/((-I*x-I+sqrt(-x^2+1))^2*(I*x+I+sqrt(-x^2+1))^2))

maple has trouble to simplify the argument.

In particular is it possible to apply expand() only to the denominator?

This is meant in general, so if I have many terms with expressions like this (possibly of products with other functions in each term), I want this simplification to be done termwise for the arguments of the functions.

Expanding the fraction doesn't work as in frontend(expand, [f]).

 First 437 438 439 440 441 442 443 Last Page 439 of 2132
﻿