MaplePrimes Questions

With this feature, it requires the worksheet from which to import a result from executing it from the worksheet with the Run worksheet command to have section titles as Input  and Calculation respectively.

 

This is a really helpful feature, but what i need is to "fetch" the content from a number of worksheets in a folder from a specified particular section name, for a number of different section names.

Hi everyone,
I was wondering how to create a function, as we create in MatLab, in Maple. Here is an example of MatLab function, that I should convert to Maple:

function Y=fsin(delta,b,n)

if n==0
    Y=1/(1+b^2);
end
if n==1
    Y=atan(1/b);
end
if n==2
    Y=1+log(b^2 + 1)/2-b*atan(1/b);
end
if n==3
    Y=0.5*(2*delta-3*b-2*b*log(b^2 + 1)/2+atan(1/b)*(b^2-1));
end
if n==4
    Y=(1/36)*(18*delta^2-36*delta*b+33*b^2-11+6*log(b^2 + 1)/2*(3*b^2-1)+6*b*atan(1/b)*(3-b^2));
end
if n==5
    Y=(1/72)*(24*delta^3-36*delta^2*b+12*delta*(3*b^2-1)+25*b-25*b^3+12*b*log(b^2 + 1)/2*(1-b^2)+3*atan(1/b)*...
        (1-6*b^2+b^4));
end
if n==6
    
    Y=(1/7200)*(1800*delta^4-2400*delta^2*b+600*delta^2*(3*b^2-1)+1200*b*delta*(1-b^2)+685*b^4-1370*b^2+137+...
        60*log(b^2 + 1)/2*(5*b^4-10*b^2+1)+60*b*atan(1/b)*(-5+10*b^2-b^4));
end
if n==7
    Y=(1/21600)*(4320*delta^5-5400*delta^4*b+1200*delta^3*(3*b^2-1)+...
        1800*delta^2*b*(1-b^2)+180*delta*(5*b^4-10*b^2+1)-441*b+1470*b^3-441*b^5+...
        60*b*log(b^2 + 1)/2*(-3*b^4+10*b^2-3)+30*atan(1/b)*(-1+15*b^2-15*b^4+b^6));
end
end

  Thank you,  

In Maple 2018 help written:

The interpolation methods available in the Interpolation package all work as follows. First, the user calls one of the commands in the package, submitting the input points and the values at these points. This returns an object encapsulating all the data and options submitted. This object can then be used like a normal mathematical function, e.g. for plotting, integration, or just to evaluate at a given point.

The Interpolation[Interpolate] command was introduced in Maple 2018
 

My test example:

with(Interpolation):

points := [seq(x, x = 0 .. 10, 1)]; data := [seq(sqrt(1.+x^2), x = 0 .. 10, 1)];

f := Interpolate(points, data);

f(1); # OK works :).

int(f(x), x = 0 .. 1); # Not working ?

int(f(x), x = 0 .. 1,numeric); # Not working ?

eval(diff(f(x), x), x = 2);# Not working ?

plot(f(x), x = 0 .. 10);#  OK works :)

plot([f(x), diff(f(x), x)], x = 0 .. 10);# Not working ?

plot([f, diff(f, x)], 0 .. 10);# Only a half  working ?

 

Thanks.


 

 

Hi everybody,

I am a newbie in Maple. Could you please help me to convert the following short code from Matlab to Maple: 

I=0.0;

for i1=1:3

  for i2=1:3

    for i3=1:3

      for i4=1:3

        if i1==i2 && i2==i3 && i3=i4

        I(i1,i2,i3,i4)=1.0;

        else

        I(i1,i2,i3,i4)=0.0;

        end

      end

    end

  end

end

Thank you,

Hi,

I would like to plot a stem plot of a function and its Fourier transform but I'm not too sure how to. I have tried using different packages like DiscreteTransforms, DynamicSystems and SignalProcessing but can't seem to get it to work. Any advice is appreciated.

Thanks

Ok so I have a matrix I reduct to echolon form etc and i use the determinent command to get the deteriment  for the value of K

