## compute integral...

Dear all

Can we use maple to compute integral using the residual theorem

Compute_integral.mw

We can consider the contour a circle that contains one pole (Ipi/2)

Many thanks

## Clenshaw derivative recurrence...

Hi! I have been trying to calculate the value of theClenshaw derivative. I can get the regular clenshaw to work but not the derivative. I'm going off of the thread (https://scicomp.stackexchange.com/questions/27865/clenshaw-type-recurrence-for-derivative-of-chebyshev-series). (P.s notice I have halfed the A[z+1] term. I have tried both ways but the overall result is wrong so I am guessing something more important is wrong).

This is my code so far

```Clenshaw_Dx_1D:=proc(z,C,Nm,s)
local i,k,A,B: global Clen1D_Dx:

A := Vector(z..Nm+1+z);
B := Vector(z..Nm+1+z);

for k from Nm-1+z by -1 to 1+z do
A[k] := C[k] + 2*s*A[k+1] - A[k+2]:
od:

for k from Nm-1+z by -1 to 1+z do
B[k] := 2*A[k+1] + 2*s*B[k+1] - B[k+2]:
od:
Clen1D_Dx :=  A[z+1]/2 + s*B[1+z] - B[2+z]:

end:
```

Where z could be 0 or 1 depending on what index your C array starts at. C is the array of chebyshev coefficients of a Chebyshev series appromating u(x) for example. The Chebycoeff1D procedure calculates the Chebyshev coefficients  and the code below calls the procedure for a specific function. Try it with some values of xM, for example 4-10.

```Chebycoeff1D:=proc(express,Nn,C2,A,B)
local Cfac,fac1x,fac2x,k,K;

fac1x:=Pi/Nn;
for k from 1 to Nn do
Cfac(k):=eval(subs(x=evalf(cos(fac1x*(k-0.5)))*A+B,evalf(express)));
od; unassign('k'):
for K from 1 to Nn do
fac2x:=Pi*(K-1)/Nn;
od:
end:
```
```nn := 1.0:
Lc := 0.0: Rc := 1.0:
func:=nn*sin(2*Pi*x)+0.5*nn*sin(Pi*x):
Chebycoeff1D(func,xM+1,C,0.5*(Rc-Lc),0.5*(Rc+Lc)):
```

Once you have the C array call Clenshaw_Dx_1D. For example

`Clenshaw_Dx_1D(0,C,xM+1,0.0);  # Evalutes f'(x) in the middle of the domain.`

Check with

`subs(x=0.5, diff(func,x));`

The overall "pattern/shape" of the derivative values is correct, just not the amplitude/values. Any help here? Where is the Clenshaw derivative procedure going wrong.

## How do I plot complex transformations? ...

I have a region that can be graphed by A := plots:-inequal([evalc(abs(z)) < 3, evalc(1 < abs(z - 1))], x = -5 .. 5, y = -5 .. 5)

From there, I need to use the transformation

M := (3 + sqrt(5))/2*(z - x1)/(z - x2) where x1 := (9 - sqrt(45))/2 and x2 := (9 + sqrt(45))/2

How do I do this? Do I need to extract data points from the first graph? Is there an easier way to do this?

## How do I plot a hyperbola in polar with no asympto...

I would like to plot a hyperbola using the polarplot command, such as the following:

polarplot(3/(1-1.5*sin(theta)), coordinateview = [0 .. 10, 0 .. 2*Pi])

But the graph includes the asymptotes, which I would not like to be included. I have tried the discont=true command, but it completely changes the shape of the graph and no longer looks like a hyperbola:

polarplot(3/(1-1.5*sin(theta)), coordinateview = [0 .. 10, 0 .. 2*Pi], discont = true)

How would I get the hyperbola above to display with no asymptotes?

Thanks

## RedefineTensorComponent in Physics package...

The Library:-RedefineTensorComponent in the physics package has got some serious problems, I guess in the update. It is not assigning the components at the right location for a tensor of rank 4 and above. It is working for tensors of rank 1, 2 and 3. Can someone please look into the issue and help out?

