Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{fp}
- usepackage{siunitx,amsmath}
- %usepackage{xparse}
- ExplSyntaxOn
- NewDocumentCommand{newarray}{m}
- {
- seq_new:c { l_hafid_array_ cs_to_str:N #1 _seq }
- cs_new:Npn #1 (##1)
- {
- seq_item:cn { l_hafid_array_ cs_to_str:N #1 _seq } { ##1 }
- }
- }
- NewDocumentCommand{readarray}{mm}
- {
- seq_set_split:cnn { l_hafid_array_#1_seq } { & } { #2 }
- }
- cs_generate_variant:Nn seq_set_split:Nnn { c }
- ExplSyntaxOff
- begin{document}
- newarraysomevalues
- readarray{somevalues}{1&2&3.5&4&5}
- begin{align*}
- v_1 &= somevalues(1)\
- v_2 &= somevalues(2)\
- v_3 &= somevalues(3)\
- v_4 &= somevalues(4)\
- v_5 &= somevalues(5)
- end{align*}
- First number = somevalues(1)\
- Second number = somevalues(2)
- FPaddxx{somevalues(1)}{somevalues(2)}
- FPeval{xx}{round(xx,4)}%
- sum of first two numbers = xx
- FPevalxx{somevalues(1)+somevalues(2)}
- FPeval{xx}{round(xx,4)}%
- sum of first two numbers = xx
- %
- newcountcount
- count=5
- FPsetans{0}
- loop
- %somevalues(count)\
- FPaddans{ans}{somevalues(count)}
- %FPevalans{ans+somevalues(count)}
- advance count by -1
- unlessifnum count<1
- repeat
- %
- FPeval{ans}{round(ans,4)}%
- sum of all numbers = ans
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement