plotting – Problems with while loop Infinite expression 1/0 encountered

everybody.

I’ve trying to code a kinetic monte carlo simulation for a dimerization reaction,
2M —> D. However I have a kinetic monte carlo code for a first order decomposition reaction of AIBN (that’s the name of the chemical compound)

The code for AIBN decomposition works perfectly, but when I try to copy it to use it for the M compound, the code fails and Mathematica goes in a infinite loop saying: “Power: Infinte expression 1/0 encountered ” and then it says “Infinity:Indeterminite expression o Complexinfinity encountered”.

I don’t know why the AIBN code works and the dimerization code for M doesn’t if is exactly the same structure. Mathematica only graphs the analytical solution for M but doesn’t graph the outputstream resulting from the while Loop for kinetic Monte Carlo.

Thanks so much for you help

Here is the code that works, for the AIBN decomposition

AIBN0 = 0.01;(*mol/L*)

R = 1.98;TK = 60 + 273.15;

kdi = 2.89*10^(15)*Exp(-31130/(R*TK));(* s^-1*)

tf = 3600;(*%s*)

ta = {t, 0, tf};

AIBN = (AIBN0)*Exp(-kdi*t);

p1 = Plot(AIBN, ta , PlotStyle -> Red);

NAV = 2*10^6;

XAIBN = AIBN0*NAV;

kdiMC = kdi;

tb = 0.0;

AIBN = AIBN0;

Niter = 0;

file = OpenWrite("Result1.dat", FormatType -> OutputForm)

toc = Timing(
   While(tb < tf,
    Write(file, tb, " ", AIBN);
    Niter = Niter + 1;
    a0 = kdiMC*XAIBN;
    XAIBN = XAIBN - 1;
    AIBN = XAIBN/NAV;
    tb = tb - Log(RandomReal())/a0));

Print(Niter, toc)

Close(file);

Result = Import("Result1.dat");

p2 = ListPlot(Result, DataRange -> {0, 600});


Show(p1, p2)```







**Here the code that doesn't work, for the M compound dimerization**

```Mo = 5; (*mol/L*) (*Initial concentration of M*)

R = 1.98 (*J/(mol K)*); (*Ideal Gas constant*)

Tk = 383; (*K, Temperature*)

kdim = 2.52(10^4)Exp((-22347/(R*Tk))) (*L/(mol s)*) (*Kinetic constant*)

