Ronan

772 Reputation

14 Badges

10 years, 325 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are replies submitted by Ronan

@zenterix I installed this last night. IMO it seems much better that jEdit Sublime and Notepad++. I interface is much more professional. Though I have'nt figured out how to launch Maple from it yet.

Some of the nice features are 

if.....then

end if 

inserts automatically. same for   For...do ...end do and other loops. Also nested parenthesis are auto coloured differently

@zenterix I am new to code editors. Had tried about 5 years ago. Sublime Text:- I had difficulty installing the Maple plugin because I didnt know what I was doing. Somehow it installed. GitHub - johnpmay/SublimeTextMaple: Sublime Text syntax and configuration files for Maplesoft's Maple language. It is straight forward to use. I saved a couple of procedures and a module/package with $include <xyadsddd.mpl> commands all as .mpl files. Then read in the module from Maple. That worked fine. I dont know anything about how to do code error checking in Sublime or it it can be done.  Don't know it Maple can be launched from it.

I found Notepad ++ easier to set up. To me it is much the same as Sublime. BTW I am on windows.

jEdit. Has native maple support. and the Project manager plugin is good. Irrating trying to download the plugins though and the mirror sites often fail.  Might be possible to launch Maple from it but I lack programming education.

That VScode for Maple looks really good. Will have to try it.

@ecterrab Is there a Komodo addon for Maple? have been investigating a few Code editors over the past week or so. Looked at Sublime text, Notepad++  and jEdit which does have a default Maple package. I so far like jEdit. I would like something that could flash up bugs in the code as it's hard to tell what is wrong when Maple reads in an *.mpl and doesn't like it.

@mmcdara @one man @dharr All good answers. You all got a vote up. The question was not the best idea at all because long equations could be returned in the actual situation. Then the message would get lost.

@Carl Love @acer Well good news. I have Sublime Text working now. Produced a few procs and a little package as a test.

Thank You. 

@Carl Love @acer I appreciate all your good advice. What has been explained here on why you use code editors makes good sense. The translation bug helped convince me of that, so I presume there would be a fair few others. I have been looking at some of the code editors.

 Eclipse looked good with the Maple IDE but that seems to have been discontinued. Saw a Youtube video on it.

Downloaded EMACS last night Way out gradient for my limited knowledge.

Sublime text might be a way forward. I will ask a programmer at work to show me how it is used. I see there is this https://github.com/johnpmay/SublimeTextMaple available. The instructions are 

Installation instructions:

  • Copy all files to Packages/User directory

    So I did this C:\Program Files\Sublime Text\Packages\Ronan          and placed the 3 files there. Not sure if that is correct though.

As of yet no idea what next to do.

Why don't Maple make the Code Editor work externally to save the text files?

@acer Ok that works fine and saves properly as a .mla file. So I am using it.

@Carl Love Well that proved the point.  So could I then save all procedures as *.m files and then read them all into the package? What is/would be the downside? 

@acer  As shown the other night above I converted the 2D to 1D text by saving/exporting as maple.text. Then opened that file so it is 1D. Then corrected the "translation error". The procedure(s) then works fine in the document. Then  I save them out at either .mpl or .mm and rebuild the package AlgCalc the problem still occurs in the package. So I am concluding that the 

`<|>`(cpsub~([op(f)], var)[])

is still being converted to

 <cpsub~([op(f)], var)[]>

I have tried writing a more long hand version of that line but cant get the syntax correct.

Really that is what I need to know.

@acer This line at the end of "getCP"

`<|>`(cpsub~([op(f)], var)[])

gets converted to 

 <cpsub~([op(f)], var)[]>

This produces the column Matrix instead of the two row matrix

What should I convert the 1st line too, to prevent this happening?

@Joe Riel  I translated the two procedures to 1d and used the syntax you suggested. This produces the output problem. On saving

I get this warning message

I don't know much about 1d input to find the issue.

 

elif f :: `^` then ...
    elif f :: `.` then ...

 

restart;

cpsub := proc(t, var := alpha)
 local i, cf, varpwr;
 description "used by getCP";
 if not has(t, var) then
   return <0, t>;
 elif t::`^` then
   return <op(t)[2], 1>;
 else varpwr, cf := selectremove(has, [op(t)], var);
   if op(varpwr) = var then
     return <1, `*`(op(cf))>;
   end if;
  for i to nops(varpwr) do
    if numer(varpwr[i]) = 1 then
      if op(1/varpwr[i]) = alpha then
        varpwr[i] := -1;
      else varpwr[i] := -op(1/varpwr[i])[2];
      end if;
    else varpwr[i] := op(varpwr[i])[2];
    end if;
  end do;
    return <`+`(op(varpwr)), `*`(op(cf))>;
 end if;
 end proc;

 

