formulas – attempting to compile an output List, into a single cell in one Sheet, based on matching criteria in a range on another Sheet

Your setup of the formula is incorrect. FILTER can take any number of comma-separated arguments; it doesn’t need the AND grouping. In addition, AND does not work within ArrayFormula anyway (and you didn’t need ArrayFormula here, because FILTER is its own built-in array formula.

Try this:

=IF(B4<>"", JOIN(CHAR(10), FILTER('Drive-Times'!A$3:A & "-" & 'Drive-Times'!B$3:B, 'Drive-Times'!C$3:C>=B4, 'Drive-Times'!C$3:C<B5)),)

The use of semicolons in your template formula means that this person has a sheet that is set to a locale that uses semicolons in place of commas. Your sheet locale uses commas.


=IF(B4<>"", IFERROR(JOIN(CHAR(10), FILTER('Drive-Times'!A$3:A & "-" & 'Drive-Times'!B$3:B, 'Drive-Times'!C$3:C>=B4, 'Drive-Times'!C$3:C<B5)),"NONE"),)

differential equations – Asymptotic Output Tracking – Where to Place the Input Control Signal?

Asymptotic Output Tracking: Code Issues

I ask for help from specialists in differential equations, dynamical systems, optimal control and
general control theory;

I have the following system of differential equations:

begin{cases} frac{dx(t)}{dt}=G(t) \ frac{dz(t)}{dt}+z(t)=frac{df}{dt} \ frac{dG(t)}{dt}+G(t)=z(t) cdot alpha sin(omega t) \ frac{dH(t)}{dt}+H(t)=z(t) cdot (frac{16}{alpha^2}(sin(omega t)-frac{1}{2})) \ frac{dX(t)}{dt}+X(t)=frac{dx(t)}{dt} end{cases}

where, $x,z,G,H,X$ – variables; $f=-(x(t)+alpha sin(omega t)-x_e)^2$; $alpha, omega$ – parameters.

As an output $y$, I assign:

$y=tanh(k cdot H(t))$

As an reference signal $r_1$, I assign:


As an constant time $p_1$, I assign:


Well, I tried to program this in the Mathematica program and ran into a difficulty that I can’t get over yet. Question: in which of the equations should the control signal $u(t)$ be placed?

I chose the first equation, then the original system of equations will look like this:

begin{cases} frac{dx(t)}{dt}=G(t)+u(t) \ frac{dz(t)}{dt}+z(t)=frac{df}{dt} \ frac{dG(t)}{dt}+G(t)=z(t) cdot alpha sin(omega t) \ frac{dH(t)}{dt}+H(t)=z(t) cdot (frac{16}{alpha^2}(sin(omega t)-frac{1}{2})) \ frac{dX(t)}{dt}+X(t)=frac{dx(t)}{dt} end{cases}





S(t) = (Alpha) Sin((Omega) t)

M(t) = 16/(Alpha)^2 (Sin((Omega) t) - 1/2)

f = -(x(t) + S(t) - xe)^2

 asys = AffineStateSpaceModel({x'(t) == G(t) + u(t), 
     z'(t) + z(t) == D(f, t), G'(t) + G(t) == z(t) S(t), 
     H'(t) + H(t) == z(t) M(t), 
     1/k X'(t) + X(t) == D(x(t), t)}, {{x(t), xs}, {z(t), 0.1}, {G(t),
       0}, {H(t), 0}, {X(t), 0}}, {u(t)}, {Tanh(k H(t))}, t) // 

pars1 = {Subscript(r, 1) -> -1, Subscript(p, 1) -> -1}

 fb = AsymptoticOutputTracker(asys, {-1}, {-1, -1}) // Simplify)

pars = {xs = -1, xe = 1, (Alpha) = 0.3, (Omega) = 2 Pi*1/2/Pi, 
  k = 100, (Mu) = 1}

 csys = SystemsModelStateFeedbackConnect(asys, fb) /. pars1 // 
    Simplify // Chop)

plots = {OutputResponse({csys}, {0, 0}, {t, 0, 1})}

At the end, I get an error.