tf = 30000(60)(60); (*s, final reaction time, 30'000 hours*)

M = Mo/(1 + 2 kdim *t *Mo); (*Analytical solution*)

p6 = Plot(M, {t, 0, tf}, PlotLabel -> "Concentration vs Time", AxesLabel -> {"Time (s)", "Concentration (mol/L)"}, PlotStyle -> {Red}, PlotLegends -> {"(M)"})

NAV = 2*10^3; (*Avogadro number times Volume, (molecules L)/mol*)

XM = Mo*NAV; (* number of M molecules*)

kdimMC = 2*kdim/NAV; (*Monte Carlo kinetic constant*)

tb = 0.0; (*FIrst Iteration time*)

M = Mo; (*First Concentration Value of M*)

Niter = 0; (*First Iteration*)

file = OpenWrite("Result3.dat", FormatType -> OutputForm)

toc = Timing(While(tb <= tf, Write(file, tb, " ", M); Niter = Niter + 1; a0 = kdimMC*XM*(XM - 1)/2; XM = XM - 2; M = XM/NAV; tb = tb - Log(RandomReal())/a0));

Print(Niter, toc)



Close(file);

Result = Import("Result3.dat");

p9 = ListPlot(Result, DataRange -> {0, 108000000});

Show(p6, p9)```


centos – Mysql packages skipped [dependency problems]

This may look like a repeat question, but I have done my research and still am unable to find a solution to this problem.

The problem:

When installing mysql server on my linux box, I receive Error notifications during the mysql installation. These errors state there are missing dependencies.

The installation output:

(root@ded501 mcnations)# sudo yum install mysql80-community-release-el8-1.noarch                                                                                                                                                             .rpm
Loaded plugins: fastestmirror
Examining mysql80-community-release-el8-1.noarch.rpm: mysql80-community-release-                                                                                                                                                             el8-1.noarch
mysql80-community-release-el8-1.noarch.rpm: does not update installed package.
Error: Nothing to do
(root@ded501 mcnations)# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64       MySQL Connectors Community            74
mysql-tools-community/x86_64            MySQL Tools Community                 33
mysql80-community/x86_64                MySQL 8.0 Community Server            81
(root@ded501 mcnations)# sudo yum install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: reflector.westga.edu
 * extras: repos-tx.psychz.net
 * updates: mirror.teklinks.com
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:8.0.21-1.el8 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 8.0.21-1.el8 for pack                                                                                                                                                            age: mysql-community-server-8.0.21-1.el8.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package:                                                                                                                                                             mysql-community-server-8.0.21-1.el8.x86_64
--> Processing Dependency: net-tools for package: mysql-community-server-8.0.21-1                                                                                                                                                            .el8.x86_64
--> Processing Dependency: libtirpc.so.3(TIRPC_0.3.3)(64bit) for package: mysql-c                                                                                                                                                            ommunity-server-8.0.21-1.el8.x86_64
--> Processing Dependency: libtirpc.so.3(TIRPC_0.3.0)(64bit) for package: mysql-c                                                                                                                                                            ommunity-server-8.0.21-1.el8.x86_64
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.22)(64bit) for package: mys                                                                                                                                                            ql-community-server-8.0.21-1.el8.x86_64
--> Processing Dependency: libtirpc.so.3()(64bit) for package: mysql-community-se                                                                                                                                                            rver-8.0.21-1.el8.x86_64
--> Processing Dependency: libssl.so.1.1()(64bit) for package: mysql-community-se                                                                                                                                                            rver-8.0.21-1.el8.x86_64
--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: mysql-community                                                                                                                                                            -server-8.0.21-1.el8.x86_64
---> Package net-tools.x86_64 0:2.0-0.25.20131004git.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2                                                                                                                                                            .10.1-7.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for pac                                                                                                                                                            kage: 2:postfix-2.10.1-7.el7.x86_64
---> Package mysql-community-client.x86_64 0:8.0.21-1.el8 will be installed
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.21)(64bit) for package: mys                                                                                                                                                            ql-community-client-8.0.21-1.el8.x86_64
--> Processing Dependency: libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) for package: my                                                                                                                                                            sql-community-server-8.0.21-1.el8.x86_64
--> Processing Dependency: libc.so.6(GLIBC_2.28)(64bit) for package: mysql-commun                                                                                                                                                            ity-server-8.0.21-1.el8.x86_64
--> Processing Dependency: libtirpc.so.3()(64bit) for package: mysql-community-se                                                                                                                                                            rver-8.0.21-1.el8.x86_64
--> Processing Dependency: libssl.so.1.1()(64bit) for package: mysql-community-se                                                                                                                                                            rver-8.0.21-1.el8.x86_64
--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: mysql-community                                                                                                                                                            -server-8.0.21-1.el8.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be updated
---> Package mariadb-libs.x86_64 1:5.5.65-1.el7 will be an update
---> Package mysql-community-client.x86_64 0:8.0.21-1.el8 will be installed
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.21)(64bit) for package: mys                                                                                                                                                            ql-community-client-8.0.21-1.el8.x86_64
---> Package mysql-community-libs.x86_64 0:8.0.21-1.el8 will be obsoleting
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.21)(64bit) for package: mys                                                                                                                                                            ql-community-libs-8.0.21-1.el8.x86_64
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.20)(64bit) for package: mys                                                                                                                                                            ql-community-libs-8.0.21-1.el8.x86_64
--> Processing Dependency: libstdc++.so.6(CXXABI_1.3.9)(64bit) for package: mysql                                                                                                                                                            -community-libs-8.0.21-1.el8.x86_64
--> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_1)(64bit) for package: mysql                                                                                                                                                            -community-libs-8.0.21-1.el8.x86_64
--> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_0)(64bit) for package: mysql                                                                                                                                                            -community-libs-8.0.21-1.el8.x86_64
--> Processing Dependency: libssl.so.1.1()(64bit) for package: mysql-community-se                                                                                                                                                            rver-8.0.21-1.el8.x86_64
--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: mysql-community                                                                                                                                                            -server-8.0.21-1.el8.x86_64
---> Package postfix.x86_64 2:2.10.1-7.el7 will be updated
---> Package postfix.x86_64 2:2.10.1-9.el7 will be an update
Removing mariadb-libs.x86_64 1:5.5.65-1.el7 - u due to obsoletes from mysql-commu                                                                                                                                                            nity-libs.x86_64 0:8.0.21-1.el8 - u
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.65-1.el7 will be an update
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for pac                                                                                                                                                            kage: 2:postfix-2.10.1-9.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2                                                                                                                                                            .10.1-9.el7.x86_64
---> Package mysql-community-client.x86_64 0:8.0.21-1.el8 will be installed
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.21)(64bit) for package: mys                                                                                                                                                            ql-community-client-8.0.21-1.el8.x86_64
--> Processing Dependency: libssl.so.1.1()(64bit) for package: mysql-community-cl                                                                                                                                                            ient-8.0.21-1.el8.x86_64
--> Processing Dependency: libncurses.so.6()(64bit) for package: mysql-community-                                                                                                                                                            client-8.0.21-1.el8.x86_64
--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: mysql-community                                                                                                                                                            -client-8.0.21-1.el8.x86_64
---> Package mysql-community-libs.x86_64 0:8.0.21-1.el8 will be obsoleting
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.21)(64bit) for package: mys                                                                                                                                                            ql-community-libs-8.0.21-1.el8.x86_64
---> Package mysql-community-server.x86_64 0:8.0.21-1.el8 will be installed
--> Processing Dependency: libtirpc.so.3(TIRPC_0.3.3)(64bit) for package: mysql-c                                                                                                                                                            ommunity-server-8.0.21-1.el8.x86_64
--> Processing Dependency: libc.so.6(GLIBC_2.28)(64bit) for package: mysql-commun                                                                                                                                                            ity-server-8.0.21-1.el8.x86_64
--> Processing Dependency: libtirpc.so.3()(64bit) for package: mysql-community-se                                                                                                                                                            rver-8.0.21-1.el8.x86_64
--> Processing Dependency: libssl.so.1.1()(64bit) for package: mysql-community-se                                                                                                                                                            rver-8.0.21-1.el8.x86_64
--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: mysql-community                                                                                                                                                            -server-8.0.21-1.el8.x86_64
--> Finished Dependency Resolution
Error: Package: mysql-community-server-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libssl.so.1.1(OPENSSL_1_1_0)(64bit)
Error: Package: mysql-community-server-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libssl.so.1.1(OPENSSL_1_1_1)(64bit)
Error: Package: mysql-community-libs-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libssl.so.1.1(OPENSSL_1_1_0)(64bit)
Error: Package: mysql-community-libs-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libc.so.6(GLIBC_2.28)(64bit)
Error: Package: mysql-community-client-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
Error: Package: mysql-community-client-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libssl.so.1.1(OPENSSL_1_1_0)(64bit)
Error: Package: mysql-community-libs-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
Error: Package: 2:postfix-2.10.1-9.el7.x86_64 (base)
           Requires: libmysqlclient.so.18()(64bit)
           Removing: 1:mariadb-libs-5.5.60-1.el7_5.x86_64 (@base)
               libmysqlclient.so.18()(64bit)
           Obsoleted By: mysql-community-libs-8.0.21-1.el8.x86_64 (mysql80-commun                                                                                                                                                            ity)
              ~libmysqlclient.so.21()(64bit)
           Updated By: 1:mariadb-libs-5.5.65-1.el7.x86_64 (base)
               libmysqlclient.so.18()(64bit)
Error: Package: mysql-community-client-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
           Requires: libcrypto.so.1.1()(64bit)
Error: Package: mysql-community-client-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libssl.so.1.1()(64bit)
Error: Package: mysql-community-client-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(CXXABI_1.3.9)(64bit)
Error: Package: mysql-community-client-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libcrypto.so.1.1(OPENSSL_1_1_0)(64bit)
Error: Package: mysql-community-server-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libcrypto.so.1.1(OPENSSL_1_1_0)(64bit)
Error: Package: mysql-community-client-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libcrypto.so.1.1()(64bit)
Error: Package: mysql-community-server-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libstdc++.so.6(GLIBCXX_3.4.22)(64bit)
Error: Package: mysql-community-server-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libssl.so.1.1()(64bit)
Error: Package: 2:postfix-2.10.1-9.el7.x86_64 (base)
           Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit)
           Removing: 1:mariadb-libs-5.5.60-1.el7_5.x86_64 (@base)
               libmysqlclient.so.18(libmysqlclient_18)(64bit)
           Obsoleted By: mysql-community-libs-8.0.21-1.el8.x86_64 (mysql80-commun                                                                                                                                                            ity)
               Not found
           Updated By: 1:mariadb-libs-5.5.65-1.el7.x86_64 (base)
               libmysqlclient.so.18(libmysqlclient_18)(64bit)
Error: Package: mysql-community-client-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libtinfo.so.6()(64bit)
Error: Package: mysql-community-server-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libcrypto.so.1.1(OPENSSL_1_1_1)(64bit)
Error: Package: mysql-community-server-8.0.21-1.el8.x86_64 (mysql80-community)
           Requires: libtirpc.so.3(TIRPC_0.3.0)(64bit)
 You could try using --skip-broken to work around the problem

I ran the --skip command, and it simply repeated the packages from the error section.

I attempted the solution here by downloading yumutils & removing duplicates, but apparently there are no duplicates.

I attempted the solution here in the first answer by Louis, as well as the the second answer by Ed Moxley. No dice for either attempt.

There is nothing in the mysql documentation (that I can see) that addresses this problem. I have been following mysql’s installation procedure found here.

Other Solutions:

The Mysql documentation states you can download individual packages. I attempted to address one of the missing dependencies via sudo yum install libstdc++.so.6. This installation failed, and provided the following message:

Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:

         1. You have an upgrade for libstdc++ which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of libstdc++ of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude libstdc++.otherarch ... this should give you an error
            message showing the root cause of the problem.

         2. You have multiple architectures of libstdc++ installed, but
            yum can only see an upgrade for one of those architectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.

         3. You have duplicate versions of libstdc++ installed already.
            You can use "yum check" to get yum show these errors.

       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).

When I tried running package-cleanup --cleandupes I was informed there were no duplicates, which is directly contradictory of the above error…

Any help in solving this problem is greatly appreciated.

vue.js – How To Solve Iterating Problems in V-Select in Vue

I have a simple problem in iterating the values in my v-select. My problem is that i need the values on mounted not editable and when i try to click add document then that’s the time i can add a document. Currently right now, when i try to add a document row, the values on mounted is also adding up.

Pls see this codepen CLICK HERE

CODE

  <template v-for="(document, index) in form.documents">
    <v-container :key="index">

      <!-- NOT EDITABLE -->
      <v-row>
        <div>
          <div>
            <h4>{{document.type.name}}</h4>
          </div>
          <div>
            <v-btn color="primary" dark :href="`${document.file}`" target="_blank" small>
              <v-icon dark left>mdi-file-download</v-icon>Download
            </v-btn>
          </div>
        </div>
      </v-row>
      <!-- NOT EDITABLE -->

      <v-row>
        <v-col md="5">
          <v-select label="Document Type" v-model="document.type.id" :items="document_types" item-text="name" item-value="id" outlined hide-details="auto"></v-select>
        </v-col>
        <v-col md="6">
          <v-file-input :v-model="document.file" label="File" outlined hide-details="auto" :show-size="1000">
            <template v-slot:selection="{ text }">
              <v-chip color="primary" dark label small>{{ text }}</v-chip>
            </template>
          </v-file-input>
        </v-col>
        <v-col md="1" class="align-self-center">
          <v-btn color="red" block dark @click="removeDocument(document)">
            <v-icon>mdi-delete</v-icon>
          </v-btn>
        </v-col>
      </v-row>

    </v-container>
  </template>
  <v-container>
    <v-row>
      <v-col>
        <v-btn large @click="addDocument()">
          <v-icon left>mdi-plus-thick</v-icon>Add Document
        </v-btn>
      </v-col>
    </v-row>
  </v-container>

mathematical optimization – Time computation problems with “Maximize” expression

I just started to use Mathematica a few weeks ago. I am afraid there is something that does not work on my laptop because, for the following simple command, it takes too much time. Do you know if there is a mistake in this command syntax? Thank you in advance for your help.

Maximize({(g/e)*Sqrt(((g – e)^2 + (f – h)^2)), 0 <= e <= 1,
0 <= f <= 1, e^2 + f^2 == 1, 0 <= g <= e, 0 <= h <= f}, {e, f, g, h})

Exercises to practice design pattern problems (ideally in Java)?

I’m looking for a set of practice problems to deepen my understanding of design patterns and to practice implementing them myself. However neither the canonical Gang of Four book nor the popular Head First Design Patterns have much in the way of exercises (the latter has some ‘exercises’ which aren’t programming-based). Does such a textbook, problem set from a college course, or something else to that effect exist?

laptop – Using HDMI to VGA adapter concerns and problems

I am currently using an HP OneDrive notebook and an ASUS VS197 Monitor.

The notebook only has an HDMI port so i ordered online an adapter(HDMI to VGA) so i can use my external monitor.

The notebook’s screen is pretty small and since i have a working monitor i’m using it instead of straining my eyes on such a small screen.

The adapter is a vention HDMI to VGA adapter, Link here from amazon: https://www.amazon.com/Vention-Adapter-Converter-Raspberry-Projector/dp/B07H4F9P2Y

To be honest, i’ve used the adapter for a few weeks and haven’t noticed there were 2 more inputs in the adapter, the audio and power supply.

Which is understandable(excuses) because i just plugged it in and it worked on the first try. Which i assume is because my HDMI port supplies enough power for the adapter without needing to connect to an external power supply.

I was curious about the two cables it came with though and just assumed it was some kind of package deal.

Anyways, my problem here is that sometimes the monitor goes black for a second but the display returns and it is consistent. There are just times that that just happens. So it leaves me worried that it might crescendo into something big later.

There is also this one website i frequent on(Web novel translation site) wherein sometimes there are black rectangular boxes on the screen. But this is an isolated issue, i havent noticed it happening on any other site so it might just be a loading error on that site alone.

I also haven’t checked for specific details since my display is only on the external monitor. Thinking about it now, i should have tested it out if it is the same with the notebook’s display and not just on the external monitor.

Anyways, at the moment i’m just rationalizing that it may just be a power issue with the adapter where power is cut off for a second hence my external monitor display going black for a second.

With that in mind, should i just connect the external power supply to the usb port of my notebook?

Or would that cause too much power to flow into the adapter since the HDMI port already provides enough for it to function?

Another concern i have is that i mentioned that i only have display outputting onto my external monitor. Is this bad for my notebook display?

P.S. this is my first time using an adapter since my PC and laptop history always had a VGA port.

smartcontracts – Solve problems using bitcoin smart contracts

Been trying to ask this to few people on different platforms but nothing was helpful so trying here and will keep trying because I don’t even know what else can I do to learn more and contribute.

What will be the best way or resources to refer if someone has an idea and want to implement it using bitcoin smart contracts?

For example: If I want to create a decentralized insurance product which might even need external data so won’t be completely decentralized but trust minimized, non custodial, non kyc and better than present solutions. Users will have to regularly pay some amount which should be locked in some multisig setup and used in a way that it gets interest so maybe provide liquidity in joinmarket, create a lending/borrowing thing using discreet log contracts or something else, these profits can be used to cover life and release amounts after verification on claims

How would I approach solving this problem using bitcoin?

What are best resources to learn more about discreet log contracts, it’s examples?

formatting – Problems with cart and pages on _s theme

I recently took over managing this website Berman Instruments, one of our clients. They claim that it the cart was working until June. This is a 2 part problem.

In this scenario, an unregistered user comes to the site, puts products in the cart, clicks on the cart then checkout, they are prompted to login or register on the My Account page. The formatting of this page is no longer correct. The second part of this problem is, once a new user completes registering, clicks on the cart, the cart empties.

I have updated the plugins and have been in touch with Flywheels, WooCommerce, and Gravity multiple times trying to resolve this issue. My last contact with WooCommerce support told me that the underscores theme is out of date. I read on Stack Exchange “you’re not supposed to update Underscores. There isn’t really even anything to update. At this point it has become your theme and doesn’t exist on its own.”

I have also spent some time searching for help on Git Hub and Stack Exchange. Can anyone offer some advise?

This image shows the formatting issue on the My Account page
enter image description here

dnd 5e – Are there any unexpected problems with this Homebrew feat?

The feat is balanced but can be improved by taking inspiration from Crossbow Expert.

The feat seems balanced, in the sense that Knife Fighter wielding a dagger makes it comparable to Dual Wielder with swords. But, we can take inspiration from Crossbow Expert to make the feat more clear.

The third point of Crossbow Expert says:

When you use the Attack action and attack with a one-handed weapon, you can use a bonus action to attack with a hand crossbow you are holding.

I would model the second point of Knife Fighter after this like so:

When you use the Attack action and attack with a one-handed melee weapon, you can use a bonus action to make a melee attack with a dagger you are holding.

First, it seems this does exactly the same thing as your original wording when you are holding a rapier and a dagger, but I think this actually improves the feat without making it stronger: it grants the bonus action attack when your are holding a dagger and only that dagger. Much like crossbow expert for hand crossbows, this would allow one to make an Attack action attack and a bonus action attack while only holding one dagger – which seems more true to the name Knife Fighter.

This change makes the feat more flexible without making it more powerful, and to me, seems more appropriate. It would seem odd to me if Knife Fighter didn’t make you better at fighting with just one knife.

Finally, I would just reword the last point like so:

When you make a melee weapon attack with a dagger and hit, you add 2 damage to the damage roll.

I think this clarification fixes any question we might have about when it triggers.