Math & ScienceArrays & functions

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
LaTeX Beginner
Posts: 30
Joined: Tue Sep 11, 2012 2:55 pm

Arrays & functions

Post by LaTeX Beginner »

cgnieder wrote:The compat option should ensure the compatibility with the specified version is given.
Thanks for the reply.

I don't know what do you refer with the "compat option"... I don't know that...

I've updated my TEX distribution (MiKTex), and I've downloaded from CTAN the latest version of pgfplots. But I don't know how to install it manually, because the package manager don't shows already this latest version...

How can I proceed??

Thanks :)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Arrays & functions

Post by cgnieder »

LaTeX Beginner wrote:
cgnieder wrote:The compat option should ensure the compatibility with the specified version is given.
Thanks for the reply.

I don't know what do you refer with the "compat option"... I don't know that...
I refer to it because of the error message you posted earlier:

Code: Select all

! Package pgfkeys Error: Choice '1.6' unknown in key '/pgfplots/compat/anchors'
. I am going to ignore this key.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l.3 \pgfplotsset{compat=1.6}
You've hopefully noticed that the example code contained the line

Code: Select all

\pgfplotsset{compat=1.6}
which I suggested to leave out. You can read what this option means in the pgfplots manual.
LaTeX Beginner wrote:I've updated my TEX distribution (MiKTex), and I've downloaded from CTAN the latest version of pgfplots. But I don't know how to install it manually, because the package manager don't shows already this latest version...

How can I proceed??
Maybe this helps: How do I update my TeX distribution?

Regards
site moderator & package author
LaTeX Beginner
Posts: 30
Joined: Tue Sep 11, 2012 2:55 pm

Arrays & functions

Post by LaTeX Beginner »

Thank you so much for the help. I've updated my TEX ditribution, and finally I could get the latest version of pgfplots. I've tried to run the code, but again I get so many errors...

Here is the code (the same that I posted before, with he the exception of the line that contains the compat option):