cpsub := proc (t, var := alpha) local i, cf, varpwr; description "used by getCP"; if not has(t, var) then return `<,>`(0, t) elif t::`^` then return `<,>`(op(t)[2], 1) else varpwr, cf := selectremove(has, [op(t)], var); if op(varpwr) = var then return `<,>`(1, `*`(op(cf))) end if; for i to nops(varpwr) do if numer(varpwr[i]) = 1 then if op(1/varpwr[i]) = alpha then varpwr[i] := -1 else varpwr[i] := -op(1/varpwr[i])[2] end if else varpwr[i] := op(varpwr[i])[2] end if end do; return `<,>`(`+`(op(varpwr)), `*`(op(cf))) end if end proc

(1)

getCP := proc(f, var := alpha)
 local t;
 description "Dissmantles a polynomial into powers and coefficients";
 if not has(f, var) then
    return <0, f>;
 elif f::`^` then
    return <op(f)[2], 1>;
 elif f::`*` then
    return <cpsub~([f], var)[]>;
 else <cpsub~([op(f)], var)[]>;
 end if;
end proc;

getCP := proc (f, var := alpha) local t; description "Dissmantles a polynomial into powers and coefficients"; if not has(f, var) then return `<,>`(0, f) elif f::`^` then return `<,>`(op(f)[2], 1) elif f::`*` then return `<,>`(`~`[cpsub]([f], var)[]) else `<,>`(`~`[cpsub]([op(f)], var)[]) end if end proc

(2)

save cpsub, "C:/Users/Ronan/Documents/maple/Alibrary/Procedures/cpsub.mm"

save getCP,"C:/Users/Ronan/Documents/maple/Alibrary/Procedures/getCP.mm"

 

f:=5+2*x-7*x^2+3*x^5

f := 3*x^5-7*x^2+2*x+5

(3)

CP:=getCP(f,x)

Vector(8, {(1) = 5, (2) = 3, (3) = 2, (4) = -7, (5) = 1, (6) = 2, (7) = 0, (8) = 5})

(4)

 

`<|>`(cpsub~([op(f(x))], x)[])

Matrix(2, 4, {(1, 1) = 5, (1, 2) = 2, (1, 3) = x[2], (1, 4) = 0, (2, 1) = 3, (2, 2) = -7, (2, 3) = 2, (2, 4) = 5})

(5)

 

Download getCP_and_cpsub_1d.mws

Attached is the zip file. I just included the two relevant procedures

AlgCals.zip

@Joe Riel  Hello. Appoligies, I had no idea you had answered this question I asked. I came across it again today on a Google search.

I tried adding another test to the package but it is not working.

Edit:- I since made that work. I then made a further modification an imported one of my own procedures "SignedArea.mpl". I dont really know how to approach getting it to work with your methodology.

Could you advise please.


restart

NULL

NULL

NULL Rtestm := module ()

NULL

NULL

NewTest:=module()

NULL

ModuleApply:=proc()

NULL Testx:=module()

NULL

NULL

ModuleApply:=proc()

 

NULL

Import("C:/users/Ronan/Documents/Maple/ALibrary/Procedures/SignedArea.mpl");

"$include "SignedArea.mpl";
SignedArea := proc (a::{Vector, list}, b::{Vector, list}, c::{Vector, list, 
null} := null)

 local M, A; description 
"signed area of a line segment or 3 points"; if c = null then A := 1/2*a[1]*b[2
]-1/2*a[2]*b[1]; else A := 1/2*(b[2]-c[2])*a[1]+1/2*(-b[1]+c[1])*a[2]+1/2*c[2]*
b[1]-1/2*c[1]*b[2]; end if; return A; end proc;
"

NULL

with(CodeBuilder);

[Build, Directory, Export, File, Import, Mint, Read, Regions, Version]

Build(mint,maplet,prefix="#!");

Error, (in anonymous module instantiated by CodeBuilder:-Read) invalid input: too many and/or wrong type of arguments passed to CodeBuilder:-Import; first unused argument is C:/users/Ronan/Documents/Maple/ALibrary/Procedures/SignedArea.mpl

Error, (in CodeBuilder:-Read) Error: (in anonymous module instantiated by CodeBuilder:-Read) invalid input: too many and/or wrong type of arguments passed to CodeBuilder:-Import; first unused argument is C:/users/Ronan/Documents/Maple/ALibrary/Procedures/SignedArea.mpl

with(Rtestm);

[NewTest, Rtest, SignedArea, Testx]

Rtest();

"this is a test"

NewTest();

NewTest()

Testx();

Testx()

CodeBuilder:-Version

"1.0.9"

Directory()

"C:\Users\Ronan\AppData\Local\Temp\Rtestm"

LibraryTools:-FindLibrary(Rtestm)

Regions()

["Rtestm.mpl", "NewTest.mpl", "NewTest_ModuleApply.mpl", "Testx.mpl", "Testx_ModuleApply.mpl", "SignedArea.mpl"]

restart

Test3()

Test3()