I am attaching the code with an example to indiacate the problem. Redefine.mw

## Is it possible to define variables with unusual na...

Hi,

Defining variables named H2 or O2 doesn't pose any problem (H__2 for instance), but could it be possible in Maple 2019 to define a variable named H2O2 ?

## How should I present my system of first order ODE'...

Hello,

I have a question regarding the dsolve function in Maple. I am trying to solve a system of 5 first order ODE's. First I solve the differential equations to arrive at the general solution using the dsolve command. Here Maple already produces very large and slow output while I would actually expect a much more compact output.

Then I want to evaluate the final solution by using the initial conditons. At this point Maple keeps 'evaluating..' and does not come up with a solution. Only when I fill in all the parameters Maple finds a solution ( still very slow ). However as I want to be able to play with the input parameters after evaluation I want a solution without having to fill in the parameters prior to solving the system.

My question is whether I am presenting the system of ODE's in the right way to Maple. Should I rewrite the system for Maple to be able to produce a more dense solution? Or should I for instance use Laplace Transform to simplify the equations prior to solving?

Joa

restart;

eq1 := sig_total-sig2(t)-sig3(t)-sig4(t)-sig5(t)+T1*(-(diff(sig2(t), t))-(diff(sig3(t), t))-(diff(sig4(t), t))-(diff(sig5(t), t))) = u1*(diff(eps(t), t));
eq2 := sig2(t)+T2*(diff(sig2(t), t)) = u2*(diff(eps(t), t));
eq3 := sig3(t)+T3*(diff(sig3(t), t)) = u3*(diff(eps(t), t));
eq4 := sig4(t)+T4*(diff(sig4(t), t)) = u4*(diff(eps(t), t));
eq5 := sig5(t)+T5*(diff(sig5(t), t)) = u5*(diff(eps(t), t));

dsolve({eq1, eq2, eq3, eq4, eq5}, {eps(t), sig2(t), sig3(t), sig4(t), sig5(t)});
sig_total := sig_0;
desys := {eq1, eq2, eq3, eq4, eq5}; ic := {eps(0) = sig_0/(E1+E2+E3+E4+E5), sig2(0) = sig_0/(1+(E1+E3+E4+E5)/E2), sig3(0) = sig_0/(1+(E1+E2+E4+E5)/E3), sig4(0) = sig_0/(1+(E1+E3+E2+E5)/E4), sig5(0) = sig_0/(1+(E1+E3+E4+E2)/E5)};

solution := combine(dsolve(desys union ic, {eps(t), sig2(t), sig3(t), sig4(t), sig5(t)})); assign(solution);

E_total := 33112; a := .1; b := .2; c := .15; d := .2; e := .35;

E1 := a*E_total; E2 := b*E_total; E3 := c*E_total; E4 := d*E_total; E5 := e*E_total; T1 := 1; T2 := 10; T3 := 100; T4 := 1000; T5 := 10000; u1 := T1*E1; u2 := T2*E2; u3 := T3*E3; u4 := T4*E4; u5 := T5*E5; sig_0 := 2;

plot(eps(t), t = 0 .. 672, y = 0 .. 0.12e-3);
y := eval(eps(t), t = 672);
evalf(y);

## how do we solve an algebraic equation?...

How do I extract the real solutions of a polynomial that has solutions both in real and complex domains?

## Invalid arguments to function multiply...

Why do I get an error here?

G := GF(2, 3, T^3+T^2+1);

G:-`*`(T, T);
Error, (in *) modp1: invalid arguments to function Multiply

p.s. how do I specify what variable is used for my finite field without needing to specify an irreducible polynomial?

## How do I work with polynomials over finite fields?...

How do I work with polynomials over finite fields?  not just the integers mod p but over  https://www.maplesoft.com/support/help/Maple/view.aspx?path=GF

## writing and calling functions in maple???...

So what is the Maple equivalent of  functions/scripts?   and how do I call them?   like I have define the function f in the worksheet (in a code edit region) , but f(2)  just returns f(2)  no function evaluation.

