Items tagged with convert convert Tagged Items Feed

I have a vector containing data which is m*n long (ie from 1...(m*n)) and I want to convert it to a matrix of m columns and n rows.

What's the quickest and most efficient way in Maple to do this?

I wrote the following code but am stuck on how to Update prcLeastSquareLA, so it does what prcLeastSquare does.

I believe you have to add error estimate information in prcLeastSquareLA but I have tried to no avail.

 

prcLeastSquareLA:= proc(data,degree)
local vars,y,A,V,k,e,i,j,v,c,1stVars;

vars:= seq(ci, i=0..degree);
y:=unapply(‘+’(seq(ci*t^j, i=0..degree)),t);
for k

 

My result is complicated, ant it was very large, when I simplified the question, it just as this program.

 

The main problem is that result in YY is not in order, so the converted result is also disorder, please help me to store the result in order. Thank you!

I need to write a recursive method to reverse a string.

The hint given is to convert the string inputed to a character sequence, then apply recursive method, then reverse character sequence, then convert back to  string and output it.

So "abcd" gives output "dcba"

 

I came up with what is below, but I don't know if that's a recursive method.

 

>with(StringTools):

>Reverse("abcd")

        "dcba"

Sorry, this seems like a silly question. But is there an easy way to convert trig funcitons, or even non trig functions to orthogonal (in this case Legendre) polynomials? 

In matlab, a function is returned a structure H, say H.a, H.b, ...

In maple, I want to call this matlab function, but what returned to maple is a Record:

 

Hs:= getvar("H");

Hs:= Record(a=..., b=..., ...);

 

So how can I convert this record to a normal maple array? so I can access to each element by Hs[1]. 

 

Thank you

Kyle

with(SumTools):
He := sum(((-1)^k)*n!/(k!*(n-2*k)!*2^k)*x^(n-2*k), k=0..n/2);
Gen := simplify(sum(He*z^n/n!, n=0..infinity));

convert(Gen, ratpoly);

Here is a hacked-up and short `convert/identifier` procedure.

The shortness of the procedure should is a hint that it's not super robust. But it can be handy, in some simple display situations.

If I had made into a single procedure (named `G`, or whatever) then I could have declared its first parameter as x::uneval and thus avoided the need for placing single-right (uneval) quotes around certain examples. But for fun I wanted it to be an extension of `convert`. And while I could code special-evaluation rules on my `convert` extension I suppose that there no point in doing so since `convert` itself doesn't have such rules.

For the first two examples below I also typed in the equivalent expressions in 2D Math input mode, and then used the right-click context-menu to convert to Atomic Identifier. Some simple items come out the same, while some other come out with a different underlying structure and display.

 

restart:

`convert/identifier`:=proc(x)
   cat(`#`,convert(convert(:-Typesetting:-Typeset(x),`global`),name));
end proc:

convert( 'sqrt(4)', identifier);

`#msqrt(mn("4"))`

eval(value(%));
lprint(%);

`#msqrt(mn("4"))`

`#msqrt(mn("4"))`

`#msqrt(mn("4"))`

`#msqrt(mn("4"))`

lprint(%);

`#msqrt(mn("4"))`

convert( 'int(BesselJ(0,Pi*sqrt(t)),t)', identifier);

`#mrow(mo("∫"),mrow(msub(mi("J",fontstyle = "normal",msemantics = "BesselJ"),mn("0")),mo("⁡"),mfenced(mrow(mi("π"),mo("⁢"),msqrt(mi("t"))))),mspace(width = "0.3em"),mo("ⅆ"),mi("t"))`

eval(value(%));
#lprint(%);

`#mrow(mo("∫"),mrow(msub(mi("J",fontstyle = "normal",msemantics = "BesselJ"),mn("0")),mo("⁡"),mfenced(mrow(mi("π"),mo("⁢"),msqrt(mi("t"))))),mspace(width = "0.3em"),mo("ⅆ"),mi("t"))`