Code: Select all

    \documentclass{article}
    \usepackage{pgfplots}
    %\pgfplotsset{compat=1.6}

        
	\def\E{5}	
	\def\W{1.0}
	\def\ReA{1.0}			
	\def\ImA{0.5}
	\def\S{0.45}		
	\def\I{(2*pi/\W)*\d*cos(x)*(180/pi)}

    \def\FAR(#1){\sum(\ReA*cos(\I)*(180/pi)+\ImA*cos(\I)*(180/pi))}
	\def\FAI(#1){\sum(\ReA*sen(\I)*(180/pi)+\ImA*sen(\I)*(180/pi))} 
    

    % create the table contents:
    \usepackage{longtable,array,siunitx,expl3}
    \ExplSyntaxOn
    \tl_new:N \tablecontents
    \int_do_while:nn { \l_tmpa_int <= 360 }
      {
        \fp_set:Nn \l_tmpa_fp { round( \FAR( \l_tmpa_int * deg ) , 2 ) }
        \fp_set:Nn \l_tmpb_fp { round( \FAI( \l_tmpa_int * deg ) , 2 ) }
        \tl_put_right:Nx \tablecontents
          {
            \int_use:N \l_tmpa_int & % x
            \fp_to_tl:N \l_tmpa_fp & % FAR(x)
            \fp_to_tl:N \l_tmpb_fp \exp_not:N \\ % FAI(x)
          }
        \int_incr:N \l_tmpa_int
      }
    \ExplSyntaxOff
    \begin{document}

    \begin{tikzpicture}
     \begin{axis}
      \addplot[domain=0:360,red] { \FAR(x) } ;
      \addplot[domain=0:360,blue] { \FAI(x) } ;
     \end{axis}
    \end{tikzpicture}

    \begin{longtable}{l*2{S[table-format=-2.2]}}
      $x$ & {$FAR(x)$} & {$FAI(x)$} \\ \hline
     \endhead
     \tablecontents
    \end{longtable}

    \end{document}
And here are the errors that I get:

Code: Select all

! Undefined control sequence.
<argument> \LaTeX3 error:
Missing * inserted.
l.32 }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! You can't use `\unhbox' after \the.
<recently read> \unhbox
l.32 }
I'm forgetting what you said and using zero instead.
! Improper alphabetic constant.
<to be read again>
\bgroup
l.32 }
A one-character control sequence belongs after a ` mark.
So I'm essentially inserting \0 here.
! Missing = inserted for \ifnum.
<to be read again>
\bgroup
l.32 }
I was expecting to see `<', `=', or `>'. Didn't.
! Missing number, treated as zero.
<to be read again>
\bgroup
l.32 }
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\s__fp \__fp_chk:w 10{2}{1000}{0000}{0000}{0000};\bgroup /26=\c_three \ETC.
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_lparen_after:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_lparen_after:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_unary:NNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_apply_unary:NNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_lparen_after:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_lparen_after:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_lparen_after:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_lparen_after:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_round:NNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_apply_round:NNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_after:ww has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_after:ww was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Missing number, treated as zero.
<to be read again>
\par
l.32 }
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Undefined control sequence.
<argument> \LaTeX3 error:
Missing * inserted.
l.32 }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
Unknown fp word sen.
l.32 }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
Missing * inserted.
l.32 }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! You can't use `\unhbox' after \the.
<recently read> \unhbox
l.32 }
I'm forgetting what you said and using zero instead.
! Improper alphabetic constant.
<to be read again>
\bgroup
l.32 }
A one-character control sequence belongs after a ` mark.
So I'm essentially inserting \0 here.
! Missing = inserted for \ifnum.
<to be read again>
\bgroup
l.32 }
I was expecting to see `<', `=', or `>'. Didn't.
! Missing number, treated as zero.
<to be read again>
\bgroup
l.32 }
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\s__fp \__fp_chk:w 10{2}{1000}{0000}{0000}{0000};\bgroup /26=\c_three \ETC.
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_lparen_after:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_lparen_after:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_lparen_after:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_lparen_after:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_lparen_after:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_lparen_after:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_round:NNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_apply_round:NNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_after:ww has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_after:ww was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Missing number, treated as zero.
<to be read again>
\par
l.32 }
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Use of \__fp_to_tl_dispatch:w doesn't match its definition.
\l_tmpa_fp ->\par
l.32 }
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Use of \__fp_to_tl_dispatch:w doesn't match its definition.
\l_tmpb_fp ->\par
l.32 }
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Undefined control sequence.
<argument> \LaTeX3 error:
Missing * inserted.
l.32 }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! You can't use `\unhbox' after \the.
<recently read> \unhbox
l.32 }
I'm forgetting what you said and using zero instead.
! Improper alphabetic constant.
<to be read again>
\bgroup
l.32 }
A one-character control sequence belongs after a ` mark.
So I'm essentially inserting \0 here.
! Missing = inserted for \ifnum.
<to be read again>
\bgroup
l.32 }
I was expecting to see `<', `=', or `>'. Didn't.
! Missing number, treated as zero.
<to be read again>
\bgroup
l.32 }
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\s__fp \__fp_chk:w 10{2}{1000}{0000}{0000}{0000};\bgroup /26=\c_three \ETC.
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_lparen_after:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_lparen_after:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_unary:NNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_apply_unary:NNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_until_test:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_apply_binary:NwNwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \__fp_parse_apply_binary:NwNwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_lparen_after:NwN has an extra }.
<inserted text>
\par
l.32 }
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\par
! Paragraph ended before \__fp_parse_lparen_after:NwN was complete.
<to be read again>
\par
l.32 }
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Argument of \__fp_parse_until_test:NwN has an extra }.
<inserted text>
\par
l.32 }
(That makes 100 errors; please try again.)
Here is how much of TeX's memory you used:
23999 strings out of 493921
589001 string characters out of 3144878
606463 words of memory out of 3000000
26918 multiletter control sequences out of 15000+200000
3640 words of font info for 14 fonts, out of 3000000 for 9000
841 hyphenation exceptions out of 8191
63i,0n,74p,708b,609s stack positions out of 5000i,500n,10000p,200000b,50000s
! ==> Fatal error occurred, no output PDF file produced!
If you run this code, you get this errors? Any idea about how can I solve that??

Thank you so much again :)
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Arrays & functions

Post by cgnieder »

That is because your changes to the functions cannot work!

Code: Select all

\def\I{(2*pi/\W)*\d*cos(x)*(180/pi)}
\def\FAR(#1){\sum(\ReA*cos(\I)*(180/pi)+\ImA*cos(\I)*(180/pi))}
\def\FAI(#1){\sum(\ReA*sen(\I)*(180/pi)+\ImA*sen(\I)*(180/pi))}
  • It needs to be sin instead of sen
  • The example uses expl3's fp module so the syntax must be compliant with it, read interface3 about details of the modul
  • inside the definition of \I you use \d but never define it which must lead to errors at some point
  • both \FAR and \FAI get a variable as an argument but you deleted that in your definition so even if it would compile you would get the same value over and over.
I suggest you take my original example an see if it compiles now. If it does carefully study what changes if you change things in the code so you can see how everything works.

Regards
site moderator & package author
LaTeX Beginner
Posts: 30
Joined: Tue Sep 11, 2012 2:55 pm

Arrays & functions

Post by LaTeX Beginner »

Thank you so much, that works! :-)

Finally, I don't know how to indicate to the functions FAR and FAI that I want that this functions take the variable \In. In your code, you have defined this functions like:

Code: Select all

\def\FARe(#1){(\ReAi*cos(#1)*(180/pi)+\ImAi*cos(#1)*(180/pi))}
\def\FAIm(#1){(\ReAi*sin(#1)*(180/pi)+\ImAi*sin(#1)*(180/pi))} 
And I want to do something like that (it give me some errors):

Code: Select all

\def\FARe{(\ReAi*cos(\In)*(180/pi)+\ImAi*cos(\In)*(180/pi))}
\def\FAIm{(\ReAi*sin(\In)*(180/pi)+\ImAi*sin(\In)*(180/pi))} 
I mean, \In is a function that depends on a set of variables. It is defined like:

Code: Select all

\def\In{(2*pi/\W)*\d*cos(x)*(180/pi)}
Where \d is:

Code: Select all

\def\d{0.3}
You don't know how much are you helping me. Thanks :)
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Arrays & functions

Post by cgnieder »

Let me try to explain these macros:

Code: Select all

\def\FARe(#1){(\ReAi*cos(#1)*(180/pi)+\ImAi*cos(#1)*(180/pi))}
\def\FAIm(#1){(\ReAi*sin(#1)*(180/pi)+\ImAi*sin(#1)*(180/pi))}
This uses the TeX way of defining macros with \def and exploits the way how parameters may be specified with it:

Code: Select all

\def\macro{some code whatsoever}% => macro with no argument
\def\macro#1{some code whatsoever using #1}% => macro with one mandatory argument
% to be used like \macro{argument}
\def\macro#1#2{some code whatsoever using #1 and #2}% => macro with two mandatory arguments
% to be used like \macro{argument1}{argument2}
\def\macro(#1){some code whatsoever using #1}% => macro with one mandatory argument
% to be used like \macro(argument)
\def\macro bla#1bla{some code whatsoever using #1}% => macro with one mandatory argument
% to be used like \macro blaargumentbla
In the definition of the table code there was the line

Code: Select all

\fp_set:Nn \l_tmpa_fp { round( \FAR( \l_tmpa_int * deg ) , 2 ) }
where the argument was an integer converted into radians (\l_tmpa_int * deg, see interface3 for details). This radian should now be specified by #1 in the definition of the function as the place of the variable.

So let's see:

Code: Select all

% \In should take an argument, for example like this: \In(argument)
\def\In(#1){(2*pi/\W)*\d*cos(#1)*(180/pi)}
% \FARe should also take an argument and make sure to feed is to \In:
\def\FARe(#1){(\ReAi*cos(\In(#1))*(180/pi)+\ImAi*cos(\In(#1))*(180/pi))}
If you make sure you defined \ReAi, \ImAi and \d (you should think of another name, \d is defined by LaTeX already) as well a usage like this should work:

Code: Select all

\fp_set:Nn \l_tmpa_fp { round( \FARe( \l_tmpa_int * deg ) , 2 ) }
Regards
site moderator & package author
LaTeX Beginner
Posts: 30
Joined: Tue Sep 11, 2012 2:55 pm

Re: Arrays & functions

Post by LaTeX Beginner »

Thank you so much!! I don't know how to express my gratitude to you... You've helped me so much... I really appreciate it... :D

Finally, all works fine, and this is for your help and for your patience. I hope to not "annoy" you more, but if I must to do it again, I know I can trust you :D

Thank you so much.
Regards.
LaTeX Beginner
Posts: 30
Joined: Tue Sep 11, 2012 2:55 pm

Arrays & functions

Post by LaTeX Beginner »

Hi again!

I'm sorry for disturb you again, but I have a doubt that I think could be easy to solve.

In the same line I've working, I want to represent the phase of a complex number (a+j*b), where "a" is the real part and "b" is the imaginary part of the number.

The phase is given by the following equation:

Ph=arctan(b/a)

I don't know how to obtain the arctan of two variables. In this case, this two variables are:

Code: Select all

\def\FAR(#1){(\ReAi*cos(#1)*(180/pi)+\ImAi*cos(#1)*(180/pi))}
    \def\FAI(#1){(\ReAi*sin(#1)*(180/pi)+\ImAi*sin(#1)*(180/pi))}
And I want to do something like that:

Code: Select all

\def\Ph(#1){arctan(\FAI(#1)/\FAR(#1))}
But I don't find the way to do that. I've installed the packages pst-math and pst-ploth, and I've used the function ATAN, but it still give me some errors... And, of course, I want to do something like that:

Code: Select all

 \int_do_while:nn { \l_tmpa_int <= 360 }
      {
        \fp_set:Nn \l_tmpa_fp { round( \FAR( \l_tmpa_int * deg ) , 2 ) }
        \fp_set:Nn \l_tmpb_fp { round( \Ph( \l_tmpa_int * deg ) , 2 ) }
        \tl_put_right:Nx \tablecontents
          {
            \int_use:N \l_tmpa_int & % x
            \fp_to_tl:N \l_tmpa_fp & % FAR(x)
            \fp_to_tl:N \l_tmpb_fp \exp_not:N \\ % Ph(x)
          }
        \int_incr:N \l_tmpa_int
      }
I mean, I want to proceed in the same way I've done until this moment.

Any idea?? Thank you so much :)
Post Reply