p.s. can someone recommend a guide on programming in maple?  Like writing and calling functions not   their standard programming guide which is long winded and not helpful.

## Covariant derivative of a specific vector...

Hi there!

Sorry to ask, but I don't know how I can solve it in a smart way. I want to take the covariant derivative of a specific vector, whose components are specifically defined, which can be constant or some functions of the coordinates. But, as soon as I define that specific vector, the covariant derivative fails to compute, saying there are "too many levels of recursion". Let me show what I mean.

I have these two attempts to get this:

First attempt

 (1.1)

 (1.2)

 (1.3)

 (1.4)

 (1.5)

 (1.6)

 (1.7)

 (1.8)

 (1.9)

Second attempt

 (2.1)

 (2.2)

 (2.3)

 (2.4)

 (2.5)

 (2.6)

On my first attempt, expression (1.7) is almost fine, but β is supposed to be constant (and a function of "t" in the future), so I set it as a constant function. But then it causes that problem. Therefore, on my second attempt, I tried to set β as a parameter since the beginning, but it was no good either.

If I were to take the covariant derivative as "D_[nu](b[mu])" (without the "(X)"), it would not have that specific problem, but would not be a good solution, since the covariant derivative would discard the partial derivative of b[mu] and, if it would have some dependence on the coordinates, it would give a wrong result.

The only way it seems to work is by defining the tensor "Db[mu,nu]" explicitly as "d_[mu](b[nu](X)) - Christoffel[~alpha, mu, nu]*b[alpha]". (It seems that the problem comes from that "(X)" next to "b[alpha]" in the connection term.) But that would be an awful way to circumvent the problem. Isn't there any better way to get this?

Can someone help me with this, please?

Thanks for any help!

## How to open text file and run without choose maple...

I rename text file as mws when I click it , it show a few button and then need to extra click maple input and then need to click enter in order to run.

how to run directly when I open it with maple?

## How can Hooke's law be modified for a spring const...

For a spring hanging vertically from a fixed point, suppose the spring constant, k, is a function of the distance from the fixed point to the other (lowest) end of the spring (for example; the diameter of the spring's coils changes along the length of the spring) .

What ODE reflecting this situation will yield solutions for the harmonic motion of the spring after it is stretched from its equilibrium position?

## Apparent bug in "applyrule" for wildcard argument ...

In Maple 2019, I'm using the "applyrule" function to write a simple routine for contracting vector indices, following the Einstein summation convention (repeated indices are summed).

Input:

applyrule(
vec(a::symbol, i::symbol) * vec(b::symbol, i::symbol) = dotproduct(a,b),
vec(a,k) * vec(b,k)
);

Output:

dotproduct(a, b)

So far it works as expected. Now I add an "uncontracted" vector, and the code seems to become unpredictable. First, let me show a case in which the code still works:

Input:

applyrule(
vec(a::symbol, i::symbol) * vec(b::symbol, i::symbol) = dotproduct(a,b),
vec(u,k) * vec(u,i) * vec(c,k)
);

Output:

dotproduct(c, u)*vec(u, i)

As expected, contraction has been done on the repeated index "k", but vec(u,i) was left alone. However, the above code fails if I simply change the variable name "u" to "a":

Input:

applyrule(
vec(a::symbol, i::symbol) * vec(b::symbol, i::symbol) = dotproduct(a,b),
vec(a,k) * vec(a,i) * vec(c,k)
);

Output:

vec(a, k)*vec(a, i)*vec(c, k)

Apparently, the rule was not applied because I used "a:symbol" in the transformation rule. But I thought "a::symbol" should be considered a wildcard that represents any symbol, including "a" itself?

Depending on the exact input, this bug sometimes shows up, sometimes not, but the above examples are verified to be reproducible. A simple workaround is always avoiding the use of the same variable, but this seems to be hack. Is there a proper solution?

 First 326 327 328 329 330 331 332 Last Page 328 of 2143
﻿