Re: [NTG-context] mathfun

2021-05-23 Thread Hans Hagen

On 5/23/2021 5:33 PM, Jairo A. del Rio wrote:
Thank you a lot for the explanation! It makes more sense now and 
definitively is something very promising to play with. Wrt the module 
itself, is it possible to consider language-dependent labels? I noticed 
"\sin" is "sin" when it should be "sen" once the module is loaded.

local ctx_mfunction = context.mfunctionlabeltext

(btw, some of that mfunction stuff is related to mathml i/o)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-23 Thread Jairo A. del Rio
Thank you a lot for the explanation! It makes more sense now and
definitively is something very promising to play with. Wrt the module
itself, is it possible to consider language-dependent labels? I noticed
"\sin" is "sin" when it should be "sen" once the module is loaded.

Jairo

El dom, 23 de may. de 2021 a la(s) 09:35, Hans Hagen (j.ha...@xs4all.nl)
escribió:

> On 5/23/2021 3:45 PM, Jairo A. del Rio wrote:
> > El dom, 23 de may. de 2021 a la(s) 04:51, Hans Hagen (j.ha...@xs4all.nl
> > ) escribió:
> >
> > On 5/22/2021 11:34 PM, Jairo A. del Rio wrote:
> >  > Hi. Is \thewithproperty documented elsewhere? Is this a new
> > primitive?
> >  > It looks interesting.
> > In the case of the \sin trick particular case \let\computer\the would
> > also work; i added the \thewithproperty feature just because
> i
> > expect that users can come up with variants (like \drawme\sin ...)
> > which
> > then would adapt behaviour (via \dowithproperty2).
> >
> >
> > Having flags for computing and drawing would be awesome. I think it
> > would nicely extend ConTeXt's drawing features...
> >
> > So, indeed it's a new primitive but (for now) only used with these
> lua
> > hacks. Actually it's no big deal to reimplement \thewithoutunit
> as
> >
> >
> > So, is this Lua-specific?
>
> it relates to teh way tex sees things ... thihnk of
>
>\dimen0=10pt
>
> where \dimen expects a number, optional equal and value
>
> while
>
>\the\dimen0
>
> the '\the' expects all kind of things, with '\dimen' being one of then
> in which case its value is serialized
>
> in order to implement 'new primitives' using lua (like some that need to
> be implemented for compatibility reasons due to the backend differences)
> we need to be able to distinguish between setting and getting a value
>
> so in that sense it's indeed lua specific: a specific class of lua
> functions knows if it's triggered by serialization
>
> and that is what we 'kind of' abuse here and also why i did add this
> additional 'pseudo prefix' so that we ca ndo more clever things if we
> want to
>
> > \thewithoutunit{\dowithproperty1\the}
> >
> > and then
> >
> > \thewithcmunit{\dowithproperty2\the}
> >
> > to serialize the dimension in cm but normally i need to "wonder for a
> > while if it makes sense".
> >
> > Btw, adding primitives (related to the token related bits and pieces
> of
> > the engine) only makes sense if the gain is in
> >
> > -- avoiding clumsy code: although that can hurt someones pride and
> joy
> > over a nice and complex macro doing the same ... don't worry, i threw
> > away plenty of code by now
> >
> > -- significant performance gain: which is seldom the case (there
> really
> > is not much to gain, at least not in context which is rather
> optimized
> > already)
> >
> > -- giving way less noise in tracing: which for me is a good reason
> > (tracing changed a bit anyway)
> >
> > -- not adding much code to the engine or the need to refactor:
> although
> > for some luametatex extensions some internals had to change
> > fundamentally
> >
> > a good example is the extended macro argument handling: less clumsy
> tex
> > code, a bit of performance gain and easier full expansion, way less
> > tracing, but it violates the last argument because it did lead to
> some
> > refactoring (i also had to make sure the extra overhead didn't slow
> > down
> > macro definitions and expansion)
>
> > I did the following and I have two questions:
> >
> > 1. What if I want to have more than one property? Say \plusone for
> > computation and \plustwo for drawing.
>
> you can do that but keep in mind that \compute is then an 'official'
> context one (bound to 1) and any other number can conflict with other
> context numbers in the future, so best start at 1000 or so for private
> ones
>
> > 2. What does 'usage="value"' mean in the implement function (looks new,
> > but I'm prolly wrong)?
>
> indeed, it is already there for a while and it lets the function
> definition follow a different route ... basically one that can follow
> \the; I suppose that I can also make 'property' a valid usage (alias)
>
> (btw often features like this are described in articles or wrapups inm
> documents in the distribution or even mentioned here but as usual with
> tex these things only make sense trigger usage when one really needs it)
>
> > \permanent\protected\def\drawme{\thewithproperty\plussix} %better than
> 666
>
> or 31415 to fit in the tex numbering
>
> > \startluacode
> > local interfaces = interfaces
> > local implement = interfaces.implement
> > local context = context
> > local drawme_code = 6
> > local drawing = [==[
> > draw fullcircle scaled 10mm;
> > draw fullcircle shifted up scaled 5mm;
> > draw fulltriangle shifted (up+1/2right) scaled 5mm;
> > ]==]
> >
> >
> > local function chicken(value)
> > if value == 

Re: [NTG-context] mathfun

2021-05-23 Thread Hans Hagen

On 5/23/2021 3:45 PM, Jairo A. del Rio wrote:


\permanent\protected\def\drawme{\thewithproperty\plussix} %better than 666


As you're in protection ...

\immutable\integerdef\MyChickenDraw 1006

\permanent\protected\def\drawme{\thewithproperty\MyChickenDraw}

and yes, \integerdef is also a primitive (doesn't waste a register)

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-23 Thread Hans Hagen

On 5/23/2021 3:45 PM, Jairo A. del Rio wrote:
El dom, 23 de may. de 2021 a la(s) 04:51, Hans Hagen (j.ha...@xs4all.nl 
) escribió:


On 5/22/2021 11:34 PM, Jairo A. del Rio wrote:
 > Hi. Is \thewithproperty documented elsewhere? Is this a new
primitive?
 > It looks interesting.
In the case of the \sin trick particular case \let\computer\the would
also work; i added the \thewithproperty feature just because i
expect that users can come up with variants (like \drawme\sin ...)
which
then would adapt behaviour (via \dowithproperty2).


Having flags for computing and drawing would be awesome. I think it 
would nicely extend ConTeXt's drawing features...


So, indeed it's a new primitive but (for now) only used with these lua
hacks. Actually it's no big deal to reimplement \thewithoutunit as


So, is this Lua-specific?


it relates to teh way tex sees things ... thihnk of

  \dimen0=10pt

where \dimen expects a number, optional equal and value

while

  \the\dimen0

the '\the' expects all kind of things, with '\dimen' being one of then 
in which case its value is serialized


in order to implement 'new primitives' using lua (like some that need to 
be implemented for compatibility reasons due to the backend differences) 
we need to be able to distinguish between setting and getting a value


so in that sense it's indeed lua specific: a specific class of lua 
functions knows if it's triggered by serialization


and that is what we 'kind of' abuse here and also why i did add this 
additional 'pseudo prefix' so that we ca ndo more clever things if we 
want to



    \thewithoutunit{\dowithproperty1\the}

and then

    \thewithcmunit{\dowithproperty2\the}

to serialize the dimension in cm but normally i need to "wonder for a
while if it makes sense".

Btw, adding primitives (related to the token related bits and pieces of
the engine) only makes sense if the gain is in

-- avoiding clumsy code: although that can hurt someones pride and joy
over a nice and complex macro doing the same ... don't worry, i threw
away plenty of code by now

-- significant performance gain: which is seldom the case (there really
is not much to gain, at least not in context which is rather optimized
already)

-- giving way less noise in tracing: which for me is a good reason
(tracing changed a bit anyway)

-- not adding much code to the engine or the need to refactor: although
for some luametatex extensions some internals had to change
fundamentally

a good example is the extended macro argument handling: less clumsy tex
code, a bit of performance gain and easier full expansion, way less
tracing, but it violates the last argument because it did lead to some
refactoring (i also had to make sure the extra overhead didn't slow
down
macro definitions and expansion)



I did the following and I have two questions:

1. What if I want to have more than one property? Say \plusone for 
computation and \plustwo for drawing.


you can do that but keep in mind that \compute is then an 'official' 
context one (bound to 1) and any other number can conflict with other 
context numbers in the future, so best start at 1000 or so for private 
ones


2. What does 'usage="value"' mean in the implement function (looks new, 
but I'm prolly wrong)?


indeed, it is already there for a while and it lets the function 
definition follow a different route ... basically one that can follow 
\the; I suppose that I can also make 'property' a valid usage (alias)


(btw often features like this are described in articles or wrapups inm 
documents in the distribution or even mentioned here but as usual with 
tex these things only make sense trigger usage when one really needs it)



\permanent\protected\def\drawme{\thewithproperty\plussix} %better than 666


or 31415 to fit in the tex numbering


\startluacode
local interfaces = interfaces
local implement = interfaces.implement
local context = context
local drawme_code = 6
local drawing = [==[
draw fullcircle scaled 10mm;
draw fullcircle shifted up scaled 5mm;
draw fulltriangle shifted (up+1/2right) scaled 5mm;
]==]


local function chicken(value)
if value == "value" or value == drawme_code then


no need to check for "value" unless you also want:

\the\chicken


context.metafun.start()
context.metafun(drawing);
context.metafun.stop()
--elseif then ...
else
context("Chicken!")
end
end

implement{
name = "chicken",
public = true,
usage = "value", --What does it do?
overload = true,
actions = chicken
}

\stopluacode

\starttext\chicken\ and \drawme\chicken\stoptext
indeed an example of usage, and as with the mathfun, it saves a ton of 
macros like \drawchicken and so


so now you next challenge is to pass arguments so here a next phase

\permanent\protected\def\drawme{\thewithproperty1006 }

\startluacode

local interfaces = interfaces
local implement = 

Re: [NTG-context] mathfun

2021-05-23 Thread Jairo A. del Rio
El dom, 23 de may. de 2021 a la(s) 04:51, Hans Hagen (j.ha...@xs4all.nl)
escribió:

> On 5/22/2021 11:34 PM, Jairo A. del Rio wrote:
> > Hi. Is \thewithproperty documented elsewhere? Is this a new primitive?
> > It looks interesting.
> In the case of the \sin trick particular case \let\computer\the would
> also work; i added the \thewithproperty feature just because i
> expect that users can come up with variants (like \drawme\sin ...) which
> then would adapt behaviour (via \dowithproperty2).
>

Having flags for computing and drawing would be awesome. I think it would
nicely extend ConTeXt's drawing features...

So, indeed it's a new primitive but (for now) only used with these lua
> hacks. Actually it's no big deal to reimplement \thewithoutunit as
>

So, is this Lua-specific?

   \thewithoutunit{\dowithproperty1\the}
>
> and then
>
>\thewithcmunit{\dowithproperty2\the}
>
> to serialize the dimension in cm but normally i need to "wonder for a
> while if it makes sense".
>
> Btw, adding primitives (related to the token related bits and pieces of
> the engine) only makes sense if the gain is in
>
> -- avoiding clumsy code: although that can hurt someones pride and joy
> over a nice and complex macro doing the same ... don't worry, i threw
> away plenty of code by now
>
> -- significant performance gain: which is seldom the case (there really
> is not much to gain, at least not in context which is rather optimized
> already)
>
> -- giving way less noise in tracing: which for me is a good reason
> (tracing changed a bit anyway)
>
> -- not adding much code to the engine or the need to refactor: although
> for some luametatex extensions some internals had to change fundamentally
>
> a good example is the extended macro argument handling: less clumsy tex
> code, a bit of performance gain and easier full expansion, way less
> tracing, but it violates the last argument because it did lead to some
> refactoring (i also had to make sure the extra overhead didn't slow down
> macro definitions and expansion)
>
> Hans
>
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>

I did the following and I have two questions:

1. What if I want to have more than one property? Say \plusone for
computation and \plustwo for drawing.

2. What does 'usage="value"' mean in the implement function (looks new, but
I'm prolly wrong)?

\permanent\protected\def\drawme{\thewithproperty\plussix} %better than 666

\startluacode

local interfaces = interfaces

local implement = interfaces.implement

local context = context


local drawme_code = 6


local drawing = [==[

draw fullcircle scaled 10mm;

draw fullcircle shifted up scaled 5mm;

draw fulltriangle shifted (up+1/2right) scaled 5mm;

]==]


local function chicken(value)

if value == "value" or value == drawme_code then

context.metafun.start()

context.metafun(drawing);

context.metafun.stop()

--elseif then ...

else

context("Chicken!")

end

end


implement{

name = "chicken",

public = true,

usage = "value", --What does it do?

overload = true,

actions = chicken

}

\stopluacode

\starttext\chicken\ and \drawme\chicken\stoptext

Thank you in advance.

Jairo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-23 Thread Hans Hagen

On 5/22/2021 11:34 PM, Jairo A. del Rio wrote:
Hi. Is \thewithproperty documented elsewhere? Is this a new primitive? 
It looks interesting.
In the case of the \sin trick particular case \let\computer\the would 
also work; i added the \thewithproperty feature just because i 
expect that users can come up with variants (like \drawme\sin ...) which 
then would adapt behaviour (via \dowithproperty2).


So, indeed it's a new primitive but (for now) only used with these lua 
hacks. Actually it's no big deal to reimplement \thewithoutunit as


  \thewithoutunit{\dowithproperty1\the}

and then

  \thewithcmunit{\dowithproperty2\the}

to serialize the dimension in cm but normally i need to "wonder for a 
while if it makes sense".


Btw, adding primitives (related to the token related bits and pieces of 
the engine) only makes sense if the gain is in


-- avoiding clumsy code: although that can hurt someones pride and joy 
over a nice and complex macro doing the same ... don't worry, i threw 
away plenty of code by now


-- significant performance gain: which is seldom the case (there really 
is not much to gain, at least not in context which is rather optimized 
already)


-- giving way less noise in tracing: which for me is a good reason 
(tracing changed a bit anyway)


-- not adding much code to the engine or the need to refactor: although 
for some luametatex extensions some internals had to change fundamentally


a good example is the extended macro argument handling: less clumsy tex 
code, a bit of performance gain and easier full expansion, way less 
tracing, but it violates the last argument because it did lead to some 
refactoring (i also had to make sure the extra overhead didn't slow down 
macro definitions and expansion)


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-22 Thread Jairo A. del Rio
Hi. Is \thewithproperty documented elsewhere? Is this a new primitive? It
looks interesting.

Jairo

El vie, 21 de may. de 2021 a la(s) 08:15, Hans Hagen (j.ha...@xs4all.nl)
escribió:

> Hi,
>
>
> I uploaded an lmtx update (only m-mathfun added).
>
> Attached a short description of this (windy stormy friday afternoon)
> math experiment. The question is, what similar features using this
> trickery come to mind.
>
> Hans
>
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun (Hans Hagen)

2021-05-22 Thread Hans Hagen

On 5/21/2021 11:55 PM, Jeong Dal wrote:

Dear Hans,

Thank you for your new module for math.

If possible, I prefer to use

$ \sqrt(x) = \compute\sqrt[.3N] {2} $   

$ \pi = \mathexpr[.40N]{pi} $


It is more direct to use and good to write a text in which we need some math 
calculation.

It is another good news for me.

I hope it covers at least all the functions in metafun and in lua.

we have several math libs:

  math (lua one)
  xmath(c one, more functions)
  xcomplex (c one + cerf)
  xdecimal (same as mp)

(as experiment, m-mathfun only maps a few but we can map more)

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-22 Thread Hans Hagen

On 5/21/2021 11:01 PM, Henning Hraban Ramm wrote:



Am 21.05.2021 um 15:15 schrieb Hans Hagen :

I uploaded an lmtx update (only m-mathfun added).

Attached a short description of this (windy stormy friday afternoon) math 
experiment. The question is, what similar features using this trickery come to 
mind.


Thank you!

I can probably simplify my invoices with such directly calculated output, even 
if I don’t need a lot of math, just some addition and tax percents.
But I got no time to look into that ATM.

I also didn’t look into formatters yet.
Is there a possibility for l10n, e.g. replacing decimal points by commas? (At 
the moment I’m converting via string and replace.)
e.g. can I "format" from 12.00 (1.5) to "12,00 €" ("1,50 €") or even "12,-- €" (still 
"1,50 €")?

(I finally bought Ierusalimschy’s Lua book and hope to find some time for it in 
the upcoming holiday week with my children.)

\luaexpr[.M]{1234.56}

\luaexpr[.m]{1234.56}

you can use the formatters that context already has

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun (Hans Hagen)

2021-05-21 Thread Jeong Dal
Dear Hans,

Thank you for your new module for math.

If possible, I prefer to use 
$ \sqrt(x) = \compute\sqrt[.3N] {2} $   
$ \pi = \mathexpr[.40N]{pi}$

It is more direct to use and good to write a text in which we need some math 
calculation.
It is another good news for me.
I hope it covers at least all the functions in metafun and in lua.

Best regards,
Dalyoung___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-21 Thread Henning Hraban Ramm

> Am 21.05.2021 um 15:15 schrieb Hans Hagen :
> 
> I uploaded an lmtx update (only m-mathfun added).
> 
> Attached a short description of this (windy stormy friday afternoon) math 
> experiment. The question is, what similar features using this trickery come 
> to mind.

Thank you!

I can probably simplify my invoices with such directly calculated output, even 
if I don’t need a lot of math, just some addition and tax percents.
But I got no time to look into that ATM.

I also didn’t look into formatters yet.
Is there a possibility for l10n, e.g. replacing decimal points by commas? (At 
the moment I’m converting via string and replace.)
e.g. can I "format" from 12.00 (1.5) to "12,00 €" ("1,50 €") or even "12,-- €" 
(still "1,50 €")?

(I finally bought Ierusalimschy’s Lua book and hope to find some time for it in 
the upcoming holiday week with my children.)

Hraban
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-21 Thread Aditya Mahajan
On Fri, 21 May 2021, Otared Kavian wrote:

> By the way, what does 
> 
>   \complexexpr{123 + new(456,789)}
> 
> mean?

Haven't look at the code yet, but I'd guess `new(a,b) = a + bi`. 

Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-21 Thread Hans Hagen

On 5/21/2021 5:24 PM, Otared Kavian wrote:

Hi Hans,

Thanks for the new features you have introduced in the module mathfun.
Actually I have been using commands such as the one mentioned by Aditya,
\ctxlua{myfunction(args)}
but for the formatting of the output, that is when one wants only 3 or four 
decimal digits, that approach is not very handy.
So I will use the new feature and I’ll put it on the wiki once I have a few 
interesting examples.
By the way, what does

\complexexpr{123 + new(456,789)}

complex numbers, so (re=123,im=0) + (re=456,im=789)

this uses the xcomplex library that is in lmtx, while ecimal uses the 
xdecimal library for decimal precision(as in metapost decimal mode)


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-21 Thread Otared Kavian
Hi Hans,

Thanks for the new features you have introduced in the module mathfun.
Actually I have been using commands such as the one mentioned by Aditya,
\ctxlua{myfunction(args)}
but for the formatting of the output, that is when one wants only 3 or four 
decimal digits, that approach is not very handy.
So I will use the new feature and I’ll put it on the wiki once I have a few 
interesting examples.
By the way, what does 

\complexexpr{123 + new(456,789)}

mean?

Best regards: Otared

> On 21 May 2021, at 17:06, Hans Hagen  wrote:
> 
> On 5/21/2021 4:37 PM, Aditya Mahajan wrote:
>> On Fri, 21 May 2021, Hans Hagen wrote:
>>> I uploaded an lmtx update (only m-mathfun added).
>>> 
>>> Attached a short description of this (windy stormy friday afternoon) math
>>> experiment. The question is, what similar features using this trickery come 
>>> to
>>> mind.
>> Personally, I can see occasionally making use of this instead of 
>> \ctxlua{myfunction(args)}. There is a similar library called pgfmath which 
>> is part of the tikz package, which is used quite heavily by the pgfplots 
>> package but also appears to be popular for other purposes:
>> https://tex.stackexchange.com/questions/tagged/pgfmath?tab=Votes
> I guessed right that you would be the first to to react! Anyway, I suppose 
> that you come up with additional demands like:
> 
>\permanent\protected\def\randomized{\thewithproperty\plustwo}
> 
> so that we can do:
> 
>$ \sin(x) = \randomized\sin{2pi} $
> 
> which i'm sure you can figure out by looking at the source.
> 
> Hans
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-21 Thread Hans Hagen

On 5/21/2021 4:37 PM, Aditya Mahajan wrote:

On Fri, 21 May 2021, Hans Hagen wrote:


I uploaded an lmtx update (only m-mathfun added).

Attached a short description of this (windy stormy friday afternoon) math
experiment. The question is, what similar features using this trickery come to
mind.


Personally, I can see occasionally making use of this instead of 
\ctxlua{myfunction(args)}. There is a similar library called pgfmath which is 
part of the tikz package, which is used quite heavily by the pgfplots package 
but also appears to be popular for other purposes:

https://tex.stackexchange.com/questions/tagged/pgfmath?tab=Votes
I guessed right that you would be the first to to react! Anyway, I 
suppose that you come up with additional demands like:


\permanent\protected\def\randomized{\thewithproperty\plustwo}

so that we can do:

$ \sin(x) = \randomized\sin{2pi} $

which i'm sure you can figure out by looking at the source.

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] mathfun

2021-05-21 Thread Aditya Mahajan
On Fri, 21 May 2021, Hans Hagen wrote:

> I uploaded an lmtx update (only m-mathfun added).
> 
> Attached a short description of this (windy stormy friday afternoon) math
> experiment. The question is, what similar features using this trickery come to
> mind.

Personally, I can see occasionally making use of this instead of 
\ctxlua{myfunction(args)}. There is a similar library called pgfmath which is 
part of the tikz package, which is used quite heavily by the pgfplots package 
but also appears to be popular for other purposes:

https://tex.stackexchange.com/questions/tagged/pgfmath?tab=Votes

Aditya

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] mathfun

2021-05-21 Thread Hans Hagen

Hi,


I uploaded an lmtx update (only m-mathfun added).

Attached a short description of this (windy stormy friday afternoon) 
math experiment. The question is, what similar features using this 
trickery come to mind.


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-


math-fun.pdf
Description: Adobe PDF document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___