At t == 0.005418556209176463`, step size is effectively zero; 
singularity or stiff system suspected

It seems to me that this is due to the fact that either in the system there is a ksk somewhere, or I have put the control input signal in the wrong equation. I need the support of a theorist who can help me choose the right sequence of actions to solve the problem.

I would be glad to any advice and help.

Script Linux Bash, print grep output based on number of words in line

I’m trying to write a scirpt for the bash shell. I’m given 4 parameters:

  1. path of a directory
  2. extension of a file
  3. a word
  4. a number

I have to look for all files and files of subdirectories of the path, for files with the given extension. Then, look in the files for the lines matching the word given, but only if the number of words in the line is bigger or equal to the number provided.
For example:
If localDirectory has: image.png text.txt.
And text.txt has:

This is a text file
It contains many words
This is an example for a simple text file

Then give the command: ./ localDirectory txt text 7
I should output: This is an example for a simple text file.

For now, my script looks like this:

if [ "$#" -ne 4 ];
  echo "Not enough parameters"
  exit 1
find $1 -name "*.$2" -exec grep -wi $3  {} ;

And it works just fine for the first 3 goals, I just don’t know how to filter now the result such that the line has a greater or equal number of words as $4.

I could of course create a new file and output there, and then read from it and print only the relevant lines, but I would rather do this without creating new files.

I’m very new to shell scripting.

Any ideas?

How to output results of an AppleScript image resizing script and display in automator

I am currently using an automator flow that copies finder items, changes them to jpeg, reveals them, and then runs an applescript that presents a dialog for batch resizing by image width. Every now and then, the script misses a couple of files or I prematurely move them from the folder before they have finished. I added a couple of pieces to the automation to

  1. Set value of variable: output
  2. Ask for confirmation: output

This doesn’t really output anything useful, but it does notify me when the script has finished running. Is there some way to output whether or not there were any issues with the script or is this way too crazy of a question to be asking on stackexchange? In advance… No, I’m not very familiar with AppleScript.

Here’s the script – I appreciate any & all advice/help 🙂

tell application "System Events"
    set theWidth to display dialog "Enter the width" default answer "2000"
    set theWidth to the text returned of theWidth as real
end tell
global theWidth
tell application "Finder"
    set some_items to selection as list
    repeat with aItem in some_items
        set contents of aItem to aItem as alias
    end repeat
end tell
repeat with i in some_items
    end try
end repeat

to rescale_and_save(this_item)
    tell application "Image Events"
        set the target_width to theWidth
        -- open the image file
        set this_image to open this_item
        set typ to this_image's file type
        copy dimensions of this_image to {current_width, current_height}
        if current_width is greater than target_width then
            if current_width is greater than current_height then
                scale this_image to size target_width
                -- figure out new height
                -- y2 = (y1 * x2) / x1
                set the new_height to (current_height * target_width) / current_width
                scale this_image to size new_height
            end if
        end if
        tell application "Finder"
            set file_name to name of this_item
            set file_location to (container of this_item as string)
            set new_item to (file_location & file_name)
            save this_image in new_item as typ
        end tell
    end tell
end rescale_and_save

json rpc – What does the sixth line in the output of the Bitcoin Core GUI RPC command “gettxoutsetinfo” mean?

An example of the output of this RPC command is as follows.

 1  "height":n,     (numeric) The current block height (index)
 2  "bestblock": "hex",   (string) The hash of the block at the tip of the chain
 3  "transactions": n,      (numeric) The number of transactions with unspent outputs
 4  "txouts": n,            (numeric) The number of unspent transaction outputs
 5  "bogosize": n,          (numeric) A meaningless metric for UTXO set size
 6  "hash_serialized_2": "hash", (string) The serialized hash
 7  "disk_size": n,         (numeric) The estimated size of the chainstate on disk
 8  "total_amount":          (numeric) The total amount

What’s the meaning of the sixth line “hash_serialized_2”? Whose hash is this referring to?

macos – How to adjust master volume for an output device?

I’m using a DAC (AudioQuest DragonFly) which has a very loud master volume when combined with headphones. It is not possible to adjust the volume on the device itself.

Therefore I can only use the first three notches on the audio volume, everything else is too loud (I know I can use together with the volume buttons to get 1/4 of the volume adjustments, but I’d rather just use the volume buttons as is because that’s where my muscle memory is).

Is it possible to adjust the master volume of an output device in macOS so that I can use the full range of volume adjustment when using the volume keys? If so, how can I achieve this?

linux – Hashcat doesn’t write to output file

Since it doesn’t give you an output – for any reason that might be, do it the other way. Assuming you are in linux and have any sort of terminal:

hashcat -m 0 -a 0 --force hashdump.txt ../rockyou.txt >> out.txt

or &>> if you want to include <stderr>. Double > is for text append in a file, or creation of a new one. Single > overwrites or creates a new file.

Same way if you are in windows cmd:

hashcat -m 0 -a 0 --force hashdump.txt ../rockyou.txt > out.txt

How to export an output in a special cell in an excel file?

My general question is: How can I put each of my outputs (a number) in a special cell of a given sheet of an excel file? for example I have built an excel file (say results.xlsx) and I want to fill it by my outputs (say out(i)s). For example I want to put out(1) in B5 cell of first sheet of results.xls, out(2) in C10 cell of second sheet of results.xls and etc. How can this be done?

We can simplify the above problem: suppose I have built a table (say outs) using my outputs and export it as an excel file () as follows

out(1) = 1;
out(2) = 2;
out(3) = 3;
out(4) = 4;

outs1=Table(out(i), {i, 1, 4});
Export("results.xlsx", outs1, "Data")

this command gives me an excel file which has a row including values of out1.

I run another .nb file and do the same namely I build another table (outs2) as follows

out(5) = 5;
out(6) = 6;
out(7) = 7;
out(8) = 8;

outs2=Table(out(i), {i, 5, 8});

Now I want to put outs2 as second row of results.xlsx file. How?