I use the command fsolve(deterimant(matrix) and I get the the answer printet out as 2,2.

 

Is there a way to get maple to print out  something like K = 2 or even better have it print out something like

''it's linjeay indepedent when K not equals to 2" or something like that?

You know I would like to have it look nicer or something. 

 

 

Hello, I am new to MAPLE TA so I hope my question makes sense:

I am asking the students to compute the Laplace transform of a differential Equation and wirte the answer which is an equation in the respose area. I use the following algorithm to generate the answer:

$LaplaceY=maple("
with(inttrans):
ode:=diff(y(t), t) -3*y(t) = 2*exp(t);
y(0):=2;
ans:=laplace(ode, t, s);
alias( Y(s)= laplace( y(t), t, s ) );

[convert(ans,string)];
");

$ans=switch(0,$LaplaceY);
 

Here is the output of the algorthim: ans   s*Y(s)-2-3*Y(s) = 2/(s-1)

The students are supposed to enter s*Y(s)-2-3*Y(s) = 2/(s-1) in the response area using symbolic entry. I tried both Maple graded Maple syntax and Mathematical formula for the response area. It always marks the answer wrong when previewed.

I can't figure out the issue here.

Thanks

Substituting variables for numbers doesn't always work in some situations.  For example.

a:=sqrt(6)/6
                            

subs(6=b,a)
                        

 

 

sign doesn't work with square roots

expr := sqrt(3)*x^2*y^4-2*x*y^5+x
                                              

sign(expr)

sign(sqrt(3))

 

 

Hi,

So I need an example of how the discrete fourier transform works, and I would like to do this using Maple but I can't figure out how to plot a discrete function. I have attached an example from wikipedia which is what I would like. It is the function on the right of the image. I have tried plotting a vector but then I can't seem to plot this. Let me know if the question isn't quite clear.

Thanks

 

P1 : x + 2y - z = 1

P2 : 2x + 4y - z = 0

formula is s = |d1-d2|/||n|| 

d1 = 1 d2 = 0 i assume , n = (1 + 2 -1) (P1 pretty much) 

So I end up getting 1/(1+4+(-1))²

1/ 6 , and its the correct answer 

but I can't figure out how to do this properly in maple, does anyone here know how to? (not sure if i even used the formula correctly to get the correct answer by hand)

sorry for a poorly written question I am in a  rush.

 

Hi

When i try to simplify this, maple doesn't simplify to the final step. 

I hope anyone can help me. 

Laura

 

 

I want ot replace the free variable introduced by the BackwardsSubstitution procedure with a number. But though the variable looks like x1 I think it must be something else.

problem.maple


here my code . iam trying to generate a binomial sample but there is some error occure please help

with(Statistics):

 

with(Student[Statistics]):

``

P := .1:

``

r[1] := convert(BinomialRandomVariable(N-n, P), `+`)

`Non-fatal error while reading data from kernel.`

(1)

for i from 2 to N-n do A[i-1] := convert(r[i-1], `+`); r[i] := BinomialRandomVariable(N-n-(sum(A[i], j = 1 .. i-1)), P) end do;

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

(2)

for i to N-n do x[i] := Sample(r[i], 1) end do

x[1] := Vector[row](1, {(1) = 1})

 

Error, (in pr) unable to evaluate 5-A[2] to floating-point

 

sum(R[j], j = 0 .. 10)

2+R[0]+r[4]+r[5]+R[6]+R[7]+R[8]+R[9]+R[10]

(3)

``

NULL


 

 

This should be a simple problem, but I am having trouble resolving a contradiction in integral evaluation that is included in the results below.  Instead of butting my head further perhaps someone can point out my probable error.

You will see in both cases I have a triangle signal with a slope of (-1).  However in the 2nd case I have linked the period T to the slope parameter alpha.  If I assign alpha=1 then the results of the 2 integrals should = 1/4, but the 2nd one does not.

Appreciate any feedback.


 

plot(piecewise(-1 < x and x < 0, 0, 0 < x and x < 1, 1-x), x = -2 .. 2, linestyle = solid, thickness = 5, scaling = constrained, title = "Asymmetric Triangle Wave", titlefont = [COURIER, 18])

 

n := 0; 1; T := 2; 1; a[0] := (int(0*exp(-I*(2*Pi*n*t/T)), t = -(1/2)*T .. 0)+int((1-t)*exp(-I*(2*Pi*n*t/T)), t = 0 .. (1/2)*T))/T

1/4

(1)

restart

alpha := 1; T := 2/alpha; plot(piecewise(x < 0, 0, 0 < x and x < (1/2)*T, -alpha*x+1), x = -T .. T, linestyle = solid, thickness = 5, scaling = constrained, title = "Asymmetric Triangle Wave", titlefont = [COURIER, 18])

 

  n=0 term:n := 0; 1; alpha := 1; 1; T := 2; 1; a[0] := (int(0*exp(-I*(2*Pi*n*t/T)), t = -(1/2)*T .. 0)+int((1-alpha*T)*exp(-I*(2*Pi*n*t/T)), t = 0 .. (1/2)*T))/T

-1/2

(2)

``


 

Download integral_contradiction.mw

First 824 825 826 827 828 829 830 Last Page 826 of 2427