NULL

 

Download Q_4-11-22_CodeBuilder_Pkg_test.mw

 

@acer Thank you. I have all three packages stored properly now. 

On a side note I had asked a question on the CodeBuilder package in 2017. Didn't know it had answered till today. And i see you had some comments to make there. It might be useful for what I wand to do. How do I use the CodeBuilder package? - MaplePrimes I have asked another question on it there.

@acer The LibraryTools make it much easier. So now before I go any futher I an sorting out my RationalTrigonometry and RonanRoutines packages. I am using the AlgCalc package to experiment with.

So I have managed to make the Ratonal trigonometry save out seperately into it's own .mla. I renamed the directsearch.mla extension to mxla to do this. I can always download direct search again.

Problems with the RonanRoutines package deciding to not evaluate to a module. Will come back to that. Though it did work the last time I modified it in september. Moved to 2022.2 at weekend??
 Now the AlgCalc package burried its self inside the CodeBuilder .mla so I deleted that whole package folder set.

The problem I am having now is the AlgCalc package not saving correctly. This document has screen shots to show what I have done.

 Yes I watched the package part of the conference. A bit too brief but I have screen shots I can go through at the weekend.

restart

Date()

_m2295771860928

dr := cat(kernelopts(homedir), "/Documents/maple/Alibrary/Procedures")

"C:\Users\Ronan/Documents/maple/Alibrary/Procedures"

SignedArea := proc (a::{Vector, list}, b::{Vector, list}, c::{Vector, list, null} := null) local M, A; description "signed area of a line segment or 3 points"; if c = null then M := Matrix([a, b]); A := (1/2)*a[1]*b[2]-(1/2)*a[2]*b[1] else A := (1/2)*(b[2]-c[2])*a[1]+(1/2)*(-b[1]+c[1])*a[2]+(1/2)*c[2]*b[1]-(1/2)*c[1]*b[2] end if; return A end proc

proc (a::{Vector, list}, b::{Vector, list}, c::{Vector, list, null} := null) local M, A; description "signed area of a line segment or 3 points"; if c = null then M := Matrix([a, b]); A := (1/2)*a[1]*b[2]-(1/2)*a[2]*b[1] else A := (1/2)*(b[2]-c[2])*a[1]+(1/2)*(-b[1]+c[1])*a[2]+(1/2)*c[2]*b[1]-(1/2)*c[1]*b[2] end if; return A end proc

NULL

save SignedArea, "C:/Users/Ronan/Documents/maple/Alibrary/Procedures/SignedArea.mm"

NULL

NULL

`&oplus;` := proc (a, b) (a+b)/(1-a*b) end proc

proc (a, b) (a+b)/(1-b*a) end proc

NULL

save `&oplus;`, "C:/Users/Ronan/Documents/maple/Alibrary/Procedures/&oplus;.mm"

 

This Part I did in Standard Notepad

 

AlgCalc := module ()
export SignedArea,
       `&oplus;`;
 option package;

$include "SignedArea.mm"
$include "`&oplus;`.mm"

 end module;

NULL

 

restart

with(LibraryTools)

[ActivationModule, AddFromDirectory, Author, Browse, BuildFromDirectory, ConvertVersion, Create, Delete, FindLibrary, PrefixMatch, Priority, Save, ShowContents, Timestamp, UpdateFromDirectory, WriteMode]

NULL

NULL

dr := cat(kernelopts(homedir), "/Documents/maple/Alibrary/Procedures")

"C:\Users\Ronan/Documents/maple/Alibrary/Procedures"

NULL

currentdir(dr)

"C:\Users\Ronan\Documents\MAPLE\A & Q Maple primes"

currentdir()

"C:\Users\Ronan\Documents\maple\Alibrary\Procedures"

read "AlgCalc.mpl"

_m2295817165792

LibLocation := "C:/Users/Ronan/maple/toolbox/personal/AlgCalc/AlgCalc.mla"

"C:/Users/Ronan/maple/toolbox/personal/AlgCalc/AlgCalc.mla"

Save('AlgCalc', LibLocation)

NULL

 

NULL

restart

NULLLibraryTools:-FindLibrary(AlgCalc)

NULLNULL

LibraryTools:-FindLibrary(RationalTrigonometry)

"C:\Users\Ronan\maple\toolbox\personal\lib\RationalTrigonometry.mla"

with(AlgCalc)

Error, invalid input: with expects its 1st argument, pname, to be of type {`module`, package}, but received AlgCalc

SignedArea([9, 1], [-5, 8], [7, 9])

SignedArea([9, 1], [-5, 8], [7, 9])

`&oplus;`(-3, 4)

`&oplus;`(-3, 4)

`&oplus;`(-3, 4)

`&oplus;`(-3, 4)

NULL

Download 4-11-22_Q_$include_Alg_Calc_Routines.mw

1 2 3 4 5 6 7 Last Page 2 of 20