`#mrow(mo("∫"),msub(mo("J"),mn("0")),mfenced(mrow(mi("π",fontstyle = "normal"),mo("⁢"),msqrt(mi("t")))),mo("⁢"),mo("ⅆ"),mi("t"))`

`#mrow(mo("∫"),msub(mo("J"),mn("0")),mfenced(mrow(mi("π",fontstyle = "normal"),mo("⁢"),msqrt(mi("t")))),mo("⁢"),mo("ⅆ"),mi("t"))`

#lprint(%);

convert( Vector[row](['Zeta(0.5)', a.b.c, 'limit(sin(x)/x,x=0)', q*s*t]), identifier);

Vector[row](4, {(1) = Zeta(.5), (2) = a.b.c, (3) = limit(sin(x)/x, x = 0), (4) = q*s*t})

eval(value(%));
#lprint(%);

Vector[row](4, {(1) = Zeta(.5), (2) = a.b.c, (3) = limit(sin(x)/x, x = 0), (4) = q*s*t})

 

Download atomic1.mw

As it stands this hack may be useful in a pinch for demos and purely visual effect, but unless it's robustified then it won't allow you to programmatically generate atomic names which match and inter-operate computationally with those from the context-menu conversion. Identifiers (names) with similar typeset appearance still have to match exactly if they are to be properly compared, added, subtracted with each other.

Extra points for commenting that the round-brackets (eg. in function-application) are displayed as black while the rest is in blue by default, if you have a workaround.  That also happens when using the usual context-menu driven convert-to-atomic-identifier of the Standard GUI.

Extra points for noticing that function names like `sin` are italicized and not in an upright font, if you have a workaround. How to discern which instances of fontstyle="normal" should be removed?

Points off for commenting that this whole hack doesn't provide anything new or extra for getting around automatic simplification.  :)

This is a one-liner hack. But maybe together we could turn it into something that closely matched what the context-menu generates.

Dear experts,

 I want to extract the coefficient of z^k from an infinite series summation (known as probability generating function or characteristic function or Z-transformation) , the co-efficient is actually the probability of the R.V. will take value k.

Next problem in the same question is the summation is not working if I sum from 0 to infinity. It is working from 0 to 300.

I have attached the PDF for expressing the problem and the Maple code. I have used convert...

I want to now how to convert from maple to letec

thankyou

In the final line, my output is in the form of tau-c*z. How do I switch the tau-c*z back to 
zeta, because I want to integrate T with respect to zeta.
Thank you. 
> restart;
> with(plots);
> U := V(zeta)*exp(I*(k*tau-w*z));
> zeta := tau-c*z;
> Uz := diff(U, z);
> Utau := diff(U, tau);
> Utautau := diff(Utau, tau);
> P := convert(U, trig);
>
> A := abs(P)^2;
> B := evalc(A);

Hello all together,

defined is a curve C by the function:

x^(2/3)+y^(2/3)=a^(2/3)

Now i have to convert the description of the curve in the parametric representation and plot the graph.

My problem is, how i should handle the a in the function?

 

Thank you very much,

 

Josef

I have to generate F(x) of a function with a degree of 5 who has zeros of x=2,x=1+3i,x=2-4i

After i put it into maple i use the command expand to give me the total function but afterwards i get this 144*i^4*x-25*i^2*x^3+x^5-288*i^4+118*i^2*x^2-8*x^4-188*i^2*x+25*x^3+104*i^2-38*x^2+28*x-8

i need to know what command can i use to get it to converts i^4 to 1 and i^2 to-1 that way i can truly simplify it. 

Hi guys

Is there any build-in function which converts [[x>5, x<10], [x < 0]] to "x>5 and x<10 or x<0"? I've written my own function, but I want something build-in.

Thanks :)

Hi,

See the code mli.mws

What is the mistake in this command ?

chfonc:=cat('piecewise(' , seq(cat(convert(t<lf[k],string) , ' , 1 , ' ,convert(t<lf[k],string), ' , 1 , ' ) , k=1..p) , '1) ') :

3 4 5 6 7 8 9 Last Page 5 of 38